Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
150 lines (119 loc) · 4.16 KB

SDL_uikitvideo.m

File metadata and controls

150 lines (119 loc) · 4.16 KB
 
Jun 22, 2011
Jun 22, 2011
1
2
/*
Simple DirectMedia Layer
Dec 31, 2011
Dec 31, 2011
3
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
Jun 22, 2011
Jun 22, 2011
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
Oct 31, 2011
Oct 31, 2011
21
#include "SDL_config.h"
Jun 22, 2011
Jun 22, 2011
22
Oct 31, 2011
Oct 31, 2011
23
#if SDL_VIDEO_DRIVER_UIKIT
Jun 22, 2011
Jun 22, 2011
24
Oct 31, 2011
Oct 31, 2011
25
#import <UIKit/UIKit.h>
Jun 22, 2011
Jun 22, 2011
26
27
28
29
30
31
32
33
34
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"
#include "SDL_uikitvideo.h"
#include "SDL_uikitevents.h"
Sep 30, 2012
Sep 30, 2012
35
#include "SDL_uikitmodes.h"
Jun 22, 2011
Jun 22, 2011
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "SDL_uikitwindow.h"
#include "SDL_uikitopengles.h"
#define UIKITVID_DRIVER_NAME "uikit"
/* Initialization/Query functions */
static int UIKit_VideoInit(_THIS);
static void UIKit_VideoQuit(_THIS);
/* DUMMY driver bootstrap functions */
static int
UIKit_Available(void)
{
Sep 27, 2011
Sep 27, 2011
50
return 1;
Jun 22, 2011
Jun 22, 2011
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
}
static void UIKit_DeleteDevice(SDL_VideoDevice * device)
{
SDL_free(device);
}
static SDL_VideoDevice *
UIKit_CreateDevice(int devindex)
{
SDL_VideoDevice *device;
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
if (!device) {
SDL_OutOfMemory();
if (device) {
SDL_free(device);
}
return (0);
}
/* Set the function pointers */
device->VideoInit = UIKit_VideoInit;
device->VideoQuit = UIKit_VideoQuit;
device->GetDisplayModes = UIKit_GetDisplayModes;
device->SetDisplayMode = UIKit_SetDisplayMode;
device->PumpEvents = UIKit_PumpEvents;
device->CreateWindow = UIKit_CreateWindow;
Jul 22, 2012
Jul 22, 2012
80
81
device->ShowWindow = UIKit_ShowWindow;
device->HideWindow = UIKit_HideWindow;
Sep 12, 2012
Sep 12, 2012
82
device->RaiseWindow = UIKit_RaiseWindow;
Nov 9, 2011
Nov 9, 2011
83
device->SetWindowFullscreen = UIKit_SetWindowFullscreen;
Jun 22, 2011
Jun 22, 2011
84
85
device->DestroyWindow = UIKit_DestroyWindow;
device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
Sep 27, 2011
Sep 27, 2011
86
Sep 13, 2012
Sep 13, 2012
87
88
/* !!! FIXME: implement SetWindowBordered */
Aug 11, 2012
Aug 11, 2012
89
90
91
92
93
device->SDL_HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport;
device->SDL_ShowScreenKeyboard = UIKit_ShowScreenKeyboard;
device->SDL_HideScreenKeyboard = UIKit_HideScreenKeyboard;
device->SDL_ToggleScreenKeyboard = UIKit_ToggleScreenKeyboard;
device->SDL_IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown;
Sep 27, 2011
Sep 27, 2011
94
Jun 22, 2011
Jun 22, 2011
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* OpenGL (ES) functions */
device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
device->GL_SwapWindow = UIKit_GL_SwapWindow;
device->GL_CreateContext = UIKit_GL_CreateContext;
device->GL_DeleteContext = UIKit_GL_DeleteContext;
device->GL_GetProcAddress = UIKit_GL_GetProcAddress;
device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
device->free = UIKit_DeleteDevice;
device->gl_config.accelerated = 1;
return device;
}
VideoBootStrap UIKIT_bootstrap = {
UIKITVID_DRIVER_NAME, "SDL UIKit video driver",
UIKit_Available, UIKit_CreateDevice
};
int
UIKit_VideoInit(_THIS)
{
_this->gl_config.driver_loaded = 1;
Sep 30, 2012
Sep 30, 2012
120
if (UIKit_InitModes(_this) < 0) {
Jan 25, 2012
Jan 25, 2012
121
122
return -1;
}
Jun 22, 2011
Jun 22, 2011
123
124
125
126
127
128
return 0;
}
void
UIKit_VideoQuit(_THIS)
{
Sep 30, 2012
Sep 30, 2012
129
UIKit_QuitModes(_this);
Jun 22, 2011
Jun 22, 2011
130
131
}
Oct 30, 2012
Oct 30, 2012
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
* iOS log support.
*
* This doesn't really have aything to do with the interfaces of the SDL video
* subsystem, but we need to stuff this into an Objective-C source code file.
*/
void SDL_NSLog(const char *text)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"%@", [[NSString alloc] initWithUTF8String:text]);
[pool release];
}
Oct 31, 2011
Oct 31, 2011
148
149
#endif /* SDL_VIDEO_DRIVER_UIKIT */
Jun 22, 2011
Jun 22, 2011
150
/* vi: set ts=4 sw=4 expandtab: */