X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetController.m;h=48119c20e45e28dea3b812590fdeb1b2d37c5bdb;hp=75f58abe48f3d1254126baec71dab0721a09a5f2;hb=f563321aec9e13b8479ab3b890a9179f095a8b17;hpb=f9903acac24bb4be43e370d5f3eb942510f727e1 diff --git a/TargetController.m b/TargetController.m index 75f58ab..48119c2 100644 --- a/TargetController.m +++ b/TargetController.m @@ -11,7 +11,7 @@ #import "Config.h" #import "JSAction.h" #import "JoystickController.h" -#import "KeyInputTextView.h" +#import "NJKeyInputField.h" #import "TargetConfig.h" #import "TargetController.h" #import "TargetKeyboard.h" @@ -26,7 +26,7 @@ NSInteger row = radioButtons.selectedRow; if (row != 1) { - keyInput.vk = -1; + keyInput.keyCode = -1; [keyInput resignIfFirstResponder]; } @@ -62,12 +62,17 @@ [self commit]; } -- (void)keyChanged { +- (void)keyInputField:(NJKeyInputField *)keyInput didChangeKey:(CGKeyCode)keyCode { [radioButtons selectCellAtRow:1 column:0]; [radioButtons.window makeFirstResponder:radioButtons]; [self commit]; } +- (void)keyInputFieldDidClear:(NJKeyInputField *)keyInput { + [radioButtons selectCellAtRow:0 column:0]; + [self commit]; +} + - (void)configChosen:(id)sender { [radioButtons selectCellAtRow:2 column:0]; [configPopup.window makeFirstResponder:configPopup]; @@ -101,9 +106,9 @@ case 0: return nil; case 1: - if (keyInput.hasKey) { + if (keyInput.hasKeyCode) { TargetKeyboard *k = [[TargetKeyboard alloc] init]; - k.vk = keyInput.vk; + k.vk = keyInput.keyCode; return k; } else { return nil; @@ -164,7 +169,7 @@ } else { self.enabled = YES; NSString *actFullName = action.name; - for (JSAction *cur = action.base; cur; cur = cur.base) { + for (id cur = action.base; cur; cur = cur.base) { actFullName = [[NSString alloc] initWithFormat:@"%@ > %@", cur.name, actFullName]; } title.stringValue = [[NSString alloc] initWithFormat:@"%@ > %@", configsController.currentConfig.name, actFullName]; @@ -172,7 +177,7 @@ if ([target isKindOfClass:TargetKeyboard.class]) { [radioButtons selectCellAtRow:1 column:0]; - keyInput.vk = [(TargetKeyboard*)target vk]; + keyInput.keyCode = [(TargetKeyboard*)target vk]; } else if ([target isKindOfClass:TargetConfig.class]) { [radioButtons selectCellAtRow:2 column:0]; NSUInteger idx = [configsController.configs