stop counting os key repeats as inputs and add is_action_stop
This commit is contained in:
parent
113c8444c4
commit
631c920eb6
@ -127,7 +127,9 @@ handle_sokol_event :: (event: *sapp_event) {
|
|||||||
new_event.key_code = mapped;
|
new_event.key_code = mapped;
|
||||||
new_event.key_pressed = 1;
|
new_event.key_pressed = 1;
|
||||||
add_modifier_info(event, *new_event);
|
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;
|
case .KEY_UP;
|
||||||
mapped := get_key_code(event.key_code);
|
mapped := get_key_code(event.key_code);
|
||||||
new_event.type = .KEYBOARD;
|
new_event.type = .KEYBOARD;
|
||||||
|
|||||||
@ -103,6 +103,10 @@ is_action_start :: (action: $T) -> bool {
|
|||||||
return check_action(action, .START);
|
return check_action(action, .START);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_action_stop :: (action: $T) -> bool {
|
||||||
|
return check_action(action, .END);
|
||||||
|
}
|
||||||
|
|
||||||
init_keybinds :: () {
|
init_keybinds :: () {
|
||||||
set_default_bindings();
|
set_default_bindings();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user