src/video/uikit/SDL_uikitappdelegate.m
author Holmes Futrell <hfutrell@umail.ucsb.edu>
Sat, 16 Aug 2008 00:18:40 +0000
branchgsoc2008_iphone
changeset 2453 ac67f7719ba8
parent 2448 e060950cbf30
permissions -rw-r--r--
removed NULL comment ... it's UIKit now, not NULL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 "SDL_events_c.h"
2448
e060950cbf30 updated #include path, added comments.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2410
diff changeset
    26
#import "jumphack.h"
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
    27
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
#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
    29
#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
    30
#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
    31
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
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
    33
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
    34
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
    35
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
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
    37
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
    38
	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
    39
	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
    40
	
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
	/* 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
    42
	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
    43
	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
    44
	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
    45
		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
    46
		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
    47
	}
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
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
    49
	/* 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
    50
	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
    51
	
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
	[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
    53
	
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
@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
    57
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
    58
@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
    59
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
/* 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
    61
+(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
    62
	/* 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
    63
	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
    64
}
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
- (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
    67
	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
    68
	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
    69
	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
    70
}
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
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
    72
- (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
    73
			
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
	/* 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
    75
	[[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
    76
	
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
	/* 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
    78
	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
    79
	
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
	/* 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
    81
	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
    82
	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
    83
		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
    84
	}
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
	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
    86
		
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
	/* 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
    88
	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
    89
		
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
- (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
    93
	
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
	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
    95
	 /* 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
    96
	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
    97
	
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
-(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
   101
	[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
   102
	[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
   103
}
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
@end