diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 278e2e6ed..e99be38b4 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -65,7 +65,9 @@ UIKit_PumpEvents(_THIS) } while(result == kCFRunLoopRunHandledSource); /* See the comment in the function definition. */ +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 UIKit_GL_RestoreCurrentContext(); +#endif } #endif /* SDL_VIDEO_DRIVER_UIKIT */ diff --git a/src/video/uikit/SDL_uikitopengles.h b/src/video/uikit/SDL_uikitopengles.h index d08f4ac3e..d20f4471a 100644 --- a/src/video/uikit/SDL_uikitopengles.h +++ b/src/video/uikit/SDL_uikitopengles.h @@ -21,6 +21,8 @@ #ifndef SDL_uikitopengles_ #define SDL_uikitopengles_ +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + #include "../SDL_sysvideo.h" extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, @@ -35,6 +37,8 @@ extern int UIKit_GL_LoadLibrary(_THIS, const char *path); extern void UIKit_GL_RestoreCurrentContext(void); +#endif // SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + #endif /* SDL_uikitopengles_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index 68d8f1d56..aedc1426f 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2) #include "SDL_uikitopengles.h" #import "SDL_uikitopenglview.h" diff --git a/src/video/uikit/SDL_uikitopenglview.h b/src/video/uikit/SDL_uikitopenglview.h index a2657a3ea..1848a7016 100644 --- a/src/video/uikit/SDL_uikitopenglview.h +++ b/src/video/uikit/SDL_uikitopenglview.h @@ -19,6 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + #import #import #import @@ -57,4 +59,6 @@ @end +#endif // SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m index b3ffbe895..64361b88a 100644 --- a/src/video/uikit/SDL_uikitopenglview.m +++ b/src/video/uikit/SDL_uikitopenglview.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2) #include #include diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 46d6059fe..d7b0caf8e 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -116,6 +116,7 @@ UIKit_CreateDevice(int devindex) device->HasClipboardText = UIKit_HasClipboardText; /* OpenGL (ES) functions */ +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 device->GL_MakeCurrent = UIKit_GL_MakeCurrent; device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; device->GL_SwapWindow = UIKit_GL_SwapWindow; @@ -123,6 +124,7 @@ UIKit_CreateDevice(int devindex) device->GL_DeleteContext = UIKit_GL_DeleteContext; device->GL_GetProcAddress = UIKit_GL_GetProcAddress; device->GL_LoadLibrary = UIKit_GL_LoadLibrary; +#endif device->free = UIKit_DeleteDevice; #if SDL_VIDEO_VULKAN diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index d45ac0641..d568d0414 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -180,7 +180,9 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o /* Don't run the game loop while a messagebox is up */ if (!UIKit_ShowingMessageBox()) { /* See the comment in the function definition. */ +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 UIKit_GL_RestoreCurrentContext(); +#endif animationCallback(animationCallbackParam); } diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 456122383..752430566 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -364,12 +364,16 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) /* These struct members were added in SDL 2.0.4. */ if (versionnum >= SDL_VERSIONNUM(2,0,4)) { +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) { SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view; info->info.uikit.framebuffer = glview.drawableFramebuffer; info->info.uikit.colorbuffer = glview.drawableRenderbuffer; info->info.uikit.resolveFramebuffer = glview.msaaResolveFramebuffer; } else { +#else + { +#endif info->info.uikit.framebuffer = 0; info->info.uikit.colorbuffer = 0; info->info.uikit.resolveFramebuffer = 0;