X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetToggleMouseScope.m;h=4f1d157aeac9a9f09afead7536b1f7a7bbb763fd;hp=55357e5f6a38da52068e26ffb61d456f934a4aca;hb=44fe6f649589488b367eee7ffff240cecf8669ad;hpb=61f8cdec21ab083b29c22aa11fda54d6005666ca diff --git a/TargetToggleMouseScope.m b/TargetToggleMouseScope.m index 55357e5..4f1d157 100644 --- a/TargetToggleMouseScope.m +++ b/TargetToggleMouseScope.m @@ -8,19 +8,29 @@ #import "TargetToggleMouseScope.h" +#import "ApplicationController.h" +#import "JoystickController.h" + @implementation TargetToggleMouseScope --(NSString*) stringify { - return [[NSString alloc] initWithFormat: @"mtoggle"]; ++ (NSString *)serializationCode { + return @"mtoggle"; } -+(TargetToggleMouseScope*) unstringifyImpl: (NSArray*) comps { - NSParameterAssert([comps count] == 1); - TargetToggleMouseScope* target = [[TargetToggleMouseScope alloc] init]; - return target; +- (NSDictionary *)serialize { + return @{ @"type": @"mtoggle" }; } --(void) trigger: (JoystickController *)jc { ++ (Target *)targetDeserialize:(NSDictionary *)serialization + withConfigs:(NSArray *)configs { + TargetToggleMouseScope *target = [[TargetToggleMouseScope alloc] init]; + return target; +} +- (void)trigger { + // FIXME: It's hacky to get at the controller this way, but it's + // also hacky to pass it. Shouldn't need to do either. + ApplicationController *ac = [NSApplication sharedApplication].delegate; + JoystickController *jc = ac.jsController; [jc setFrontWindowOnly: ![jc frontWindowOnly]]; printf("Front window only: %d\n", [jc frontWindowOnly]); }