21#include "../../SDL_internal.h"
23#if SDL_VIDEO_DRIVER_UIKIT
28#include "../../events/SDL_events_c.h"
59 mode->driverdata = (
void *) CFBridgingRetain(
data);
68 CFRelease(
mode->driverdata);
74UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen)
77 if ([uiscreen respondsToSelector:
@selector(maximumFramesPerSecond)]) {
78 return uiscreen.maximumFramesPerSecond;
96 mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen);
103 UIKit_FreeDisplayModeData(&
mode);
112 if (UIKit_AddSingleDisplayMode(display,
w,
h, uiscreen,
uiscreenmode) < 0) {
118 if (UIKit_AddSingleDisplayMode(display,
h,
w, uiscreen,
uiscreenmode) < 0) {
127UIKit_AddDisplay(UIScreen *uiscreen)
130 CGSize
size = uiscreen.bounds.size;
143 mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen);
162 data.uiscreen = uiscreen;
174 if (uiscreen == [UIScreen mainScreen]) {
175 return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
179 CGSize
size = uiscreen.bounds.size;
188 for (UIScreen *uiscreen
in [UIScreen screens]) {
189 if (UIKit_AddDisplay(uiscreen) < 0) {
208 SDL_bool addRotation = (
data.uiscreen == [UIScreen mainScreen]);
210 NSArray *availableModes = nil;
214 availableModes = @[data.uiscreen.currentMode];
216 availableModes =
data.uiscreen.availableModes;
219 for (UIScreenMode *uimode
in availableModes) {
231 int w = (int)(uimode.size.width /
scale);
232 int h = (int)(uimode.size.height /
scale);
235 if (isLandscape != (
w >
h)) {
241 UIKit_AddDisplayMode(display,
w,
h,
data.uiscreen, uimode, addRotation);
254 [data.uiscreen setCurrentMode:modedata.uiscreenmode];
257 if (
data.uiscreen == [UIScreen mainScreen]) {
263 return SDL_SetError(
"Screen orientation does not match display mode size");
267 return SDL_SetError(
"Screen orientation does not match display mode size");
290#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
292 frame = [data.uiscreen applicationFrame];
317 UIKit_FreeDisplayModeData(
mode);
331 BOOL isLandscape = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
343 if (isLandscape != (desktopmode->
w > desktopmode->
h)) {
345 desktopmode->
w = desktopmode->
h;
350 if (isLandscape != (currentmode->
w > currentmode->
h)) {
352 currentmode->
w = currentmode->
h;
356 switch ([UIApplication sharedApplication].statusBarOrientation) {
357 case UIInterfaceOrientationPortrait:
360 case UIInterfaceOrientationPortraitUpsideDown:
363 case UIInterfaceOrientationLandscapeLeft:
367 case UIInterfaceOrientationLandscapeRight:
int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1)
#define SDL_GetDisplayBounds
#define SDL_OutOfMemory()
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLint GLint GLint x
GLint GLint GLsizei GLsizei height
GLenum GLenum GLenum GLenum GLenum scale
GLfloat GLfloat GLfloat GLfloat h
GLubyte GLubyte GLubyte GLubyte w
@ SDL_PIXELFORMAT_ABGR8888
SDL_VideoDisplay * SDL_GetDisplay(int displayIndex)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
void UIKit_QuitModes(_THIS)
int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
void SDL_OnApplicationDidChangeStatusBarOrientation(void)
SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen)
int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
int UIKit_InitModes(_THIS)
SDL_bool UIKit_IsSystemVersionAtLeast(double version)
static SDL_VideoDevice * _this
@ SDL_DISPLAYEVENT_ORIENTATION
@ SDL_ORIENTATION_LANDSCAPE
@ SDL_ORIENTATION_PORTRAIT
@ SDL_ORIENTATION_PORTRAIT_FLIPPED
@ SDL_ORIENTATION_LANDSCAPE_FLIPPED
@ SDL_ORIENTATION_UNKNOWN
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
UIScreenMode * uiscreenmode
The structure that defines a display mode.
A rectangle, with the origin at the upper left (integer).
SDL_VideoDisplay * displays
SDL_DisplayMode desktop_mode
SDL_DisplayMode * display_modes
SDL_DisplayMode current_mode