Clean-up of Joystick class. Refactor constructor to avoid mandatory 'post-constructor...
[enjoyable.git] / Target.m
index 35ebfc2..052f01a 100644 (file)
--- a/Target.m
+++ b/Target.m
@@ -10,7 +10,7 @@
 +(Target*) unstringify: (NSString*) str withConfigList: (NSArray*) configs {
        NSArray* components = [str componentsSeparatedByString:@"~"];
        NSParameterAssert([components count]);
-       NSString* typeTag = [components objectAtIndex:0];
+       NSString* typeTag = components[0];
        if([typeTag isEqualToString:@"key"])
                return [TargetKeyboard unstringifyImpl:components];
        if([typeTag isEqualToString:@"cfg"])
         return [TargetMouseMove unstringifyImpl:components];
     if([typeTag isEqualToString:@"mbtn"])
         return [TargetMouseBtn unstringifyImpl:components];
+    if([typeTag isEqualToString:@"mscroll"])
+        return [TargetMouseScroll unstringifyImpl:components];
+    if([typeTag isEqualToString:@"mtoggle"])
+        return [TargetToggleMouseScope unstringifyImpl:components];
                
        NSParameterAssert(NO);
        return NULL;
        return NULL;
 }
 
--(void) trigger {
+-(void) trigger: (JoystickController *)jc {
        [self doesNotRecognizeSelector:_cmd];
 }
 
--(void) untrigger {
+-(void) untrigger: (JoystickController *)jc {
        // no-op by default
 }
 
--(BOOL) running {
-       return running;
+-(void) update: (JoystickController *) jc {
+    [self doesNotRecognizeSelector:_cmd];
 }
--(void) setRunning: (BOOL) newRunning {
-       if(newRunning == running)
-               return;
-       if(newRunning)
-               [self trigger];
-       else
-               [self untrigger];
-       running = newRunning;           
+
+-(BOOL) isContinuous {
+    return false;
 }
 
-@synthesize inputValue;
+@synthesize inputValue, running;
 
 @end