From 29031700ba4829ee6e624eb8220e8e817486c935 Mon Sep 17 00:00:00 2001 From: Ninni Pipping Date: Thu, 9 Feb 2023 11:43:23 +0100 Subject: Perform early exit in Input::is_anything_pressed --- core/input/input.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core') 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 &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 { -- cgit v1.2.3