src/video/uikit/SDL_uikitopengles.m
branchiOS-improvements
changeset 9513 34d9391e7d3e
parent 9512 c9f61d1dac7b
child 9514 5b56ab9ff5fe
equal deleted inserted replaced
9512:c9f61d1dac7b 9513:34d9391e7d3e
   127              */
   127              */
   128             scale = uiwindow.screen.scale;
   128             scale = uiwindow.screen.scale;
   129         }
   129         }
   130 
   130 
   131         if (_this->gl_config.share_with_current_context) {
   131         if (_this->gl_config.share_with_current_context) {
   132             SDL_uikitopenglview *view = (__bridge SDL_uikitopenglview *) SDL_GL_GetCurrentContext();
   132             EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext();
   133             share_group = [view.context sharegroup];
   133             share_group = context.sharegroup;
   134         }
   134         }
   135 
   135 
   136         /* construct our view, passing in SDL's OpenGL configuration data */
   136         /* construct our view, passing in SDL's OpenGL configuration data */
   137         view = [[SDL_uikitopenglview alloc] initWithFrame: frame
   137         view = [[SDL_uikitopenglview alloc] initWithFrame: frame
   138                                                     scale: scale
   138                                                     scale: scale
   172         if (uiwindow.screen == [UIScreen mainScreen]) {
   172         if (uiwindow.screen == [UIScreen mainScreen]) {
   173             SDL_SetMouseFocus(window);
   173             SDL_SetMouseFocus(window);
   174             SDL_SetKeyboardFocus(window);
   174             SDL_SetKeyboardFocus(window);
   175         }
   175         }
   176 
   176 
       
   177         /* We return a +1'd context. The window's driverdata owns the view. */
   177         return (SDL_GLContext) CFBridgingRetain(context);
   178         return (SDL_GLContext) CFBridgingRetain(context);
   178     }
   179     }
   179 }
   180 }
   180 
   181 
   181 void
   182 void
   182 UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
   183 UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
   183 {
   184 {
   184     @autoreleasepool {
   185     @autoreleasepool {
       
   186         /* Transfer ownership the +1'd context to ARC. */
       
   187         EAGLContext *eaglcontext = (EAGLContext *) CFBridgingRelease(context);
   185         SDL_Window *window;
   188         SDL_Window *window;
   186         EAGLContext *eaglcontext = (EAGLContext *) CFBridgingRelease(context);
       
   187 
   189 
   188         /* Find the view associated with this context */
   190         /* Find the view associated with this context */
   189         for (window = _this->windows; window; window = window->next) {
   191         for (window = _this->windows; window; window = window->next) {
   190             SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
   192             SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
   191             SDL_uikitopenglview *view = data.view;
   193             SDL_uikitopenglview *view = data.view;