21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_UIKIT 47 if (uiscreenmode != nil) {
57 mode->
driverdata = (
void *) CFBridgingRetain(data);
73 UIScreenMode * uiscreenmode)
80 if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
89 UIKit_FreeDisplayModeData(&mode);
96 UIScreenMode * uiscreenmode,
SDL_bool addRotation)
98 if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode) < 0) {
104 if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode) < 0) {
113 UIKit_AddDisplay(UIScreen *uiscreen)
115 CGSize
size = uiscreen.bounds.size;
119 CGFloat
height = size.width;
120 size.width = size.height;
128 mode.
w = (int) size.width;
129 mode.
h = (
int) size.height;
131 UIScreenMode *uiscreenmode = uiscreen.currentMode;
133 if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) {
150 display.
driverdata = (
void *) CFBridgingRetain(data);
159 if (uiscreen == [UIScreen mainScreen]) {
160 return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation);
162 CGSize size = uiscreen.bounds.size;
163 return (size.width > size.height);
171 for (UIScreen *uiscreen
in [UIScreen screens]) {
172 if (UIKit_AddDisplay(uiscreen) < 0) {
194 if ([data.
uiscreen respondsToSelector:
@selector(nativeScale)]) {
199 for (UIScreenMode *uimode
in data.
uiscreen.availableModes) {
202 int w = (int)(uimode.size.width / scale);
203 int h = (int)(uimode.size.height / scale);
206 if (isLandscape != (w > h)) {
212 UIKit_AddDisplayMode(display, w, h, uimode, addRotation);
224 [data.uiscreen setCurrentMode:modedata.uiscreenmode];
226 if (data.
uiscreen == [UIScreen mainScreen]) {
230 if (mode->
w > mode->
h) {
232 return SDL_SetError(
"Screen orientation does not match display mode size");
234 }
else if (mode->
w < mode->
h) {
236 return SDL_SetError(
"Screen orientation does not match display mode size");
257 UIKit_FreeDisplayModeData(mode);
int UIKit_InitModes(_THIS)
GLenum GLenum GLenum GLenum GLenum scale
void UIKit_QuitModes(_THIS)
SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
The structure that defines a display mode.
void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
static SDL_VideoDevice * _this
GLint GLint GLsizei GLsizei height
SDL_DisplayMode * display_modes
SDL_DisplayMode current_mode
SDL_VideoDisplay * displays
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)
#define SDL_OutOfMemory()
SDL_DisplayMode desktop_mode
UIScreenMode * uiscreenmode
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
GLubyte GLubyte GLubyte GLubyte w
GLfloat GLfloat GLfloat GLfloat h
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)
int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)