cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m
changeset 2803 1f446fc5c8ec
parent 2772 1965eba10be6
child 3006 da6023c2745b
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Fri Feb 12 18:40:14 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Sat Feb 13 01:56:35 2010 +0000
@@ -30,11 +30,6 @@
 #import "PascalImports.h"
 #import "MainMenuViewController.h"
 
-//#import "SoundEffect.h"	
-//	SoundEffect *erasingSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Erase" ofType:@"caf"]];
-//	SoundEffect *selectSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Select" ofType:@"caf"]];
-
-
 #ifdef main
 #undef main
 #endif
@@ -50,9 +45,9 @@
 
 @synthesize uiwindow, window, viewController;
 
-/* convenience method */
+// convenience method
 +(SDLUIKitDelegate *)sharedAppDelegate {
-	/* the delegate is set in UIApplicationMain(), which is guaranteed to be called before this method */
+	// the delegate is set in UIApplicationMain(), which is guaranteed to be called before this method
 	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
 }
 
@@ -105,48 +100,12 @@
 	[internal_pool release];
 }
 
--(BOOL) checkFirstRun {
-	//move all this inside the MainMenuViewController
-	BOOL isFirstRun = NO;
-	
-	//use a nssthread a ask the user to wait
-	
-	NSString *filePath = [self dataFilePath:@"settings.plist"];
-	if (!([[NSFileManager defaultManager] fileExistsAtPath:filePath])) {
-		isFirstRun = YES;
-		// file not present, let's create it
-		NSMutableDictionary *saveDict = [[NSMutableDictionary alloc] init];
-	
-		[saveDict setObject:@"" forKey:@"username"];
-		[saveDict setObject:@"" forKey:@"password"];
-		[saveDict setObject:@"1" forKey:@"music"];
-		[saveDict setObject:@"1" forKey:@"sounds"];
-		[saveDict setObject:@"0" forKey:@"alternate"];
-	
-		[saveDict writeToFile:filePath atomically:YES];
-		[saveDict release];
-	}
-	return isFirstRun;
-}
-
 -(NSString *)dataFilePath: (NSString *)fileName {
 	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 	NSString *documentsDirectory = [paths objectAtIndex:0];
 	return [documentsDirectory stringByAppendingPathComponent:fileName];
 }
 
--(void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
-	/* we get too many ones on ipod touch
-	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Running low on memory"
-							message:@"I will try to free some memory but game might slow down a little"
-						       delegate:nil
-					      cancelButtonTitle:@"Ok"
-					      otherButtonTitles:nil ];
-	[alert show];
-	[alert release];
-	*/
-}
-
 #pragma mark -
 #pragma mark SDLUIKitDelegate methods
 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
@@ -159,29 +118,28 @@
 	
 	self.viewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil];
 	
-	/* Set working directory to resource path */
+	// Set working directory to resource path
 	[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
 
 	[uiwindow addSubview:viewController.view];
 	[uiwindow makeKeyAndVisible];
 	[uiwindow layoutSubviews];
-	[self checkFirstRun];
 }
 
 -(void) applicationWillTerminate:(UIApplication *)application {
 	SDL_SendQuit();
-	/* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
+	// hack to prevent automatic termination.  See SDL_uikitevents.m for details
 	// have to remove this otherwise game goes on when pushing the home button
 	//longjmp(*(jump_env()), 1);
 }
 
 -(void) applicationWillResignActive:(UIApplication*)application {
-//	NSLog(@"%@", NSStringFromSelector(_cmd));
+	//NSLog(@"%@", NSStringFromSelector(_cmd));
 	SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
 }
 
 -(void) applicationDidBecomeActive:(UIApplication*)application {
-//	NSLog(@"%@", NSStringFromSelector(_cmd));
+	//NSLog(@"%@", NSStringFromSelector(_cmd));
 	SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_RESTORED, 0, 0);
 }