X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetController.m;h=074c4876ff8717ffac5ed1f3f8b7966314f7d850;hp=3442a61e3912169d45437683405bcff8e7f9ad24;hb=25dd74a4a34f4ba7ec797360bd8f92cbd7bc758e;hpb=61f8cdec21ab083b29c22aa11fda54d6005666ca diff --git a/TargetController.m b/TargetController.m index 3442a61..074c487 100644 --- a/TargetController.m +++ b/TargetController.m @@ -37,7 +37,7 @@ case 0: // none return NULL; case 1: // key - if([keyInput hasKey]) { + if(keyInput.hasKey) { TargetKeyboard* k = [[TargetKeyboard alloc] init]; [k setVk: [keyInput vk]]; [k setDescr: [keyInput descr]]; @@ -47,7 +47,7 @@ case 2: { TargetConfig* c = [[TargetConfig alloc] init]; - [c setConfig: [[configsController configs] objectAtIndex: [configPopup indexOfSelectedItem]]]; + [c setConfig: [configsController configs][[configPopup indexOfSelectedItem]]]; return c; } case 3: { @@ -93,10 +93,9 @@ } -(void) commit { - id action = [joystickController selectedAction]; - if(action) { - Target* target = [self state]; - [[configsController currentConfig] setTarget: target forAction: action]; + JSAction *action = [joystickController selectedAction]; + if (action) { + configsController.currentConfig[action] = self.state; } } @@ -131,7 +130,7 @@ } else { [self setEnabled: YES]; } - Target* target = [[configsController currentConfig] getTargetForAction: jsaction]; + Target* target = configsController.currentConfig[jsaction]; id act = jsaction; NSString* actFullName = [act name]; @@ -185,7 +184,7 @@ NSArray* configs = [configsController configs]; [configPopup removeAllItems]; for(int i=0; i<[configs count]; i++) { - [configPopup addItemWithTitle: [[configs objectAtIndex:i]name]]; + [configPopup addItemWithTitle: [configs[i]name]]; } if(preserve) [configPopup selectItemAtIndex:initialIndex];