Skip to content

Commit

Permalink
OSX current_videomode size is now initialized with correct resolution…
Browse files Browse the repository at this point in the history
… based on backing store. Fixes issue where content does not correctly fit in window on retina displays.
  • Loading branch information
kevinhartman committed Feb 19, 2014
1 parent 2bfbf89 commit 3974a5e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions platform/osx/os_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -845,18 +845,17 @@ - (BOOL)canBecomeKeyWindow
/*** OSX INITIALIZATION ***/
/*** OSX INITIALIZATION ***/
/*** OSX INITIALIZATION ***/

current_videomode=p_desired;

window_delegate = [[GodotWindowDelegate alloc] init];

// Don't use accumulation buffer support; it's not accelerated
// Aux buffers probably aren't accelerated either

unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (current_videomode.resizable?NSResizableWindowMask:0);
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable?NSResizableWindowMask:0);


window_object = [[GodotWindow alloc]
initWithContentRect:NSMakeRect(0, 0, current_videomode.width,current_videomode.height)
initWithContentRect:NSMakeRect(0, 0, p_desired.width, p_desired.height)
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:NO];
Expand All @@ -865,6 +864,13 @@ - (BOOL)canBecomeKeyWindow

window_view = [[GodotContentView alloc] init];

current_videomode = p_desired;

// Adjust for display density
const NSRect fbRect = convertRectToBacking(NSMakeRect(0, 0, p_desired.width, p_desired.height));
current_videomode.width = fbRect.size.width;
current_videomode.height = fbRect.size.height;

#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
Expand Down

0 comments on commit 3974a5e

Please sign in to comment.