X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetToggleMouseScope.m;h=2f03c2fb74cfda407c851f7e7166173817e73e18;hp=9e986df79d8af98dffc1682a1374b811659869fe;hb=e24d2ce8323c713180d44933ca72cdb96ac356cd;hpb=51d43664909060e85c943c4d63cc3cff307ceb1d diff --git a/TargetToggleMouseScope.m b/TargetToggleMouseScope.m index 9e986df..2f03c2f 100644 --- a/TargetToggleMouseScope.m +++ b/TargetToggleMouseScope.m @@ -3,30 +3,34 @@ // Enjoy // // Created by Yifeng Huang on 7/28/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #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" }; } ++ (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]); } @end