mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Init window in the center of the screen.
This commit is contained in:
parent
2443718b9f
commit
b46aadcaf7
1 changed files with 5 additions and 2 deletions
|
@ -413,8 +413,12 @@ namespace entry
|
||||||
| NSResizableWindowMask
|
| NSResizableWindowMask
|
||||||
;
|
;
|
||||||
|
|
||||||
|
NSRect screenRect = [[NSScreen mainScreen] frame];
|
||||||
|
const float centerX = (screenRect.size.width - (float)ENTRY_DEFAULT_WIDTH )*0.5f;
|
||||||
|
const float centerY = (screenRect.size.height - (float)ENTRY_DEFAULT_HEIGHT)*0.5f;
|
||||||
|
|
||||||
m_windowAlloc.alloc();
|
m_windowAlloc.alloc();
|
||||||
NSRect rect = NSMakeRect(0, 0, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
|
NSRect rect = NSMakeRect(centerX, centerY, (float)ENTRY_DEFAULT_WIDTH, (float)ENTRY_DEFAULT_HEIGHT);
|
||||||
NSWindow* window = [[NSWindow alloc]
|
NSWindow* window = [[NSWindow alloc]
|
||||||
initWithContentRect:rect
|
initWithContentRect:rect
|
||||||
styleMask:m_style
|
styleMask:m_style
|
||||||
|
@ -422,7 +426,6 @@ namespace entry
|
||||||
];
|
];
|
||||||
NSString* appName = [[NSProcessInfo processInfo] processName];
|
NSString* appName = [[NSProcessInfo processInfo] processName];
|
||||||
[window setTitle:appName];
|
[window setTitle:appName];
|
||||||
[window cascadeTopLeftFromPoint:NSMakePoint(20,20)];
|
|
||||||
[window makeKeyAndOrderFront:window];
|
[window makeKeyAndOrderFront:window];
|
||||||
[window setAcceptsMouseMovedEvents:YES];
|
[window setAcceptsMouseMovedEvents:YES];
|
||||||
[window setBackgroundColor:[NSColor blackColor]];
|
[window setBackgroundColor:[NSColor blackColor]];
|
||||||
|
|
Loading…
Reference in a new issue