diff options
| author | Andreas Haas | 2016-09-15 19:30:35 +0200 |
|---|---|---|
| committer | Andreas Haas | 2016-09-15 19:30:35 +0200 |
| commit | 84783fe77b5dfa89a1bcf5a7e60a3b3ab7d876bd (patch) | |
| tree | 87a659a1b10ec98cb5ed361b9bf5b18f4335f650 /main/input_default.cpp | |
| parent | 8bcb6a290c61d40333cf3aa73e362836b6e12659 (diff) | |
| download | godot-84783fe77b5dfa89a1bcf5a7e60a3b3ab7d876bd.tar.gz godot-84783fe77b5dfa89a1bcf5a7e60a3b3ab7d876bd.tar.zst godot-84783fe77b5dfa89a1bcf5a7e60a3b3ab7d876bd.zip | |
Fix input action pressed state not changing for quick joystick movements.
fixes #6488
Also removes a bunch of dead code related to checking if a joystick axis is pressed.
Diffstat (limited to '')
| -rw-r--r-- | main/input_default.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index 089772edc..2020f7a5a 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -849,6 +849,13 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co return p_last_id; } + if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) { + //changed direction quickly, insert fake event to release pending inputmap actions + JoyAxis jx; + jx.min = p_value.min; + jx.value = p_value.value < 0 ? 0.1 : -0.1; + p_last_id = joy_axis(p_last_id, p_device, p_axis, jx); + } joy.last_axis[p_axis] = p_value.value; float val = p_value.min == 0 ? -1.0f + 2.0f * p_value.value : p_value.value; |
