mirror of
https://github.com/yawut/SDL.git
synced 2026-08-20 15:54:10 -05:00
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."
This commit is contained in:
@@ -199,21 +199,23 @@ UIKit_VideoInit(_THIS)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user