Implemented spawn points correctly. Added saving & loading (currently only implemented with the spawn_index). You can now set spawn indicies in the DynamicAreaLoader to automatically load when the game is set to that value (on ready). Added configuration warnings to DynamicAreaLoader & PlayerSpawnPoint Added some generic translation (pot) files. Added AudioManager autoload to play, stop, fade audio streams (and set the bus directly). Added SceneFader autoload. Added SaveManager autoload. Added OptionsMenu with currently only volume sliders and a fullscreen toggle button. Added PauseMenu
30 lines
768 B
GDScript
30 lines
768 B
GDScript
extends Node
|
|
|
|
const TOGGLE_MOUSE_BUTTON: StringName = &"toggle_mouse"
|
|
|
|
var using_controller: bool = false
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if not window_focused():
|
|
get_viewport().set_input_as_handled()
|
|
return
|
|
|
|
if event is InputEventMouseButton or event is InputEventKey:
|
|
if using_controller:
|
|
using_controller = false
|
|
elif event is InputEventJoypadButton or event is InputEventJoypadMotion:
|
|
if not using_controller:
|
|
using_controller = true
|
|
|
|
if event.is_action_pressed(TOGGLE_MOUSE_BUTTON):
|
|
toggle_mouse()
|
|
|
|
|
|
func window_focused() -> bool:
|
|
return DisplayServer.window_is_focused()
|
|
|
|
|
|
func toggle_mouse() -> void:
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED if Input.mouse_mode == Input.MOUSE_MODE_VISIBLE else Input.MOUSE_MODE_VISIBLE)
|