cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m
changeset 2740 03df0573a9fd
parent 2738 bfccb2ec4334
child 2743 39d097ac2276
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Mon Feb 01 22:01:35 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Wed Feb 03 03:01:44 2010 +0000
@@ -80,9 +80,8 @@
 	// remove the current view to free resources
 	[UIView beginAnimations:@"removing main controller" context:NULL];
 	[UIView setAnimationDuration:1];
-	viewController.view.alpha = 0;
+	self.viewController.view.alpha = 0;
 	[UIView commitAnimations];
-	[viewController.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
 
 	NSLog(@"Game is launching...");
 	const char **gameArgs = [setup getSettings];
@@ -96,14 +95,14 @@
 	
 	[setup release];
 
+	[uiwindow addSubview: viewController.view];
+	[uiwindow makeKeyAndVisible];
+	
 	[UIView beginAnimations:@"inserting main controller" context:NULL];
 	[UIView setAnimationDuration:1];
-	viewController.view.alpha = 1;
+	self.viewController.view.alpha = 1;
 	[UIView commitAnimations];
 	
-	[uiwindow addSubview: viewController.view];
-	[uiwindow makeKeyAndVisible];
-	
 	[internal_pool release];
 }
 
@@ -151,20 +150,23 @@
 
 #pragma mark -
 #pragma mark SDLUIKitDelegate methods
-
-
 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
 -(void) applicationDidFinishLaunching:(UIApplication *)application {
 	[application setStatusBarHidden:YES animated:NO];
 	[application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];  
+		
+	self.uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+	self.uiwindow.backgroundColor = [UIColor blackColor];
 	
-	[self checkFirstRun];
+	self.viewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil];
 	
 	/* 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 {