cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m
changeset 3335 2520ee7a5484
parent 3318 591c42242106
child 3361 cfc6cd502f85
equal deleted inserted replaced
3334:f94a52a763d4 3335:2520ee7a5484
    71     } else 
    71     } else 
    72         return nil;
    72         return nil;
    73 }
    73 }
    74 
    74 
    75 -(void) dealloc {
    75 -(void) dealloc {
       
    76     [viewController release];
    76 	[uiwindow release];
    77 	[uiwindow release];
    77 	[super dealloc];
    78 	[super dealloc];
    78 }
    79 }
    79 
    80 
    80 // main routine for calling the actual game engine
    81 // main routine for calling the actual game engine
   100     
   101     
   101     free(gameArgs);
   102     free(gameArgs);
   102     [overlayController.view removeFromSuperview];
   103     [overlayController.view removeFromSuperview];
   103     
   104     
   104     [viewController appear];
   105     [viewController appear];
   105 }
       
   106 
       
   107 // get a path-to-file string
       
   108 -(NSString *)dataFilePath:(NSString *)fileName {
       
   109 	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
       
   110 	NSString *documentsDirectory = [paths objectAtIndex:0];
       
   111 	return [documentsDirectory stringByAppendingPathComponent:fileName];
       
   112 }
   106 }
   113 
   107 
   114 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
   108 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
   115 -(void) applicationDidFinishLaunching:(UIApplication *)application {
   109 -(void) applicationDidFinishLaunching:(UIApplication *)application {
   116 	//[application setStatusBarHidden:YES animated:NO];
   110 	//[application setStatusBarHidden:YES animated:NO];
   143         longjmp(*(jump_env()), 1);
   137         longjmp(*(jump_env()), 1);
   144     }
   138     }
   145 }
   139 }
   146 
   140 
   147 -(void) applicationWillResignActive:(UIApplication *)application {
   141 -(void) applicationWillResignActive:(UIApplication *)application {
   148 	NSLog(@"%@", NSStringFromSelector(_cmd));
   142 	//NSLog(@"%@", NSStringFromSelector(_cmd));
   149     if (isInGame) HW_pause();
   143     if (isInGame) HW_pause();
   150 	//SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   144 	//SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
   151 }
   145 }
   152 
   146 
   153 -(void) applicationDidBecomeActive:(UIApplication *)application {
   147 -(void) applicationDidBecomeActive:(UIApplication *)application {
   154 	NSLog(@"%@", NSStringFromSelector(_cmd));
   148 	//NSLog(@"%@", NSStringFromSelector(_cmd));
   155     if (isInGame) HW_pause();
   149     if (isInGame) HW_pause();
   156 	//SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   150 	//SDL_SendWindowEvent(self.window, SDL_WINDOWEVENT_RESTORED, 0, 0);
   157 }
   151 }
   158 
   152 
   159 @end
   153 @end