diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-07 19:09:01 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-07 19:09:01 +0200 |
commit | faf2c3c45f4a27769662c923f34672e7dfd7254d (patch) | |
tree | 967fa1a739ebd42099fbad1f5a6f9ef1aa778937 /client/global.gd | |
parent | b44053da52eb94d755a69eb68a4c2994d07c423f (diff) | |
parent | f0f6af6822b3057f0735adf705bcce4c4548f321 (diff) | |
download | hurrycurry-faf2c3c45f4a27769662c923f34672e7dfd7254d.tar hurrycurry-faf2c3c45f4a27769662c923f34672e7dfd7254d.tar.bz2 hurrycurry-faf2c3c45f4a27769662c923f34672e7dfd7254d.tar.zst |
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
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() |