summaryrefslogtreecommitdiffstats
path: root/core/input/input_map.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-11-20 17:03:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-11-20 17:03:23 +0100
commitcfef79415b39ca8e0f6b1234f5b810e4dc6ac3f6 (patch)
treee3dec14ce23cd90c76767a0cbdd86697953a208a /core/input/input_map.cpp
parent7c1f42506ab1b23efd9ff7ddc7fc03449bfc578c (diff)
parentbc5e2f9b96eff14e25514ebca072e3ffe75c2451 (diff)
downloadredot-engine-cfef79415b39ca8e0f6b1234f5b810e4dc6ac3f6.tar.gz
Merge pull request #99449 from Sauermann/fix-revert-device-id-clash
Revert "Fix `InputEvent` device id clash" and add a compatibility function
Diffstat (limited to 'core/input/input_map.cpp')
-rw-r--r--core/input/input_map.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 54f20a0bcc..abd2c80ce1 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -39,6 +39,8 @@
InputMap *InputMap::singleton = nullptr;
+int InputMap::ALL_DEVICES = -1;
+
void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_action", "action"), &InputMap::has_action);
ClassDB::bind_method(D_METHOD("get_actions"), &InputMap::_get_actions);
@@ -161,7 +163,7 @@ List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Re
int i = 0;
for (List<Ref<InputEvent>>::Element *E = p_action.inputs.front(); E; E = E->next()) {
int device = E->get()->get_device();
- if (device == InputEvent::DEVICE_ID_ALL_DEVICES || device == p_event->get_device()) {
+ if (device == ALL_DEVICES || device == p_event->get_device()) {
if (E->get()->action_match(p_event, p_exact_match, p_action.deadzone, r_pressed, r_strength, r_raw_strength)) {
if (r_event_index) {
*r_event_index = i;