X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetToggleMouseScope.m;h=499e9c9a3e768d51441deb99fa93d576fe2aadea;hp=d6833fcd1888e08f2733731b171313c22d465417;hb=f864d363128de19fc6591b77ae9226b34166d715;hpb=c6fb77859e508aaef686b7a5a6a12abe29178708 diff --git a/TargetToggleMouseScope.m b/TargetToggleMouseScope.m index d6833fc..499e9c9 100644 --- a/TargetToggleMouseScope.m +++ b/TargetToggleMouseScope.m @@ -3,33 +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" +#import "NJInputController.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]); + ApplicationController *ac = NSApplication.sharedApplication.delegate; + NJInputController *jc = ac.jsController; + jc.frontWindowOnly = !jc.frontWindowOnly; } @end