Mercurial > sdl-ios-xcode
comparison src/video/uikit/SDL_uikitevents.m @ 2355:eec14ed2bb18 gsoc2008_iphone
These files contain the events related functions for the UIKit video driver. Right now this is just UIKit_PumpEvents.
author | Holmes Futrell <hfutrell@umail.ucsb.edu> |
---|---|
date | Thu, 17 Jul 2008 22:48:23 +0000 |
parents | |
children | 491958a6c881 |
comparison
equal
deleted
inserted
replaced
2354:2e4fea4a4416 | 2355:eec14ed2bb18 |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2006 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Lesser General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2.1 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Lesser General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Lesser General Public | |
16 License along with this library; if not, write to the Free Software | |
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 #include "SDL_config.h" | |
23 | |
24 /* Being a null driver, there's no event stream. We just define stubs for | |
25 most of the API. */ | |
26 | |
27 #include "SDL.h" | |
28 #include "../../events/SDL_sysevents.h" | |
29 #include "../../events/SDL_events_c.h" | |
30 | |
31 #include "SDL_uikitvideo.h" | |
32 #include "SDL_uikitevents.h" | |
33 | |
34 #import <Foundation/Foundation.h> | |
35 #include "jump.h" | |
36 | |
37 void | |
38 UIKit_PumpEvents(_THIS) | |
39 { | |
40 /* | |
41 When the user presses the 'home' button on the iPod | |
42 the application exits -- immediatly. | |
43 | |
44 Unlike in Mac OS X, it appears there is no way to cancel the termination. | |
45 | |
46 This doesn't give the SDL user's application time to respond to an SDL_Quit event. | |
47 So what we do is that in the UIApplicationDelegate class (SDLUIApplicationDelegate), | |
48 when the delegate receives the ApplicationWillTerminate message, we execute | |
49 a longjmp statement to get back here, preventing an immediate exit. | |
50 | |
51 */ | |
52 if (setjmp(*jump_env()) != 0) { | |
53 NSLog(@"Bam! We're back"); | |
54 } | |
55 else { | |
56 SInt32 result; | |
57 do { | |
58 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE); | |
59 } while(result == kCFRunLoopRunHandledSource); | |
60 | |
61 } | |
62 | |
63 } | |
64 | |
65 /* vi: set ts=4 sw=4 expandtab: */ |