diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-09 23:42:12 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-09 23:42:12 +0100 |
commit | 91409fe0c8020dcfdb3380c2e01643a55194aa70 (patch) | |
tree | 231ef4b785f33b83796df54dda15272fa32fc951 /core | |
parent | 5c1295dc20323ee1596369b5bcf91ba6a9383336 (diff) | |
parent | 29031700ba4829ee6e624eb8220e8e817486c935 (diff) |
Merge pull request #72964 from AThousandShips/input_early_exit
Perform early exit in Input::is_anything_pressed
Diffstat (limited to 'core')
-rw-r--r-- | core/input/input.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index 071d9ba648..c04fc894c8 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -231,14 +231,17 @@ Input::VelocityTrack::VelocityTrack() { bool Input::is_anything_pressed() const { _THREAD_SAFE_METHOD_ + if (!keys_pressed.is_empty() || !joy_buttons_pressed.is_empty() || !mouse_button_mask.is_empty()) { + return true; + } + for (const KeyValue<StringName, Input::Action> &E : action_state) { if (E.value.pressed) { return true; } } - return !keys_pressed.is_empty() || - !joy_buttons_pressed.is_empty() || - !mouse_button_mask.is_empty(); + + return false; } bool Input::is_key_pressed(Key p_keycode) const { |