diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-12-25 09:29:08 +0000 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2022-01-14 15:36:20 +0000 |
commit | f41c72c5384ff9ce34f60380d4f27b9af0904298 (patch) | |
tree | b7c218ab98ea31284e85edecc543986fbae94e06 /platform/uwp/joypad_uwp.cpp | |
parent | 6689a9360c2dae0ca940e4e470c4d0a0e0a9bef4 (diff) |
Fix Actions mapped to triggers not using the full range
Diffstat (limited to 'platform/uwp/joypad_uwp.cpp')
-rw-r--r-- | platform/uwp/joypad_uwp.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp index ef44f0b14d..e48016919b 100644 --- a/platform/uwp/joypad_uwp.cpp +++ b/platform/uwp/joypad_uwp.cpp @@ -134,13 +134,12 @@ void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Inp input->joy_connection_changed(idx, false, "Xbox Controller"); } -InputDefault::JoyAxisValue JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const { - InputDefault::JoyAxisValue jx; - - jx.min = p_trigger ? 0 : -1; - jx.value = (float)(p_negate ? -p_val : p_val); - - return jx; +float JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const { + if (p_trigger) { + // Convert to a value between -1.0f and 1.0f. + return 2.0f * p_val - 1.0f; + } + return (float)(p_negate ? -p_val : p_val); } void JoypadUWP::joypad_vibration_start(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) { |