135 return [documentsDirectory stringByAppendingPathComponent:fileName]; |
135 return [documentsDirectory stringByAppendingPathComponent:fileName]; |
136 } |
136 } |
137 |
137 |
138 -(void) applicationDidReceiveMemoryWarning:(UIApplication *)application { |
138 -(void) applicationDidReceiveMemoryWarning:(UIApplication *)application { |
139 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Running low on memory" |
139 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Running low on memory" |
140 message:@"Will try to free some memory but app may crash" |
140 message:@"I will try to free some memory but game might slow down a little" |
141 delegate:nil |
141 delegate:nil |
142 cancelButtonTitle:@"Ok" |
142 cancelButtonTitle:@"Ok" |
143 otherButtonTitles:nil ]; |
143 otherButtonTitles:nil ]; |
144 [alert show]; |
144 [alert show]; |
145 [alert release]; |
145 [alert release]; |
146 } |
146 } |
|
147 |
147 #pragma mark - |
148 #pragma mark - |
148 #pragma mark SDLUIKitDelegate methods |
149 #pragma mark SDLUIKitDelegate methods |
149 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib) |
150 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib) |
150 -(void) applicationDidFinishLaunching:(UIApplication *)application { |
151 -(void) applicationDidFinishLaunching:(UIApplication *)application { |
151 [application setStatusBarHidden:YES animated:NO]; |
152 [application setStatusBarHidden:YES animated:NO]; |
152 |
153 |
153 [self checkFirstRun]; |
154 [self checkFirstRun]; |
|
155 |
154 /* Set working directory to resource path */ |
156 /* Set working directory to resource path */ |
155 [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]]; |
157 [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]]; |
156 |
158 |
157 [uiwindow addSubview:controller.view]; |
159 [uiwindow addSubview:controller.view]; |
158 [uiwindow makeKeyAndVisible]; |
160 [uiwindow makeKeyAndVisible]; |