zenilib: zenilib/jni/external/sdl/src/video/uikit/SDL_uikitvideo.m Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_uikitvideo.m
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "SDL_config.h"
22
23 #if SDL_VIDEO_DRIVER_UIKIT
24
25 #import <UIKit/UIKit.h>
26
27 #include "SDL_video.h"
28 #include "SDL_mouse.h"
29 #include "../SDL_sysvideo.h"
30 #include "../SDL_pixels_c.h"
31 #include "../../events/SDL_events_c.h"
32
33 #include "SDL_uikitvideo.h"
34 #include "SDL_uikitevents.h"
35 #include "SDL_uikitmodes.h"
36 #include "SDL_uikitwindow.h"
37 #include "SDL_uikitopengles.h"
38
39 #define UIKITVID_DRIVER_NAME "uikit"
40
41 /* Initialization/Query functions */
42 static int UIKit_VideoInit(_THIS);
43 static void UIKit_VideoQuit(_THIS);
44
45 /* DUMMY driver bootstrap functions */
46
47 static int
48 UIKit_Available(void)
49 {
50 return 1;
51 }
52
53 static void UIKit_DeleteDevice(SDL_VideoDevice * device)
54 {
55 SDL_free(device);
56 }
57
58 static SDL_VideoDevice *
59 UIKit_CreateDevice(int devindex)
60 {
61 SDL_VideoDevice *device;
62
63 /* Initialize all variables that we clean on shutdown */
64 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
65 if (!device) {
66 SDL_free(device);
67 SDL_OutOfMemory();
68 return (0);
69 }
70
71 /* Set the function pointers */
72 device->VideoInit = UIKit_VideoInit;
73 device->VideoQuit = UIKit_VideoQuit;
74 device->GetDisplayModes = UIKit_GetDisplayModes;
75 device->SetDisplayMode = UIKit_SetDisplayMode;
76 device->PumpEvents = UIKit_PumpEvents;
77 device->CreateWindow = UIKit_CreateWindow;
78 device->ShowWindow = UIKit_ShowWindow;
79 device->HideWindow = UIKit_HideWindow;
80 device->RaiseWindow = UIKit_RaiseWindow;
81 device->SetWindowFullscreen = UIKit_SetWindowFullscreen;
82 device->DestroyWindow = UIKit_DestroyWindow;
83 device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
84
85 /* !!! FIXME: implement SetWindowBordered */
86
87 #if SDL_IPHONE_KEYBOARD
88 device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport;
89 device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard;
90 device->HideScreenKeyboard = UIKit_HideScreenKeyboard;
91 device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown;
92 #endif
93
94 /* OpenGL (ES) functions */
95 device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
96 device->GL_SwapWindow = UIKit_GL_SwapWindow;
97 device->GL_CreateContext = UIKit_GL_CreateContext;
98 device->GL_DeleteContext = UIKit_GL_DeleteContext;
99 device->GL_GetProcAddress = UIKit_GL_GetProcAddress;
100 device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
101 device->free = UIKit_DeleteDevice;
102
103 device->gl_config.accelerated = 1;
104
105 return device;
106 }
107
108 VideoBootStrap UIKIT_bootstrap = {
109 UIKITVID_DRIVER_NAME, "SDL UIKit video driver",
110 UIKit_Available, UIKit_CreateDevice
111 };
112
113
114 int
115 UIKit_VideoInit(_THIS)
116 {
117 _this->gl_config.driver_loaded = 1;
118
119 if (UIKit_InitModes(_this) < 0) {
120 return -1;
121 }
122 return 0;
123 }
124
125 void
126 UIKit_VideoQuit(_THIS)
127 {
128 UIKit_QuitModes(_this);
129 }
130
131 /*
132 * iOS log support.
133 *
134 * This doesn't really have aything to do with the interfaces of the SDL video
135 * subsystem, but we need to stuff this into an Objective-C source code file.
136 */
137
138 void SDL_NSLog(const char *text)
139 {
140 NSLog(@"%s", text);
141 }
142
143 #endif /* SDL_VIDEO_DRIVER_UIKIT */
144
145 /* vi: set ts=4 sw=4 expandtab: */
SDL_VideoDevice::GetDisplayModes
void(* GetDisplayModes)(_THIS, SDL_VideoDisplay *display)
Definition: SDL_sysvideo.h:169
UIKit_InitModes
int UIKit_InitModes(_THIS)
UIKit_QuitModes
void UIKit_QuitModes(_THIS)
SDL_VideoDevice::GetWindowWMInfo
SDL_bool(* GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
Definition: SDL_sysvideo.h:215
SDL_VideoDevice::IsScreenKeyboardShown
SDL_bool(* IsScreenKeyboardShown)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:251
SDL_VideoDevice::RaiseWindow
void(* RaiseWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:193
UIKit_PumpEvents
void UIKit_PumpEvents(_THIS)
SDL_uikitopengles.h
UIKit_GetWindowWMInfo
SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
UIKit_CreateWindow
int UIKit_CreateWindow(_THIS, SDL_Window *window)
SDL_calloc
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
UIKit_DestroyWindow
void UIKit_DestroyWindow(_THIS, SDL_Window *window)
SDL_VideoDevice::HideWindow
void(* HideWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:192
SDL_VideoDevice::GL_MakeCurrent
int(* GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context)
Definition: SDL_sysvideo.h:226
UIKit_GL_DeleteContext
void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
SDL_free
DECLSPEC void SDLCALL SDL_free(void *mem)
SDL_uikitwindow.h
UIKit_RaiseWindow
void UIKit_RaiseWindow(_THIS, SDL_Window *window)
SDL_uikitevents.h
SDL_VideoDevice::HasScreenKeyboardSupport
SDL_bool(* HasScreenKeyboardSupport)(_THIS)
Definition: SDL_sysvideo.h:248
UIKit_HideWindow
void UIKit_HideWindow(_THIS, SDL_Window *window)
UIKit_GL_LoadLibrary
int UIKit_GL_LoadLibrary(_THIS, const char *path)
UIKit_GetDisplayModes
void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
SDL_VideoDevice::HideScreenKeyboard
void(* HideScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:250
SDL_config.h
SDL_VideoDevice::free
void(* free)(_THIS)
Definition: SDL_sysvideo.h:327
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:92
SDL_VideoDevice::accelerated
int accelerated
Definition: SDL_sysvideo.h:290
SDL_VideoDevice::CreateWindow
int(* CreateWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:183
SDL_video.h
UIKit_SetWindowFullscreen
void UIKit_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
SDL_VideoDevice::VideoInit
int(* VideoInit)(_THIS)
Definition: SDL_sysvideo.h:148
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
SDL_mouse.h
SDL_VideoDevice::driver_loaded
int driver_loaded
Definition: SDL_sysvideo.h:297
VideoBootStrap
Definition: SDL_sysvideo.h:330
SDL_VideoDevice::PumpEvents
void(* PumpEvents)(_THIS)
Definition: SDL_sysvideo.h:237
UIKit_GL_SwapWindow
void UIKit_GL_SwapWindow(_THIS, SDL_Window *window)
UIKit_GL_CreateContext
SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window)
UIKit_GL_GetProcAddress
void * UIKit_GL_GetProcAddress(_THIS, const char *proc)
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_VideoDevice::GL_DeleteContext
void(* GL_DeleteContext)(_THIS, SDL_GLContext context)
Definition: SDL_sysvideo.h:231
SDL_VideoDevice::DestroyWindow
void(* DestroyWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:202
SDL_VideoDevice::SetDisplayMode
int(* SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
Definition: SDL_sysvideo.h:177
SDL_VideoDevice::GL_CreateContext
SDL_GLContext(* GL_CreateContext)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:225
SDL_VideoDevice::GL_LoadLibrary
int(* GL_LoadLibrary)(_THIS, const char *path)
Definition: SDL_sysvideo.h:222
SDL_VideoDevice::GL_SwapWindow
void(* GL_SwapWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:230
SDL_VideoDevice
Definition: SDL_sysvideo.h:135
SDL_VideoDevice::VideoQuit
void(* VideoQuit)(_THIS)
Definition: SDL_sysvideo.h:154
SDL_VideoDevice::ShowWindow
void(* ShowWindow)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:191
SDL_VideoDevice::SetWindowFullscreen
void(* SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
Definition: SDL_sysvideo.h:198
UIKit_ShowWindow
void UIKit_ShowWindow(_THIS, SDL_Window *window)
SDL_uikitmodes.h
SDL_VideoDevice::gl_config
struct SDL_VideoDevice::@87 gl_config
SDL_VideoDevice::GL_GetProcAddress
void *(* GL_GetProcAddress)(_THIS, const char *proc)
Definition: SDL_sysvideo.h:223
UIKit_GL_MakeCurrent
int UIKit_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
SDL_VideoDevice::ShowScreenKeyboard
void(* ShowScreenKeyboard)(_THIS, SDL_Window *window)
Definition: SDL_sysvideo.h:249
SDL_uikitvideo.h
UIKit_SetDisplayMode
int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)