project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
changeset 3660 bc125bea5849
parent 3659 f8d5ac50e307
child 3661 2378ada8a6ee
equal deleted inserted replaced
3659:f8d5ac50e307 3660:bc125bea5849
   113 // override the direct execution of SDL_main to allow us to implement the frontend (or even using a nib)
   113 // override the direct execution of SDL_main to allow us to implement the frontend (or even using a nib)
   114 -(void) applicationDidFinishLaunching:(UIApplication *)application {
   114 -(void) applicationDidFinishLaunching:(UIApplication *)application {
   115     [application setStatusBarHidden:YES]; 
   115     [application setStatusBarHidden:YES]; 
   116     
   116     
   117     UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   117     UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   118     uiwindow.backgroundColor = [UIColor blackColor];
       
   119     
   118     
   120     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
   119     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
   121         self.mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil];
   120         self.mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil];
   122     else
   121     else
   123         self.mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil];
   122         self.mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil];
   124 
   123 
   125     [uiwindow addSubview:self.mainViewController.view];
   124     [uiwindow addSubview:self.mainViewController.view];
   126     [self.mainViewController release];
   125     [self.mainViewController release];
       
   126     uiwindow.backgroundColor = [UIColor blackColor];
   127     [uiwindow makeKeyAndVisible];
   127     [uiwindow makeKeyAndVisible];
   128 
   128 
   129     // Set working directory to resource path
   129     // set working directory to resource path
   130     [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]];
   130     [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]];
   131 }
   131 }
   132 
   132 
   133 -(void) applicationWillTerminate:(UIApplication *)application {
   133 -(void) applicationWillTerminate:(UIApplication *)application {
   134     SDL_SendQuit();
   134     SDL_SendQuit();
   164         }
   164         }
   165     }
   165     }
   166 }
   166 }
   167 
   167 
   168 -(void) applicationDidBecomeActive:(UIApplication *)application {
   168 -(void) applicationDidBecomeActive:(UIApplication *)application {
   169     //NSLog(@"%@", NSStringFromSelector(_cmd));
       
   170     if (isInGame) {
   169     if (isInGame) {
   171         HW_pause();
   170         HW_pause();
   172 
   171 
   173         // Send every window on every screen a RESTORED event.
   172         // Send every window on every screen a RESTORED event.
   174         SDL_VideoDevice *_this = SDL_GetVideoDevice();
   173         SDL_VideoDevice *_this = SDL_GetVideoDevice();