mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-27 20:28:54 +01:00
48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
// -*- objc -*-
|
|
|
|
#import "ebiten_controller.h"
|
|
|
|
@implementation EbitenController {
|
|
@private
|
|
NSWindow* window_;
|
|
}
|
|
|
|
- (id)initWithWindow:(NSWindow*)window {
|
|
if (self = [super init]) {
|
|
self->window_ = window;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (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;
|
|
NSWindow* window = self->window_;
|
|
assert(window);
|
|
[window makeKeyAndOrderFront:nil];
|
|
[self initMenu];
|
|
}
|
|
|
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:
|
|
(NSApplication*)theApplication {
|
|
(void)theApplication;
|
|
return YES;
|
|
}
|
|
|
|
@end
|