diff --git a/ui/cocoa/ebiten_window.c b/ui/cocoa/ebiten_window.c index 460708522..01bbf2803 100644 --- a/ui/cocoa/ebiten_window.c +++ b/ui/cocoa/ebiten_window.c @@ -25,18 +25,13 @@ void ebiten_WindowClosed(void* nativeWindow); styleMask:style]; NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; NSSize screenSize = [screen visibleFrame].size; - // Reference: Mac OS X Human Interface Guidelines: UI Element Guidelines: - // Windows - // http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html - NSRect contentRect = - NSMakeRect((screenSize.width - windowRect.size.width) / 2, - (screenSize.height - windowRect.size.height) * 2 / 3, - size.width, size.height); + NSRect contentRect = NSMakeRect(0, 0, size.width, size.height); self = [super initWithContentRect:contentRect styleMask:style backing:NSBackingStoreBuffered defer:YES]; if (self != nil) { + [self center]; [self setReleasedWhenClosed:YES]; [self setDelegate:self]; [self setDocumentEdited:YES]; diff --git a/ui/cocoa/mainloop.c b/ui/cocoa/mainloop.c index 8f54a39de..6be352a72 100644 --- a/ui/cocoa/mainloop.c +++ b/ui/cocoa/mainloop.c @@ -10,12 +10,16 @@ void initMenu(void) { NSMenu* menuBar = [NSMenu new]; [NSApp setMainMenu: menuBar]; + [menuBar release]; NSMenuItem* rootMenuItem = [NSMenuItem new]; [menuBar addItem:rootMenuItem]; + [rootMenuItem release]; NSMenu* appMenu = [NSMenu new]; [rootMenuItem setSubmenu:appMenu]; + [appMenu release]; + [appMenu addItemWithTitle:[@"Quit " stringByAppendingString:processName] action:@selector(performClose:) keyEquivalent:@"q"]; @@ -49,21 +53,19 @@ void* CreateGLContext(void* sharedGLContext) { void* CreateWindow(size_t width, size_t height, const char* title, void* glContext_) { NSOpenGLContext* glContext = (NSOpenGLContext*)glContext_; - NSSize size = NSMakeSize(width, height); EbitenWindow* window = [[EbitenWindow alloc] initWithSize:size glContext:glContext]; + [glContext release]; + NSString* nsTitle = [[NSString alloc] initWithUTF8String:title]; [window setTitle: nsTitle]; [nsTitle release]; [window makeKeyAndOrderFront:nil]; - [glContext setView:[window contentView]]; - [glContext release]; - return window; }