Indices are for display niceness only, so index them from 1 rather than keep offsetti...
[enjoyable.git] / JSAction.m
index a0fab80..f96c10d 100644 (file)
@@ -5,23 +5,42 @@
 //  Created by Sam McCall on 4/05/09.
 //
 
+#import "JSAction.h"
+
 @implementation JSAction
 
-@synthesize usage, cookie, index, subActions, base, name;
+@synthesize cookie;
+@synthesize index;
+@synthesize children;
+@synthesize base;
+@synthesize name;
+@synthesize active;
 
--(id) findSubActionForValue: (IOHIDValueRef) value {
-       return NULL;
+- (id)initWithName:(NSString *)newName base:(JSAction *)newBase {
+    if ((self = [super init])) {
+        self.name = newName;
+        self.base = newBase;
+    }
+    return self;
 }
 
--(NSString*) stringify {
-       return [[NSString alloc] initWithFormat: @"%@~%d",[base stringify],(int)cookie];
+- (id)findSubActionForValue:(IOHIDValueRef)value {
+    return NULL;
 }
--(void) notifyEvent: (IOHIDValueRef) value {
-       [self doesNotRecognizeSelector:_cmd];
+
+- (NSString *)stringify {
+    if (cookie)
+        return [NSString stringWithFormat: @"%@~%p", [base stringify], cookie];
+    else
+        return [NSString stringWithFormat: @"%@~%@", [base stringify], name];
 }
--(BOOL) active {
-       [self doesNotRecognizeSelector:_cmd];
-       return NO;
+
+- (void)notifyEvent:(IOHIDValueRef)value {
+    [self doesNotRecognizeSelector:_cmd];
+}
+
+- (float)magnitude {
+    return 0.f;
 }
 
 @end