projects
/
platform
/
core
/
csapi
/
opentk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f010e32
)
[Win] Fixed axis range calculation
author
thefiddler
<stapostol@gmail.com>
Thu, 31 Jul 2014 20:27:22 +0000
(22:27 +0200)
committer
thefiddler
<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
patch
|
blob
|
history
diff --git
a/Source/OpenTK/Platform/Common/Hid.cs
b/Source/OpenTK/Platform/Common/Hid.cs
index
33d5a12
..
bf33d46
100644
(file)
--- a/
Source/OpenTK/Platform/Common/Hid.cs
+++ b/
Source/OpenTK/Platform/Common/Hid.cs
@@
-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)