Go to the documentation of this file.
21 #include "../../SDL_internal.h"
23 #if SDL_VIDEO_DRIVER_UIKIT
25 #import <UIKit/UIKit.h>
30 #include "../SDL_sysvideo.h"
31 #include "../SDL_pixels_c.h"
32 #include "../../events/SDL_events_c.h"
43 #define UIKITVID_DRIVER_NAME "uikit"
50 static int UIKit_VideoInit(
_THIS);
51 static void UIKit_VideoQuit(
_THIS);
64 CFRelease(
device->driverdata);
86 device->driverdata = (
void *) CFBridgingRetain(
data);
89 device->VideoInit = UIKit_VideoInit;
90 device->VideoQuit = UIKit_VideoQuit;
106 #if SDL_IPHONE_KEYBOARD
107 device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport;
108 device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard;
109 device->HideScreenKeyboard = UIKit_HideScreenKeyboard;
110 device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown;
111 device->SetTextInputRect = UIKit_SetTextInputRect;
119 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
120 device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
121 device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize;
122 device->GL_SwapWindow = UIKit_GL_SwapWindow;
123 device->GL_CreateContext = UIKit_GL_CreateContext;
124 device->GL_DeleteContext = UIKit_GL_DeleteContext;
125 device->GL_GetProcAddress = UIKit_GL_GetProcAddress;
126 device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
128 device->free = UIKit_DeleteDevice;
131 device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary;
132 device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary;
133 device->Vulkan_GetInstanceExtensions
134 = UIKit_Vulkan_GetInstanceExtensions;
135 device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface;
136 device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize;
140 device->Metal_CreateView = UIKit_Metal_CreateView;
141 device->Metal_DestroyView = UIKit_Metal_DestroyView;
144 device->gl_config.accelerated = 1;
151 UIKITVID_DRIVER_NAME,
"SDL UIKit video driver",
152 UIKit_Available, UIKit_CreateDevice
157 UIKit_VideoInit(
_THIS)
168 UIKit_VideoQuit(
_THIS)
180 UIApplication *app = [UIApplication sharedApplication];
191 return [[UIDevice currentDevice].systemVersion doubleValue] >= version;
207 #if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)
226 UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;
227 BOOL landscape = UIInterfaceOrientationIsLandscape(orient);
232 if (fullscreen && (landscape != (
frame.size.width >
frame.size.height))) {
252 #pragma clang diagnostic push
253 #pragma clang diagnostic ignored "-Wunguarded-availability-new"
254 if ([
data.viewcontroller respondsToSelector:
@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) {
255 [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO];
256 [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO];
258 #pragma clang diagnostic pop
275 #if !defined(SDL_VIDEO_DRIVER_COCOA)
276 void SDL_NSLog(
const char *
text)
290 return ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad);
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
void UIKit_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
int UIKit_InitModes(_THIS)
SDL_bool UIKit_HasClipboardText(_THIS)
BOOL(WINAPI *CloseTouchInputHandle)(HTOUCHINPUT)
void UIKit_ForceUpdateHomeIndicator(void)
void UIKit_SetWindowTitle(_THIS, SDL_Window *window)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
The type used to identify a window.
SDL_Window * SDL_GetFocusWindow(void)
void UIKit_DestroyWindow(_THIS, SDL_Window *window)
struct SDL_VideoDevice::@255 gl_config
#define SDL_GetHintBoolean
char * UIKit_GetClipboardText(_THIS)
static SDL_VideoDevice * _this
void UIKit_PumpEvents(_THIS)
EGLSurface EGLNativeWindowType * window
void UIKit_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
int UIKit_CreateWindow(_THIS, SDL_Window *window)
void UIKit_RaiseWindow(_THIS, SDL_Window *window)
GLint GLint GLsizei GLsizei height
void UIKit_SuspendScreenSaver(_THIS)
void UIKit_HideWindow(_THIS, SDL_Window *window)
static char text[MAX_TEXT_LENGTH]
#define SDL_OutOfMemory()
#define SDL_HINT_IDLE_TIMER_DISABLED
A variable controlling whether the idle timer is disabled on iOS.
int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
SDL_bool UIKit_IsSystemVersionAtLeast(double version)
void UIKit_ShowWindow(_THIS, SDL_Window *window)
void UIKit_QuitModes(_THIS)
VideoBootStrap UIKIT_bootstrap
static SDL_AudioDeviceID device
int UIKit_SetClipboardText(_THIS, const char *text)
SDL_bool suspend_screensaver
void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)