Mercurial > sdl-ios-xcode
annotate src/video/uikit/SDL_uikitappdelegate.m @ 2403:e9a1eed243c9 gsoc2008_iphone
Added standard SDL header comments
author | Holmes Futrell <hfutrell@umail.ucsb.edu> |
---|---|
date | Tue, 22 Jul 2008 23:05:40 +0000 |
parents | 32602672020e |
children | 3fc556a036d8 |
rev | line source |
---|---|
2401
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
1 /* |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
4 |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
7 License as published by the Free Software Foundation; either |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
9 |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
13 Lesser General Public License for more details. |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
14 |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
18 |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
19 Sam Lantinga |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
20 slouken@libsdl.org |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
21 */ |
2349
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
22 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
23 #import "SDL_uikitappdelegate.h" |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
24 #import "SDL_uikitopenglview.h" |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
25 #import <pthread.h> |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
26 #import "SDL_events_c.h" |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
27 #import "jump.h" |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
28 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
29 #ifdef main |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
30 #undef main |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
31 #endif |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
32 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
33 extern int SDL_main(int argc, char *argv[]); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
34 static int forward_argc; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
35 static char **forward_argv; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
36 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
37 int main(int argc, char **argv) { |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
38 |
2401
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
39 int i; |
2349
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
40 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
41 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
42 /* store arguments */ |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
43 forward_argc = argc; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
44 forward_argv = (char **)malloc(argc * sizeof(char *)); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
45 for (i=0; i<argc; i++) { |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
46 forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char)); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
47 strcpy(forward_argv[i], argv[i]); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
48 } |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
49 |
2401
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
50 /* Give over control to run loop, SDLUIKitDelegate will handle most things from here */ |
2349
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
51 UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate"); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
52 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
53 [pool release]; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
54 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
55 } |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
56 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
57 @implementation SDLUIKitDelegate |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
58 |
2401
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
59 @synthesize window; |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
60 |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
61 /* convenience method */ |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
62 +(SDLUIKitDelegate *)sharedAppDelegate { |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
63 /* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */ |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
64 return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate]; |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
65 } |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
66 |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
67 - (id)init { |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
68 self = [super init]; |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
69 window = nil; |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
70 return self; |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
71 } |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
72 |
2349
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
73 - (void)applicationDidFinishLaunching:(UIApplication *)application { |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
74 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
75 /* Set working directory to resource path */ |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
76 [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]]; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
77 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
78 /* run the user's application, passing argc and argv */ |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
79 int exit_status = SDL_main(forward_argc, forward_argv); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
80 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
81 /* free the memory we used to hold copies of argc and argv */ |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
82 int i; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
83 for (i=0; i<forward_argc; i++) { |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
84 free(forward_argv[i]); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
85 } |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
86 free(forward_argv); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
87 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
88 /* exit, passing the return status from the user's application */ |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
89 exit(exit_status); |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
90 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
91 } |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
92 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
93 - (void)applicationWillTerminate:(UIApplication *)application { |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
94 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
95 SDL_SendQuit(); |
2401
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
96 /* hack to prevent automatic termination. See SDL_uikitevents.m for details */ |
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
97 longjmp(*(jump_env()), 1); |
2349
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
98 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
99 } |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
100 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
101 -(void)dealloc { |
2401
32602672020e
turned singleton window instance into member variable instead. Added convenience method for getting singleton app delegate.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2349
diff
changeset
|
102 [window release]; |
2349
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
103 [super dealloc]; |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
104 } |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
105 |
0381047f2210
The class SDL_uikitappdelegate acts as the UIApplicationDelegate for an iPhone SDL project. This class is reponsible for application control flow, including initial setup of working directory, forwarding command line arguments to the user's main function, and handling application termination.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
106 @end |