Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not use UIScreenMode to add a iOS display, always use the boundary
This solves the problem that on iPad you would get 1024x768 instead
of 768x1024 when calling SDL_GetDesktopDisplayMode(0, &mode)
See Apple's doc for UIScreenMode where is says:
"Most developers should never need to use the information provided
 by this class and should simply use the bounds provided by the
 UIScreen object for their drawing space."
  • Loading branch information
keestux committed Oct 9, 2011
1 parent 373b3ca commit 54c49f0
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/video/uikit/SDL_uikitvideo.m
Expand Up @@ -199,21 +199,23 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
SDL_UIKit_supports_multiple_displays = YES;

// Add the main screen.
UIScreen *uiscreen = [UIScreen mainScreen];
UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);

// If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
// The iPad added both a larger main screen and the ability to use
// external displays.
if (!SDL_UIKit_supports_multiple_displays) {
// Just give 'em the whole main screen.
UIScreen *uiscreen = [UIScreen mainScreen];
UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
} else {
// external displays. So, add the other displays (screens in UI speak).
if (SDL_UIKit_supports_multiple_displays) {
for (UIScreen *uiscreen in [UIScreen screens]) {
// the main screen is the first element in the array.
UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [[uiscreen currentMode] size];
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
// Only add the other screens
if (uiscreen != [UIScreen mainScreen]) {
UIScreenMode *uiscreenmode = [uiscreen currentMode];
const CGSize size = [uiscreen bounds].size;
UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
}
}
}

Expand Down

0 comments on commit 54c49f0

Please sign in to comment.