diff options
Diffstat (limited to 'client/global.gd')
-rw-r--r-- | client/global.gd | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/global.gd b/client/global.gd index 2d0c0cb2..d50788ba 100644 --- a/client/global.gd +++ b/client/global.gd @@ -18,14 +18,15 @@ extends Node signal settings_changed() +signal using_joypad_change(using: bool) var default_profile := { "username": "Giovanni", "character": 0, "last_server_url": "" } - var languages := [tr("System default"), "en", "de"] +var using_joypad := false var default_settings := { "language": DropdownSetting.new(tr("Language"), 0, languages), @@ -63,12 +64,23 @@ func _ready(): get_viewport().gui_focus_changed.connect(Sound.play_hover_maybe) get_viewport().gui_focus_changed.connect(func (node): focused_node = node) + -func _input(_event): +func _input(event): if Input.is_action_just_pressed("fullscreen"): Global.set_setting("fullscreen", not Global.get_setting("fullscreen")) save_settings() update_fullscreen() + + # Update using_joypad variable + if event is InputEventMouseButton or event is InputEventKey: + if using_joypad: + using_joypad = false + using_joypad_change.emit(using_joypad) + elif event is InputEventJoypadButton or event is InputEventJoypadMotion: + if not using_joypad: + using_joypad = true + using_joypad_change.emit(using_joypad) func apply_settings(): update_fullscreen() |