| Summary: | SDL_GetDisplayMode() on iPad gives 1024x768 instead of 768x1024 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Kees Bakker <kees> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | iPhone/iPod touch | ||
| OS: | iOS (All) | ||
|
Description
Kees Bakker
2011-02-17 07:43:51 UTC
There is a workaround and that it to leave SDL_UIKit_supports_multiple_displays set to "NO".
In that case the code will pick the [uiscreen bounds] version.
diff -r 48067bfc300c src/video/uikit/SDL_uikitvideo.m
--- a/src/video/uikit/SDL_uikitvideo.m Mon Feb 14 11:50:18 2011 -0600
+++ b/src/video/uikit/SDL_uikitvideo.m Wed Feb 16 23:58:23 2011 +0100
@@ -184,8 +184,10 @@
NSString *reqSysVer = @"3.2";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
+#if 0
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
SDL_UIKit_supports_multiple_displays = YES;
+#endif
// 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
Ryan volunteered to look at this bug. (In reply to comment #0) > The Apple doc says: "All iOS applications launch in portrait mode > initially...". This isn't actually true; I think that's a default, but you can specify the initial orientation in your app's Info.plist. > So, the expectation is that the main screen dimension should be: width 768, > height 1024. I'm patching this to report both heights as available screen sizes, and orienting the screen based on what the user requests (and listening for orientation events and reporting a window resize event, if the app requested the window be "resizable"). > Also notice that the developer doc says that bounds gives numbers in "points", > and "size" gives the numbers in "pixels". Wow Apple, that is helpful. I'm pretty sure they specified that, for the pre-3.2 devices, "points" always equals pixels. For iOS devices updated to 3.2 or later, they use the "size" codepath which reports pixels...so it all works out in this case. > Please also notice that calling SDL_CreateWindow with width 1024 and height 768 > (i.e. landscape mode) will return an SDL_Window object where width and height > are magically reversed to match the portrait mode. This is being fixed; it'll force the orientation to match your window request, so if you want 1024x768, it'll render in landscape. --ryan. I have a better fix for this problem (as mentioned on the SDL mailing list). My fix is available at bitbucket. See https://bitbucket.org/keestux/sdl Both modes are listed, but SDL sorts landscape modes first. If you look at the current mode it will correctly show 768x1024 based on the device orientation. |