Bug fix: The menu is not activated

This commit is contained in:
Hajime Hoshi 2013-12-08 20:45:14 +09:00
parent cdb511b08b
commit 889e3356a2
2 changed files with 20 additions and 20 deletions

View File

@ -5,26 +5,8 @@
@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

View File

@ -6,13 +6,31 @@
#import "ebiten_controller.h"
#import "ebiten_window.h"
void StartApplication() {
void initMenu(void) {
NSString* processName = [[NSProcessInfo processInfo] processName];
NSMenu* menuBar = [NSMenu new];
[NSApp setMainMenu: menuBar];
NSMenuItem* rootMenuItem = [NSMenuItem new];
[menuBar addItem:rootMenuItem];
NSMenu* appMenu = [NSMenu new];
[rootMenuItem setSubmenu:appMenu];
[appMenu addItemWithTitle:[@"Quit " stringByAppendingString:processName]
action:@selector(performClose:)
keyEquivalent:@"q"];
}
void StartApplication(void) {
EbitenController* controller = [[EbitenController alloc] init];
NSApplication* app = [NSApplication sharedApplication];
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
initMenu();
[app setDelegate:controller];
[app finishLaunching];
[app activateIgnoringOtherApps:YES];
}
void* CreateGLContext(void* sharedGLContext) {