[Win] Fixed axis range calculation
authorthefiddler <stapostol@gmail.com>
Thu, 31 Jul 2014 20:27:22 +0000 (22:27 +0200)
committerthefiddler <stapostol@gmail.com>
Thu, 11 Sep 2014 10:51:48 +0000 (12:51 +0200)
Values are now correctly scaled between [min, max]

Source/OpenTK/Platform/Common/Hid.cs

index 33d5a12..bf33d46 100644 (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)