X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetKeyboard.m;fp=TargetKeyboard.m;h=0000000000000000000000000000000000000000;hp=eaabd070f93ccaf990efdf0dc45459c6fba565c6;hb=dcedf147ddcb6c21768cea94a2f06b93007d2a82;hpb=e2a4d830dd9817f6a515a3b1b6aa152d3bb98c2b diff --git a/TargetKeyboard.m b/TargetKeyboard.m deleted file mode 100644 index eaabd07..0000000 --- a/TargetKeyboard.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// TargetKeyboard.m -// Enjoy -// -// Created by Sam McCall on 5/05/09. -// - -#import "TargetKeyboard.h" - -#import "NJKeyInputField.h" - -@implementation TargetKeyboard - -+ (NSString *)serializationCode { - return @"key"; -} - -- (NSDictionary *)serialize { - return @{ @"type": @"key", @"key": @(_vk) }; -} - -+ (Target *)targetDeserialize:(NSDictionary *)serialization - withMappings:(NSArray *)mappings { - TargetKeyboard *target = [[TargetKeyboard alloc] init]; - target.vk = [serialization[@"key"] intValue]; - return target; -} - -- (void)trigger { - CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, _vk, YES); - CGEventPost(kCGHIDEventTap, keyDown); - CFRelease(keyDown); -} - -- (void)untrigger { - CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, _vk, NO); - CGEventPost(kCGHIDEventTap, keyUp); - CFRelease(keyUp); -} - -@end