summaryrefslogtreecommitdiff
path: root/main/input_default.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-02-16 07:48:17 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-02-16 07:48:17 +0100
commita63ebda21f9be212df73e293c8a55381847d02f8 (patch)
treee4871a0b49b20c9fe78743c152de9f5888f425ca /main/input_default.cpp
parent747c1709aafd4bdd9a97c63519f077be481a6a35 (diff)
parent04f7c3284770a1862c8e270e40f9d2416d055ce1 (diff)
Merge pull request #3722 from Hinsbart/fix_action_pressed
fix joystick axis handling for Input.is_action_pressed()
Diffstat (limited to 'main/input_default.cpp')
-rw-r--r--main/input_default.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 3c81bcef4f..3af02b2b1f 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -102,6 +102,18 @@ bool InputDefault::is_action_pressed(const StringName& p_action) {
if (joy_buttons_pressed.has(c))
return true;
} break;
+ case InputEvent::JOYSTICK_MOTION: {
+
+ const InputEventJoystickMotion &iejm=E->get().joy_motion;
+ int c = _combine_device(iejm.axis,device);
+ if (_joy_axis.has(c)) {
+ if (iejm.axis_value < 0) {
+ if (_joy_axis[c] < -0.5f) return true;
+ }
+ else
+ if (_joy_axis[c] > 0.5f) return true;
+ }
+ } break;
}
}