X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=ApplicationController.m;h=aa51eeb4f18a0a810a0daaa6c018327e5be24563;hp=2b122b6298755bb11dc87bf90c77ad1452efdbcc;hb=dd1f684886c2809133356bb9b335a35293e8849e;hpb=4ce3f2876a51400f7e3baa213bd23ecd0101398a diff --git a/ApplicationController.m b/ApplicationController.m index 2b122b6..aa51eeb 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -28,7 +28,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification { [drawer open]; self.targetController.enabled = NO; - self.active = NO; [self.jsController setup]; [self.configsController load]; [[NSWorkspace sharedWorkspace].notificationCenter @@ -46,22 +45,12 @@ object:nil]; } -// TODO: Active state should probably be in the ConfigsController or -// JoystickController, not here. - -- (BOOL)active { - return active; -} - -- (void)setActive:(BOOL)newActive { - activeButton.label = newActive ? @"Stop" : @"Start"; - activeButton.image = [NSImage imageNamed:newActive ? @"NSStopProgressFreestandingTemplate" : @"NSGoRightTemplate"]; - activeMenuItem.state = newActive; - active = newActive; -} - - (IBAction)toggleActivity:(id)sender { - self.active = !self.active; + BOOL sendRealEvents = !self.jsController.sendingRealEvents; + self.jsController.sendingRealEvents = sendRealEvents; + activeButton.label = sendRealEvents ? @"Stop" : @"Start"; + activeButton.image = [NSImage imageNamed:sendRealEvents ? @"NSStopProgressFreestandingTemplate" : @"NSGoRightTemplate"]; + activeMenuItem.state = sendRealEvents; } - (NSUInteger)firstConfigMenuIndex {