diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-09-07 14:11:05 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-09-07 14:11:05 +0200 |
| commit | 5e105902f0abfaba01bc878956fe3c9a096aa455 (patch) | |
| tree | 8d26374137a1f9d6cf4dc9f526de59103dc82f11 /client/settings.gd | |
| parent | 923b4d1aa63b6226365a53a7fe227a734760ed1e (diff) | |
| download | hurrycurry-5e105902f0abfaba01bc878956fe3c9a096aa455.tar hurrycurry-5e105902f0abfaba01bc878956fe3c9a096aa455.tar.bz2 hurrycurry-5e105902f0abfaba01bc878956fe3c9a096aa455.tar.zst | |
wildcard hooks
Diffstat (limited to 'client/settings.gd')
| -rw-r--r-- | client/settings.gd | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/settings.gd b/client/settings.gd index 5501f1ab..341db7cc 100644 --- a/client/settings.gd +++ b/client/settings.gd @@ -66,6 +66,11 @@ static func get_root(): ]) ]) +static func trigger_hook(key: String, value): + if Settings.change_hooks_display.get(key) != null: Settings.change_hooks_display.get(key).call(value) + if Settings.change_hooks_apply.get(key) != null: Settings.change_hooks_apply.get(key).call(value) + if key.find(".") != -1: trigger_hook(key.rsplit(".", false, 1)[0], null) + static func hook_changed(key: String, display: bool, callable: Callable): if display: change_hooks_display[key] = callable else: change_hooks_apply[key] = callable @@ -76,6 +81,7 @@ static func hook_changed_init(key: String, display: bool, callable: Callable): static var change_hooks_display = {} static var change_hooks_apply = { + "input": h_input, "graphics.aa": h_aa, "graphics.taa": h_taa, "graphics.fullscreen": h_fullscreen, @@ -142,10 +148,11 @@ static func h_fullscreen(mode: String): "never": if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) +static func h_input(_x): + pass + # InputManager.apply_input_map(InputManager.settings_dictionary_to_input_map()) + # TODO whatever this does # if not get_setting("tutorial_started"): # for k in profile["hints"].keys(): # set_hint(k, false) - -# TODO update input map for *all* input with a single hook -# InputManager.apply_input_map(InputManager.settings_dictionary_to_input_map(get_category_settings("input"))) |