X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetMouseBtn.m;h=a19b484475ccf42fcde78a435834279e4247676b;hp=46234ec7c3155c0d99e2ae0e34c5867c524fa486;hb=e2a4d830dd9817f6a515a3b1b6aa152d3bb98c2b;hpb=62aa5b73be6ec1e499e6b155cd0e7687c338cbaa diff --git a/TargetMouseBtn.m b/TargetMouseBtn.m index 46234ec..a19b484 100644 --- a/TargetMouseBtn.m +++ b/TargetMouseBtn.m @@ -3,7 +3,6 @@ // Enjoy // // Created by Yifeng Huang on 7/27/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import "TargetMouseBtn.h" @@ -19,16 +18,15 @@ } + (Target *)targetDeserialize:(NSDictionary *)serialization - withConfigs:(NSArray *)configs { + withMappings:(NSArray *)mappings { TargetMouseBtn *target = [[TargetMouseBtn alloc] init]; target.button = [serialization[@"button"] intValue]; return target; } -(void) trigger { - NSRect screenRect = [[NSScreen mainScreen] frame]; - CGFloat height = screenRect.size.height; - NSPoint mouseLoc = [NSEvent mouseLocation]; + CGFloat height = NSScreen.mainScreen.frame.size.height; + NSPoint mouseLoc = NSEvent.mouseLocation; CGEventType eventType = (_button == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown; CGEventRef click = CGEventCreateMouseEvent(NULL, eventType, @@ -39,9 +37,8 @@ } -(void) untrigger { - NSRect screenRect = [[NSScreen mainScreen] frame]; - CGFloat height = screenRect.size.height; - NSPoint mouseLoc = [NSEvent mouseLocation]; + CGFloat height = NSScreen.mainScreen.frame.size.height; + NSPoint mouseLoc = NSEvent.mouseLocation; CGEventType eventType = (_button == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp; CGEventRef click = CGEventCreateMouseEvent(NULL, eventType,