src/video/uikit/SDL_uikitopengles.m
changeset 6267 ed2cf4669e55
parent 6179 a83eb92704f3
child 6321 71fa3d8976a3
equal deleted inserted replaced
6266:a4be1e781020 6267:ed2cf4669e55
   101 
   101 
   102 SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
   102 SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
   103 {
   103 {
   104     SDL_uikitopenglview *view;
   104     SDL_uikitopenglview *view;
   105     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   105     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
       
   106     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
       
   107     SDL_DisplayData *displaydata = display->driverdata;
       
   108     SDL_DisplayModeData *displaymodedata = display->current_mode.driverdata;
   106     UIWindow *uiwindow = data->uiwindow;
   109     UIWindow *uiwindow = data->uiwindow;
   107 
   110 
   108     /* construct our view, passing in SDL's OpenGL configuration data */
   111     /* construct our view, passing in SDL's OpenGL configuration data */
   109     view = [[SDL_uikitopenglview alloc] initWithFrame: [uiwindow bounds]
   112     view = [[SDL_uikitopenglview alloc] initWithFrame: [uiwindow bounds]
       
   113                                     scale: displaymodedata->scale
   110                                     retainBacking: _this->gl_config.retained_backing
   114                                     retainBacking: _this->gl_config.retained_backing
   111                                     rBits: _this->gl_config.red_size
   115                                     rBits: _this->gl_config.red_size
   112                                     gBits: _this->gl_config.green_size
   116                                     gBits: _this->gl_config.green_size
   113                                     bBits: _this->gl_config.blue_size
   117                                     bBits: _this->gl_config.blue_size
   114                                     aBits: _this->gl_config.alpha_size
   118                                     aBits: _this->gl_config.alpha_size
   133         UIKit_GL_DeleteContext(_this, view);
   137         UIKit_GL_DeleteContext(_this, view);
   134         return NULL;
   138         return NULL;
   135     }
   139     }
   136 
   140 
   137     /* Make this window the current mouse focus for touch input */
   141     /* Make this window the current mouse focus for touch input */
   138     /* !!! FIXME: only do this if this is the primary screen. */
   142     if (displaydata->uiscreen == [UIScreen mainScreen]) {
   139     SDL_SetMouseFocus(window);
   143         SDL_SetMouseFocus(window);
   140     SDL_SetKeyboardFocus(window);
   144         SDL_SetKeyboardFocus(window);
       
   145     }
   141 
   146 
   142     return view;
   147     return view;
   143 }
   148 }
   144 
   149 
   145 void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
   150 void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)