-@implementation JSActionAnalog
-
-- (id) initWithIndex: (int)newIndex {
- if(self = [super init]) {
- subActions = [NSArray arrayWithObjects:
- [[SubAction alloc] initWithIndex: 0 name: @"Low" base: self],
- [[SubAction alloc] initWithIndex: 1 name: @"High" base: self],
- [[SubAction alloc] initWithIndex: 2 name: @"Analog" base: self],
- nil
- ];
- [subActions retain];
- index = newIndex;
- name = [[NSString alloc] initWithFormat: @"Axis %d", (index+1)];
- }
- return self;
+#define DEAD_ZONE 0.3
+
+#import "JSActionAnalog.h"
+
+static float normalize(long p, long min, long max) {
+ return 2 * (p - min) / (float)(max - min) - 1;