1 diff -r 9738f2a8eee4 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj |
|
2 --- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Wed Nov 09 02:35:49 2011 -0500 |
|
3 +++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Sat Nov 12 21:55:27 2011 +0100 |
|
4 @@ -1596,9 +1596,12 @@ |
|
5 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
|
6 GCC_C_LANGUAGE_STANDARD = c99; |
|
7 GCC_DEBUGGING_SYMBOLS = full; |
|
8 + GCC_OPTIMIZATION_LEVEL = 0; |
|
9 + GCC_THUMB_SUPPORT = NO; |
|
10 + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; |
|
11 GCC_WARN_ABOUT_RETURN_TYPE = YES; |
|
12 GCC_WARN_UNUSED_VARIABLE = NO; |
|
13 - IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; |
|
14 + IPHONEOS_DEPLOYMENT_TARGET = 3.0; |
|
15 ONLY_ACTIVE_ARCH = NO; |
|
16 PREBINDING = NO; |
|
17 SDKROOT = iphoneos; |
|
18 @@ -1613,9 +1616,12 @@ |
|
19 ARCHS = "$(ARCHS_STANDARD_32_BIT)"; |
|
20 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
|
21 GCC_C_LANGUAGE_STANDARD = c99; |
|
22 + GCC_FAST_MATH = YES; |
|
23 + GCC_THUMB_SUPPORT = NO; |
|
24 + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; |
|
25 GCC_WARN_ABOUT_RETURN_TYPE = YES; |
|
26 GCC_WARN_UNUSED_VARIABLE = NO; |
|
27 - IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; |
|
28 + IPHONEOS_DEPLOYMENT_TARGET = 3.0; |
|
29 PREBINDING = NO; |
|
30 SDKROOT = iphoneos; |
|
31 TARGETED_DEVICE_FAMILY = "1,2"; |
|
32 @@ -1630,6 +1636,7 @@ |
|
33 DEPLOYMENT_LOCATION = NO; |
|
34 GCC_DYNAMIC_NO_PIC = NO; |
|
35 GCC_OPTIMIZATION_LEVEL = 0; |
|
36 + GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT; |
|
37 PREBINDING = NO; |
|
38 PRODUCT_NAME = SDL; |
|
39 SKIP_INSTALL = YES; |
|
40 @@ -1644,6 +1651,7 @@ |
|
41 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
|
42 DEPLOYMENT_LOCATION = NO; |
|
43 GCC_ENABLE_FIX_AND_CONTINUE = NO; |
|
44 + GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT; |
|
45 PREBINDING = NO; |
|
46 PRODUCT_NAME = SDL; |
|
47 SKIP_INSTALL = YES; |
|
48 diff -r 9738f2a8eee4 include/SDL_compat.h |
|
49 --- a/include/SDL_compat.h Wed Nov 09 02:35:49 2011 -0500 |
|
50 +++ b/include/SDL_compat.h Sat Nov 12 21:55:27 2011 +0100 |
|
51 @@ -40,7 +40,7 @@ |
|
52 |
|
53 /*@}*/ |
|
54 |
|
55 -#ifdef SDL_NO_COMPAT |
|
56 +#ifndef SDL_NO_COMPAT |
|
57 #define _SDL_compat_h |
|
58 #endif |
|
59 |
|
60 diff -r 9738f2a8eee4 include/SDL_config_iphoneos.h |
|
61 --- a/include/SDL_config_iphoneos.h Wed Nov 09 02:35:49 2011 -0500 |
|
62 +++ b/include/SDL_config_iphoneos.h Sat Nov 12 21:55:27 2011 +0100 |
|
63 @@ -106,7 +106,7 @@ |
|
64 /* enable iPhone version of Core Audio driver */ |
|
65 #define SDL_AUDIO_DRIVER_COREAUDIO 1 |
|
66 /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ |
|
67 -#define SDL_AUDIO_DRIVER_DUMMY 1 |
|
68 +#define SDL_AUDIO_DRIVER_DUMMY 0 |
|
69 |
|
70 /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ |
|
71 #define SDL_HAPTIC_DISABLED 1 |
|
72 @@ -132,16 +132,16 @@ |
|
73 /* enable OpenGL ES */ |
|
74 #define SDL_VIDEO_OPENGL_ES 1 |
|
75 #define SDL_VIDEO_RENDER_OGL_ES 1 |
|
76 -#define SDL_VIDEO_RENDER_OGL_ES2 1 |
|
77 +#define SDL_VIDEO_RENDER_OGL_ES2 0 |
|
78 |
|
79 /* Enable system power support */ |
|
80 -#define SDL_POWER_UIKIT 1 |
|
81 +#define SDL_POWER_UIKIT 0 |
|
82 |
|
83 /* enable iPhone keyboard support */ |
|
84 #define SDL_IPHONE_KEYBOARD 1 |
|
85 |
|
86 /* enable joystick subsystem */ |
|
87 -#define SDL_JOYSTICK_DISABLED 0 |
|
88 +#define SDL_JOYSTICK_DISABLED 1 |
|
89 |
|
90 /* Set max recognized G-force from accelerometer |
|
91 See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed |
|
92 diff -r 9738f2a8eee4 include/SDL_events.h |
|
93 --- a/include/SDL_events.h Wed Nov 09 02:35:49 2011 -0500 |
|
94 +++ b/include/SDL_events.h Sat Nov 12 21:55:27 2011 +0100 |
|
95 @@ -107,11 +107,12 @@ |
|
96 |
|
97 SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ |
|
98 |
|
99 +#ifndef SDL_NO_COMPAT |
|
100 /* Obsolete events */ |
|
101 SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */ |
|
102 SDL_EVENT_COMPAT2, |
|
103 SDL_EVENT_COMPAT3, |
|
104 - |
|
105 +#endif |
|
106 |
|
107 /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, |
|
108 * and should be allocated with SDL_RegisterEvents() |
|
109 diff -r 9738f2a8eee4 src/SDL_compat.c |
|
110 --- a/src/SDL_compat.c Wed Nov 09 02:35:49 2011 -0500 |
|
111 +++ b/src/SDL_compat.c Sat Nov 12 21:55:27 2011 +0100 |
|
112 @@ -29,6 +29,7 @@ |
|
113 #include "video/SDL_pixels_c.h" |
|
114 #include "render/SDL_yuv_sw_c.h" |
|
115 |
|
116 +#ifndef SDL_NO_COMPAT |
|
117 |
|
118 static SDL_Window *SDL_VideoWindow = NULL; |
|
119 static SDL_Surface *SDL_WindowSurface = NULL; |
|
120 @@ -1813,4 +1814,5 @@ |
|
121 return 0; |
|
122 } |
|
123 |
|
124 +#endif /* SDL_NO_COMPAT */ |
|
125 /* vi: set ts=4 sw=4 expandtab: */ |
|
126 diff -r 9738f2a8eee4 src/video/SDL_surface.c |
|
127 --- a/src/video/SDL_surface.c Wed Nov 09 02:35:49 2011 -0500 |
|
128 +++ b/src/video/SDL_surface.c Sat Nov 12 21:55:27 2011 +0100 |
|
129 @@ -195,12 +195,14 @@ |
|
130 SDL_InvalidateMap(surface->map); |
|
131 } |
|
132 |
|
133 +#ifndef SDL_NO_COMPAT |
|
134 /* Compatibility mode */ |
|
135 if (surface->map->info.flags & SDL_COPY_COLORKEY) { |
|
136 surface->flags |= SDL_SRCCOLORKEY; |
|
137 } else { |
|
138 surface->flags &= ~SDL_SRCCOLORKEY; |
|
139 } |
|
140 +#endif |
|
141 |
|
142 return 0; |
|
143 } |
|
144 @@ -405,12 +407,14 @@ |
|
145 SDL_InvalidateMap(surface->map); |
|
146 } |
|
147 |
|
148 +#ifndef SDL_NO_COMPAT |
|
149 /* Compatibility mode */ |
|
150 if (surface->map->info.flags & SDL_COPY_BLEND) { |
|
151 surface->flags |= SDL_SRCALPHA; |
|
152 } else { |
|
153 surface->flags &= ~SDL_SRCALPHA; |
|
154 } |
|
155 +#endif |
|
156 |
|
157 return status; |
|
158 } |
|
159 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitappdelegate.h |
|
160 --- a/src/video/uikit/SDL_uikitappdelegate.h Wed Nov 09 02:35:49 2011 -0500 |
|
161 +++ b/src/video/uikit/SDL_uikitappdelegate.h Sat Nov 12 21:55:27 2011 +0100 |
|
162 @@ -24,7 +24,7 @@ |
|
163 @interface SDLUIKitDelegate : NSObject<UIApplicationDelegate> { |
|
164 } |
|
165 |
|
166 -+ (SDLUIKitDelegate *)sharedAppDelegate; |
|
167 ++ (id) sharedAppDelegate; |
|
168 + (NSString *)getAppDelegateClassName; |
|
169 |
|
170 @end |
|
171 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitappdelegate.m |
|
172 --- a/src/video/uikit/SDL_uikitappdelegate.m Wed Nov 09 02:35:49 2011 -0500 |
|
173 +++ b/src/video/uikit/SDL_uikitappdelegate.m Sat Nov 12 21:55:27 2011 +0100 |
|
174 @@ -79,10 +79,10 @@ |
|
175 @implementation SDLUIKitDelegate |
|
176 |
|
177 /* convenience method */ |
|
178 -+ (SDLUIKitDelegate *)sharedAppDelegate |
|
179 ++ (id) sharedAppDelegate |
|
180 { |
|
181 /* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */ |
|
182 - return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate]; |
|
183 + return [[UIApplication sharedApplication] delegate]; |
|
184 } |
|
185 |
|
186 + (NSString *)getAppDelegateClassName |
|
187 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitopengles.m |
|
188 --- a/src/video/uikit/SDL_uikitopengles.m Wed Nov 09 02:35:49 2011 -0500 |
|
189 +++ b/src/video/uikit/SDL_uikitopengles.m Sat Nov 12 21:55:27 2011 +0100 |
|
190 @@ -79,7 +79,7 @@ |
|
191 |
|
192 void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) |
|
193 { |
|
194 -#ifdef SDL_POWER_UIKIT |
|
195 +#if SDL_POWER_UIKIT |
|
196 // Check once a frame to see if we should turn off the battery monitor. |
|
197 SDL_UIKit_UpdateBatteryMonitoring(); |
|
198 #endif |
|
199 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitopenglview.m |
|
200 --- a/src/video/uikit/SDL_uikitopenglview.m Wed Nov 09 02:35:49 2011 -0500 |
|
201 +++ b/src/video/uikit/SDL_uikitopenglview.m Sat Nov 12 21:55:27 2011 +0100 |
|
202 @@ -117,8 +117,8 @@ |
|
203 |
|
204 // !!! FIXME: use the screen this is on! |
|
205 /* Use the main screen scale (for retina display support) */ |
|
206 - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) |
|
207 - self.contentScaleFactor = [UIScreen mainScreen].scale; |
|
208 + if ([self respondsToSelector:@selector(contentScaleFactor)]) |
|
209 + self.contentScaleFactor = [[UIScreen mainScreen] scale]; |
|
210 |
|
211 self.autoresizingMask = 0; // don't allow autoresize, since we need to do some magic in -(void)updateFrame. |
|
212 } |
|
213 @@ -147,8 +147,8 @@ |
|
214 |
|
215 // !!! FIXME: use the screen this is on! |
|
216 /* Use the main screen scale (for retina display support) */ |
|
217 - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) |
|
218 - self.contentScaleFactor = [UIScreen mainScreen].scale; |
|
219 + if ([self respondsToSelector:@selector(contentScaleFactor)]) |
|
220 + self.contentScaleFactor = [[UIScreen mainScreen] scale]; |
|
221 } |
|
222 |
|
223 - (void)setCurrentContext |
|
224 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitvideo.m |
|
225 --- a/src/video/uikit/SDL_uikitvideo.m Wed Nov 09 02:35:49 2011 -0500 |
|
226 +++ b/src/video/uikit/SDL_uikitvideo.m Sat Nov 12 21:55:27 2011 +0100 |
|
227 @@ -201,10 +201,8 @@ |
|
228 { |
|
229 _this->gl_config.driver_loaded = 1; |
|
230 |
|
231 - NSString *reqSysVer = @"3.2"; |
|
232 - NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; |
|
233 - if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending) |
|
234 - SDL_UIKit_supports_multiple_displays = YES; |
|
235 + // this tells us whether we are running on ios >= 3.2 |
|
236 + SDL_UIKit_supports_multiple_displays = [UIScreen instancesRespondToSelector:@selector(currentMode)]; |
|
237 |
|
238 // Add the main screen. |
|
239 UIScreen *uiscreen = [UIScreen mainScreen]; |
|
240 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitview.m |
|
241 --- a/src/video/uikit/SDL_uikitview.m Wed Nov 09 02:35:49 2011 -0500 |
|
242 +++ b/src/video/uikit/SDL_uikitview.m Sat Nov 12 21:55:27 2011 +0100 |
|
243 @@ -316,7 +316,7 @@ |
|
244 /* iPhone keyboard addition functions */ |
|
245 #if SDL_IPHONE_KEYBOARD |
|
246 |
|
247 -static SDL_uikitview * getWindowView(SDL_Window * window) |
|
248 +SDL_uikitview *SDL_getUikitView(SDL_Window *window) |
|
249 { |
|
250 if (window == NULL) { |
|
251 SDL_SetError("Window does not exist"); |
|
252 @@ -333,9 +333,9 @@ |
|
253 return view; |
|
254 } |
|
255 |
|
256 -int SDL_iPhoneKeyboardShow(SDL_Window * window) |
|
257 +int SDL_iPhoneKeyboardShow(SDL_Window *window) |
|
258 { |
|
259 - SDL_uikitview *view = getWindowView(window); |
|
260 + SDL_uikitview *view = SDL_getUikitView(window); |
|
261 if (view == nil) { |
|
262 return -1; |
|
263 } |
|
264 @@ -344,9 +344,9 @@ |
|
265 return 0; |
|
266 } |
|
267 |
|
268 -int SDL_iPhoneKeyboardHide(SDL_Window * window) |
|
269 +int SDL_iPhoneKeyboardHide(SDL_Window *window) |
|
270 { |
|
271 - SDL_uikitview *view = getWindowView(window); |
|
272 + SDL_uikitview *view = SDL_getUikitView(window); |
|
273 if (view == nil) { |
|
274 return -1; |
|
275 } |
|
276 @@ -355,9 +355,9 @@ |
|
277 return 0; |
|
278 } |
|
279 |
|
280 -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) |
|
281 +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window *window) |
|
282 { |
|
283 - SDL_uikitview *view = getWindowView(window); |
|
284 + SDL_uikitview *view = SDL_getUikitView(window); |
|
285 if (view == nil) { |
|
286 return 0; |
|
287 } |
|
288 @@ -365,9 +365,9 @@ |
|
289 return view.keyboardVisible; |
|
290 } |
|
291 |
|
292 -int SDL_iPhoneKeyboardToggle(SDL_Window * window) |
|
293 +int SDL_iPhoneKeyboardToggle(SDL_Window *window) |
|
294 { |
|
295 - SDL_uikitview *view = getWindowView(window); |
|
296 + SDL_uikitview *view = SDL_getUikitView(window); |
|
297 if (view == nil) { |
|
298 return -1; |
|
299 } |
|
300 @@ -385,24 +385,24 @@ |
|
301 |
|
302 /* stubs, used if compiled without keyboard support */ |
|
303 |
|
304 -int SDL_iPhoneKeyboardShow(SDL_Window * window) |
|
305 +int SDL_iPhoneKeyboardShow(SDL_Window *window) |
|
306 { |
|
307 SDL_SetError("Not compiled with keyboard support"); |
|
308 return -1; |
|
309 } |
|
310 |
|
311 -int SDL_iPhoneKeyboardHide(SDL_Window * window) |
|
312 +int SDL_iPhoneKeyboardHide(SDL_Window *window) |
|
313 { |
|
314 SDL_SetError("Not compiled with keyboard support"); |
|
315 return -1; |
|
316 } |
|
317 |
|
318 -SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) |
|
319 +SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window *window) |
|
320 { |
|
321 return 0; |
|
322 } |
|
323 |
|
324 -int SDL_iPhoneKeyboardToggle(SDL_Window * window) |
|
325 +int SDL_iPhoneKeyboardToggle(SDL_Window *window) |
|
326 { |
|
327 SDL_SetError("Not compiled with keyboard support"); |
|
328 return -1; |
|
329 diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitviewcontroller.m |
|
330 --- a/src/video/uikit/SDL_uikitviewcontroller.m Wed Nov 09 02:35:49 2011 -0500 |
|
331 +++ b/src/video/uikit/SDL_uikitviewcontroller.m Sat Nov 12 21:55:27 2011 +0100 |
|
332 @@ -30,8 +30,8 @@ |
|
333 |
|
334 #include "SDL_uikitwindow.h" |
|
335 |
|
336 -#import "SDL_uikitviewcontroller.h" |
|
337 - |
|
338 +#include "SDL_uikitviewcontroller.h" |
|
339 +#include "SDL_uikitvideo.h" |
|
340 |
|
341 @implementation SDL_uikitviewcontroller |
|
342 |
|
343 @@ -118,38 +118,17 @@ |
|
344 const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation]; |
|
345 SDL_WindowData *data = self->window->driverdata; |
|
346 UIWindow *uiwindow = data->uiwindow; |
|
347 - UIScreen *uiscreen = [uiwindow screen]; |
|
348 + UIScreen *uiscreen; |
|
349 + if (SDL_UIKit_supports_multiple_displays) |
|
350 + uiscreen = [uiwindow screen]; |
|
351 + else |
|
352 + uiscreen = [UIScreen mainScreen]; |
|
353 const int noborder = self->window->flags & SDL_WINDOW_BORDERLESS; |
|
354 CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame]; |
|
355 - const CGSize size = frame.size; |
|
356 - int w, h; |
|
357 - |
|
358 - switch (toInterfaceOrientation) { |
|
359 - case UIInterfaceOrientationPortrait: |
|
360 - case UIInterfaceOrientationPortraitUpsideDown: |
|
361 - w = (size.width < size.height) ? size.width : size.height; |
|
362 - h = (size.width > size.height) ? size.width : size.height; |
|
363 - break; |
|
364 - |
|
365 - case UIInterfaceOrientationLandscapeLeft: |
|
366 - case UIInterfaceOrientationLandscapeRight: |
|
367 - w = (size.width > size.height) ? size.width : size.height; |
|
368 - h = (size.width < size.height) ? size.width : size.height; |
|
369 - break; |
|
370 - |
|
371 - default: |
|
372 - SDL_assert(0 && "Unexpected interface orientation!"); |
|
373 - return; |
|
374 - } |
|
375 - |
|
376 - frame.size.width = w; |
|
377 - frame.size.height = h; |
|
378 - frame.origin.x = 0; |
|
379 - frame.origin.y = 0; |
|
380 |
|
381 [uiwindow setFrame:frame]; |
|
382 [data->view updateFrame]; |
|
383 - SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); |
|
384 + SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, frame.size.width, frame.size.height); |
|
385 } |
|
386 |
|
387 #endif /* SDL_VIDEO_DRIVER_UIKIT */ |
|