You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Fix InputMap::event_get_index to handle unmatched events correctly
This commit is contained in:
@@ -253,8 +253,8 @@ bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName
|
|||||||
|
|
||||||
int InputMap::event_get_index(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match) const {
|
int InputMap::event_get_index(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match) const {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
event_get_action_status(p_event, p_action, p_exact_match, nullptr, nullptr, nullptr, &index);
|
bool valid = event_get_action_status(p_event, p_action, p_exact_match, nullptr, nullptr, nullptr, &index);
|
||||||
return index;
|
return valid ? index : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match, bool *r_pressed, float *r_strength, float *r_raw_strength, int *r_event_index) const {
|
bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match, bool *r_pressed, float *r_strength, float *r_raw_strength, int *r_event_index) const {
|
||||||
|
|||||||
Reference in New Issue
Block a user