src/video/uikit/SDL_uikitvideo.m
changeset 4446 8b03a20b320f
parent 4445 06becafcac89
child 5056 8b7988f42fcb
     1.1 --- a/src/video/uikit/SDL_uikitvideo.m	Sat May 01 13:50:56 2010 -0400
     1.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Sun May 02 05:08:12 2010 -0400
     1.3 @@ -49,7 +49,7 @@
     1.4                                  SDL_DisplayMode * mode);
     1.5  static void UIKit_VideoQuit(_THIS);
     1.6  
     1.7 -static BOOL supports_multiple_displays = NO;
     1.8 +BOOL SDL_UIKit_supports_multiple_displays = NO;
     1.9  
    1.10  /* DUMMY driver bootstrap functions */
    1.11  
    1.12 @@ -124,14 +124,14 @@
    1.13  static void
    1.14  UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
    1.15  {
    1.16 -    const UIScreen *screen = (UIScreen *) display->driverdata;
    1.17 +    UIScreen *uiscreen = (UIScreen *) display->driverdata;
    1.18      SDL_DisplayMode mode;
    1.19      SDL_zero(mode);
    1.20  
    1.21      // availableModes showed up in 3.2 (the iPad and later). We should only
    1.22      //  land here for at least that version of the OS.
    1.23 -    if (!supports_multiple_displays) {
    1.24 -        const CGRect rect = [screen bounds];
    1.25 +    if (!SDL_UIKit_supports_multiple_displays) {
    1.26 +        const CGRect rect = [uiscreen bounds];
    1.27          mode.format = SDL_PIXELFORMAT_ABGR8888;
    1.28          mode.w = (int) rect.size.width;
    1.29          mode.h = (int) rect.size.height;
    1.30 @@ -141,7 +141,7 @@
    1.31          return;
    1.32      }
    1.33  
    1.34 -    const NSArray *modes = [screen availableModes];
    1.35 +    const NSArray *modes = [uiscreen availableModes];
    1.36      const NSUInteger mode_count = [modes count];
    1.37      NSUInteger i;
    1.38      for (i = 0; i < mode_count; i++) {
    1.39 @@ -159,11 +159,10 @@
    1.40  
    1.41  
    1.42  static void
    1.43 -UIKit_AddDisplay(UIScreen *screen, int w, int h)
    1.44 +UIKit_AddDisplay(UIScreen *uiscreen, int w, int h)
    1.45  {
    1.46      SDL_VideoDisplay display;
    1.47      SDL_DisplayMode mode;
    1.48 -
    1.49      SDL_zero(mode);
    1.50      mode.format = SDL_PIXELFORMAT_ABGR8888;
    1.51      mode.w = w;
    1.52 @@ -173,8 +172,9 @@
    1.53      SDL_zero(display);
    1.54      display.desktop_mode = mode;
    1.55      display.current_mode = mode;
    1.56 -    display.driverdata = screen;
    1.57 -    [screen retain];
    1.58 +
    1.59 +    [uiscreen retain];
    1.60 +    display.driverdata = uiscreen;
    1.61      SDL_AddVideoDisplay(&display);
    1.62  }
    1.63  
    1.64 @@ -187,25 +187,25 @@
    1.65      NSString *reqSysVer = @"3.2";
    1.66      NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
    1.67      if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
    1.68 -        supports_multiple_displays = YES;
    1.69 +        SDL_UIKit_supports_multiple_displays = YES;
    1.70  
    1.71      // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels.
    1.72      //  The iPad added both a larger main screen and the ability to use
    1.73      //  external displays.
    1.74 -    if (!supports_multiple_displays) {
    1.75 +    if (!SDL_UIKit_supports_multiple_displays) {
    1.76          // Just give 'em the whole main screen.
    1.77 -        UIScreen *screen = [UIScreen mainScreen];
    1.78 -        const CGRect rect = [screen bounds];
    1.79 -        UIKit_AddDisplay(screen, (int)rect.size.width, (int)rect.size.height);
    1.80 +        UIScreen *uiscreen = [UIScreen mainScreen];
    1.81 +        const CGRect rect = [uiscreen bounds];
    1.82 +        UIKit_AddDisplay(uiscreen, (int)rect.size.width, (int)rect.size.height);
    1.83      } else {
    1.84          const NSArray *screens = [UIScreen screens];
    1.85          const NSUInteger screen_count = [screens count];
    1.86          NSUInteger i;
    1.87          for (i = 0; i < screen_count; i++) {
    1.88              // the main screen is the first element in the array.
    1.89 -            UIScreen *screen = (UIScreen *) [screens objectAtIndex:i];
    1.90 -            const CGSize size = [[screen currentMode] size];
    1.91 -            UIKit_AddDisplay(screen, (int) size.width, (int) size.height);
    1.92 +            UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i];
    1.93 +            const CGSize size = [[uiscreen currentMode] size];
    1.94 +            UIKit_AddDisplay(uiscreen, (int) size.width, (int) size.height);
    1.95          }
    1.96      }
    1.97  
    1.98 @@ -216,13 +216,13 @@
    1.99  static int
   1.100  UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
   1.101  {
   1.102 -    UIScreen *screen = (UIScreen *) display->driverdata;
   1.103 -    if (!supports_multiple_displays) {
   1.104 +    UIScreen *uiscreen = (UIScreen *) display->driverdata;
   1.105 +    if (!SDL_UIKit_supports_multiple_displays) {
   1.106          // Not on at least iPhoneOS 3.2 (versions prior to iPad).
   1.107          SDL_assert(mode->driverdata == NULL);
   1.108      } else {
   1.109          UIScreenMode *uimode = (UIScreenMode *) mode->driverdata;
   1.110 -        [screen setCurrentMode:uimode];
   1.111 +        [uiscreen setCurrentMode:uimode];
   1.112      }
   1.113  
   1.114      return 0;
   1.115 @@ -235,8 +235,8 @@
   1.116      int i, j;
   1.117      for (i = 0; i < _this->num_displays; i++) {
   1.118          SDL_VideoDisplay *display = &_this->displays[i];
   1.119 -        UIScreen *screen = (UIScreen *) display->driverdata;
   1.120 -        [((UIScreen *) display->driverdata) release];
   1.121 +        UIScreen *uiscreen = (UIScreen *) display->driverdata;
   1.122 +        [uiscreen release];
   1.123          display->driverdata = NULL;
   1.124          for (j = 0; j < display->num_display_modes; j++) {
   1.125              SDL_DisplayMode *mode = &display->display_modes[j];