summaryrefslogtreecommitdiff
path: root/tests/test_main.cpp
diff options
context:
space:
mode:
authorEricEzaM <itsjusteza@gmail.com>2020-12-14 00:22:42 +1000
committerEric M <itsjusteza@gmail.com>2020-12-15 09:14:18 +1000
commitb2f032e1a5ffc1332278be33075c2d19c336a457 (patch)
treea8f8f180f5e4f2c8ed4fe0d323ab51396e1ccbd8 /tests/test_main.cpp
parent0762484473c1330c5d524d5cc3644d5e2b2e557c (diff)
Allow checking for exact matches with Action events.
Added additional param to action related methods to test for exactness. If "p_exact_match" is true, then the action will only be "matched" if the provided input event *exactly* matches with the action event. Before: * Action Event = KEY_S * Input Event = KEY_CONTROL + KEY_S * Is Action Pressed = True Now: You can still do the above, however you can optionally check that the input is exactly what the action event is: * Action Event = KEY_S * Input Event = KEY_CONTROL + KEY_S * p_exact_match = True * Is Action Pressed = False * If the Input Event was only KEY_S, then the result would be true. Usage: ```gdscript Input.is_action_pressed(action_name: String, exact_match: bool) Input.is_action_pressed("my_action", true) InputMap.event_is_action(p_event, "my_action", true) func _input(event: InputEvent): event.is_action_pressed("my_action", false, true) # false = "allow_echo", true = "exact_match" event.is_action("my_action", true) ```
Diffstat (limited to 'tests/test_main.cpp')
0 files changed, 0 insertions, 0 deletions