summaryrefslogtreecommitdiff
path: root/core/input
diff options
context:
space:
mode:
authorNinni Pipping <over999ships@gmail.com>2023-02-09 11:43:23 +0100
committerNinni Pipping <over999ships@gmail.com>2023-02-09 11:43:23 +0100
commit29031700ba4829ee6e624eb8220e8e817486c935 (patch)
tree09588b9858d53b6777121e66a9d3c2e88ee9067b /core/input
parentd69809cab603cae9f525768337affe5e12e454a8 (diff)
Perform early exit in Input::is_anything_pressed
Diffstat (limited to 'core/input')
-rw-r--r--core/input/input.cpp9
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 {