mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
// -*- objc -*-
|
|
|
|
#import "ebiten_controller.h"
|
|
|
|
@implementation EbitenController {
|
|
}
|
|
|
|
- (void)initMenu {
|
|
NSString* processName = [[NSProcessInfo processInfo] processName];
|
|
|
|
NSMenu* menuBar = [NSMenu new];
|
|
NSMenuItem* rootMenu = [NSMenuItem new];
|
|
[menuBar addItem:rootMenu];
|
|
|
|
NSMenu* appMenu = [NSMenu new];
|
|
[appMenu addItemWithTitle:[@"Quit " stringByAppendingString:processName]
|
|
action:@selector(performClose:)
|
|
keyEquivalent:@"q"];
|
|
|
|
[rootMenu setSubmenu:appMenu];
|
|
[NSApp setMainMenu: menuBar];
|
|
}
|
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
|
|
(void)aNotification;
|
|
[self initMenu];
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
selector:@selector(windowClosing:)
|
|
name:NSWindowWillCloseNotification
|
|
object:nil];
|
|
}
|
|
|
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:
|
|
(NSApplication*)theApplication {
|
|
(void)theApplication;
|
|
return YES;
|
|
}
|
|
|
|
- (void)windowClosing:(NSNotification*)aNotification {
|
|
(void)aNotification;
|
|
[NSApp terminate:nil];
|
|
}
|
|
|
|
@end
|