project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m
changeset 5503 d8632f589008
parent 5483 fc755bb8096d
child 5662 99083392cd4f
equal deleted inserted replaced
5501:0ba2dca673e6 5503:d8632f589008
   142 // events in the MainLoop
   142 // events in the MainLoop
   143 
   143 
   144 -(void) applicationWillResignActive:(UIApplication *)application {
   144 -(void) applicationWillResignActive:(UIApplication *)application {
   145     //[super applicationWillResignActive:application];
   145     //[super applicationWillResignActive:application];
   146 
   146 
   147     UIDevice* device = [UIDevice currentDevice];
   147     UIDevice *device = [UIDevice currentDevice];
   148     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
   148     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
   149          device.multitaskingSupported &&
   149          [device isMultitaskingSupported] && self.isInGame) {
   150          self.isInGame) {
       
   151         // let's try to be permissive with multitasking here...
   150         // let's try to be permissive with multitasking here...
   152         if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"multitasking"] boolValue])
   151         if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"multitasking"] boolValue])
   153             HW_suspend();
   152             HW_suspend();
   154         else {
   153         else {
   155             // so the game returns to the configuration view
   154             // so the game returns to the configuration view
   164 }
   163 }
   165 
   164 
   166 -(void) applicationDidBecomeActive:(UIApplication *)application {
   165 -(void) applicationDidBecomeActive:(UIApplication *)application {
   167     //[super applicationDidBecomeActive:application];
   166     //[super applicationDidBecomeActive:application];
   168 
   167 
   169     UIDevice* device = [UIDevice currentDevice];
   168     UIDevice *device = [UIDevice currentDevice];
   170     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
   169     if ([device respondsToSelector:@selector(isMultitaskingSupported)] &&
   171          device.multitaskingSupported &&
   170          [device isMultitaskingSupported] && self.isInGame) {
   172          self.isInGame) {
       
   173         HW_resume();
   171         HW_resume();
   174     }
   172     }
   175 }
   173 }
   176 
   174 
   177 @end
   175 @end