mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-25 17:26:58 +00:00
[Win] Fixed axis range calculation
Values are now correctly scaled between [min, max]
This commit is contained in:
parent
f010e32570
commit
e3875527eb
|
@ -54,9 +54,8 @@ namespace OpenTK.Platform.Common
|
||||||
MathHelper.Clamp(value, value_min, value_max);
|
MathHelper.Clamp(value, value_min, value_max);
|
||||||
|
|
||||||
int range = result_max - result_min;
|
int range = result_max - result_min;
|
||||||
int half_range = range >> 1;
|
|
||||||
long temp = (value - value_min) * range; // need long to avoid overflow
|
long temp = (value - value_min) * range; // need long to avoid overflow
|
||||||
return (int)(temp / (value_max - value_min) + half_range);
|
return (int)(temp / (value_max - value_min) + result_min);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JoystickAxis TranslateJoystickAxis(HIDPage page, int usage)
|
public static JoystickAxis TranslateJoystickAxis(HIDPage page, int usage)
|
||||||
|
|
Loading…
Reference in a new issue