[Win] Fixed axis range calculation

Values are now correctly scaled between [min, max]
This commit is contained in:
thefiddler 2014-07-31 22:27:22 +02:00
parent f010e32570
commit e3875527eb

View file

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