project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
changeset 4540 9b614e420de5
parent 4510 ce9b8206e681
child 4547 b70004a576a3
equal deleted inserted replaced
4539:bad3411cba49 4540:9b614e420de5
   230 -(void) applicationWillResignActive:(UIApplication *)application {
   230 -(void) applicationWillResignActive:(UIApplication *)application {
   231     UIDevice* device = [UIDevice currentDevice];
   231     UIDevice* device = [UIDevice currentDevice];
   232     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
   232     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
   233          device.multitaskingSupported &&
   233          device.multitaskingSupported &&
   234          self.isInGame) {
   234          self.isInGame) {
   235         // multiasking in-game works only for ios >= 4.2, returns a black screen on other verions
   235         // let's try to be permissive with multitasking here...
   236         if (NSClassFromString(@"UIPrintInfo"))
   236         NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()];
       
   237         if ([[settings objectForKey:@"multitasking"] boolValue])
   237             HW_suspend();
   238             HW_suspend();
   238         else {
   239         else {
   239             // so the game returns to the configuration view
   240             // so the game returns to the configuration view
   240             if (isGameRunning())
   241             if (isGameRunning())
   241                 HW_terminate(NO);
   242                 HW_terminate(NO);
   244                 SDL_SendQuit();
   245                 SDL_SendQuit();
   245                 HW_terminate(YES);
   246                 HW_terminate(YES);
   246                 longjmp(*(jump_env()), 1);
   247                 longjmp(*(jump_env()), 1);
   247             }
   248             }
   248         }
   249         }
       
   250         [settings release];
   249     }
   251     }
   250 }
   252 }
   251 
   253 
   252 -(void) applicationDidBecomeActive:(UIApplication *)application {
   254 -(void) applicationDidBecomeActive:(UIApplication *)application {
   253     UIDevice* device = [UIDevice currentDevice];
   255     UIDevice* device = [UIDevice currentDevice];