From 631c920eb6588f3c7be6ab37169a30b492f054b5 Mon Sep 17 00:00:00 2001 From: Katajisto Date: Sat, 26 Sep 2026 12:37:06 +0300 Subject: [PATCH] stop counting os key repeats as inputs and add is_action_stop --- modules/Input/sokol.jai | 4 +++- src/input/keybinds.jai | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/Input/sokol.jai b/modules/Input/sokol.jai index 2991f3a..13684c1 100644 --- a/modules/Input/sokol.jai +++ b/modules/Input/sokol.jai @@ -127,7 +127,9 @@ handle_sokol_event :: (event: *sapp_event) { new_event.key_code = mapped; new_event.key_pressed = 1; add_modifier_info(event, *new_event); - input_button_states[mapped] = .START | .DOWN; + // OS key-repeat must not re-trigger START + if event.key_repeat input_button_states[mapped] |= .DOWN; + else input_button_states[mapped] = .START | .DOWN; case .KEY_UP; mapped := get_key_code(event.key_code); new_event.type = .KEYBOARD; diff --git a/src/input/keybinds.jai b/src/input/keybinds.jai index 3d682ac..45197a1 100644 --- a/src/input/keybinds.jai +++ b/src/input/keybinds.jai @@ -103,6 +103,10 @@ is_action_start :: (action: $T) -> bool { return check_action(action, .START); } +is_action_stop :: (action: $T) -> bool { + return check_action(action, .END); +} + init_keybinds :: () { set_default_bindings(); }