src/video/uikit/SDL_uikitvideo.m
changeset 6013 b253cc3c4276
parent 6009 fb5fa3561ca9
child 6014 7a8b72b88d86
equal deleted inserted replaced
6012:0291eb4caec4 6013:b253cc3c4276
   197     NSString *reqSysVer = @"3.2";
   197     NSString *reqSysVer = @"3.2";
   198     NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
   198     NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
   199     if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
   199     if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
   200         SDL_UIKit_supports_multiple_displays = YES;
   200         SDL_UIKit_supports_multiple_displays = YES;
   201 
   201 
       
   202     // Add the main screen.
       
   203     UIScreen *uiscreen = [UIScreen mainScreen];
       
   204     UIScreenMode *uiscreenmode = [uiscreen currentMode];
       
   205     const CGSize size = [uiscreen bounds].size;
       
   206     UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
       
   207 
   202     // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
   208     // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
   203     //  The iPad added both a larger main screen and the ability to use
   209     //  The iPad added both a larger main screen and the ability to use
   204     //  external displays.
   210     //  external displays. So, add the other displays (screens in UI speak).
   205     if (!SDL_UIKit_supports_multiple_displays) {
   211     if (SDL_UIKit_supports_multiple_displays) {
   206         // Just give 'em the whole main screen.
       
   207         UIScreen *uiscreen = [UIScreen mainScreen];
       
   208         UIScreenMode *uiscreenmode = [uiscreen currentMode];
       
   209         const CGSize size = [uiscreen bounds].size;
       
   210         UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
       
   211     } else {
       
   212         for (UIScreen *uiscreen in [UIScreen screens]) {
   212         for (UIScreen *uiscreen in [UIScreen screens]) {
   213             // the main screen is the first element in the array.
   213             // Only add the other screens
   214             UIScreenMode *uiscreenmode = [uiscreen currentMode];
   214             if (uiscreen != [UIScreen mainScreen]) {
   215             const CGSize size = [[uiscreen currentMode] size];
   215                 UIScreenMode *uiscreenmode = [uiscreen currentMode];
   216             UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
   216                 const CGSize size = [uiscreen bounds].size;
       
   217                 UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);
       
   218             }
   217         }
   219         }
   218     }
   220     }
   219 
   221 
   220     /* We're done! */
   222     /* We're done! */
   221     return 0;
   223     return 0;