projects
/
enjoyable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change NJInputAnalog so magnitudes of subactions are always positive (e.g. -1 magnitu...
[enjoyable.git]
/
NJInputAnalog.m
diff --git
a/NJInputAnalog.m
b/NJInputAnalog.m
index
98ed018
..
7b4b15a
100644
(file)
--- a/
NJInputAnalog.m
+++ b/
NJInputAnalog.m
@@
-42,6
+42,8
@@
static float normalize(long p, long min, long max) {
- (void)notifyEvent:(IOHIDValueRef)value {
magnitude = normalize(IOHIDValueGetIntegerValue(value), rawMin, rawMax);
- (void)notifyEvent:(IOHIDValueRef)value {
magnitude = normalize(IOHIDValueGetIntegerValue(value), rawMin, rawMax);
+ [self.children[0] setMagnitude:fabsf(MIN(magnitude, 0))];
+ [self.children[1] setMagnitude:fabsf(MAX(magnitude, 0))];
[self.children[0] setActive:magnitude < -DEAD_ZONE];
[self.children[1] setActive:magnitude > DEAD_ZONE];
}
[self.children[0] setActive:magnitude < -DEAD_ZONE];
[self.children[1] setActive:magnitude > DEAD_ZONE];
}