mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
Bug fix: The menu is not activated
This commit is contained in:
parent
cdb511b08b
commit
889e3356a2
@ -5,26 +5,8 @@
|
|||||||
@implementation EbitenController {
|
@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)applicationDidFinishLaunching:(NSNotification*)aNotification {
|
||||||
(void)aNotification;
|
(void)aNotification;
|
||||||
[self initMenu];
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(windowClosing:)
|
selector:@selector(windowClosing:)
|
||||||
name:NSWindowWillCloseNotification
|
name:NSWindowWillCloseNotification
|
||||||
|
@ -6,13 +6,31 @@
|
|||||||
#import "ebiten_controller.h"
|
#import "ebiten_controller.h"
|
||||||
#import "ebiten_window.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];
|
EbitenController* controller = [[EbitenController alloc] init];
|
||||||
NSApplication* app = [NSApplication sharedApplication];
|
NSApplication* app = [NSApplication sharedApplication];
|
||||||
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
|
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
|
||||||
|
initMenu();
|
||||||
|
|
||||||
[app setDelegate:controller];
|
[app setDelegate:controller];
|
||||||
[app finishLaunching];
|
[app finishLaunching];
|
||||||
[app activateIgnoringOtherApps:YES];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* CreateGLContext(void* sharedGLContext) {
|
void* CreateGLContext(void* sharedGLContext) {
|
||||||
|
Loading…
Reference in New Issue
Block a user