diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-24 20:10:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 20:10:29 +0200 |
commit | d0a2a4c98195eb8a43713286b5b865dfbed05163 (patch) | |
tree | 3664c5097e6ffcba25e6e388482b8abab535ada9 | |
parent | 686286ed9d57f93688a9962409a32b44b99aff32 (diff) | |
parent | 61be6175717091f4da5d75a4321c9fc9577a9f6c (diff) |
Merge pull request #64531 from madmiraal/fix-63972-2
Fix axis mapped to DPad buttons not releasing opposite button
-rw-r--r-- | core/input/input.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index ff7ac59e1f..4e538a85ae 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -971,11 +971,9 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) { if (map.type == TYPE_BUTTON) { bool pressed = map.value > 0.5; - if (pressed == joy_buttons_pressed.has(_combine_device((JoyButton)map.index, p_device))) { - // Button already pressed or released; so ignore. - return; + if (pressed != joy_buttons_pressed.has(_combine_device((JoyButton)map.index, p_device))) { + _button_event(p_device, (JoyButton)map.index, pressed); } - _button_event(p_device, (JoyButton)map.index, pressed); // Ensure opposite D-Pad button is also released. switch ((JoyButton)map.index) { @@ -1126,7 +1124,7 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J value = -value; } if (binding.input.axis.range == FULL_AXIS || - (binding.input.axis.range == POSITIVE_HALF_AXIS && value > 0) || + (binding.input.axis.range == POSITIVE_HALF_AXIS && value >= 0) || (binding.input.axis.range == NEGATIVE_HALF_AXIS && value < 0)) { event.type = binding.outputType; float shifted_positive_value = 0; |