mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Bug fix: The menu is not activated
This commit is contained in:
parent
cdb511b08b
commit
889e3356a2
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user