1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Fix Actions mapped to triggers not using the full range

This commit is contained in:
Marcel Admiraal
2021-12-25 09:29:08 +00:00
parent 6689a9360c
commit f41c72c538
12 changed files with 65 additions and 127 deletions

View File

@@ -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) {