[Win] Fixed axis range calculation
Values are now correctly scaled between [min, max]
This commit is contained in:
parent
f010e32570
commit
e3875527eb
1 changed files with 1 additions and 2 deletions
|
@ -54,9 +54,8 @@ namespace OpenTK.Platform.Common
|
|||
MathHelper.Clamp(value, value_min, value_max);
|
||||
|
||||
int range = result_max - result_min;
|
||||
int half_range = range >> 1;
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue