project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m
changeset 5968 4e8bb227be9a
parent 5699 1a9a6a7662aa
child 5975 c3a8cab64fcb
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Mon Sep 19 23:18:48 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Mon Sep 19 23:35:07 2011 +0200
@@ -133,12 +133,19 @@
     // don't clean mainMenuViewController here!!!
 }
 
+// true multitasking with sdl works only on 4.2 and above; we close the game to avoid a black screen at return
 -(void) applicationWillResignActive:(UIApplication *)application {
-    // true multitasking with sdl works only on 4.2 and above; we close the game to avoid a black screen at return
-    if (self.isInGame && ([[[UIDevice currentDevice] systemVersion] floatValue] < 4.2f))
-        HW_terminate(NO);
+    if (self.isInGame)
+        if ([[[UIDevice currentDevice] systemVersion] floatValue] < 4.2f)
+            HW_terminate(NO);
+        else
+            HW_suspend();
     [super applicationWillResignActive:application];
 }
 
+-(void) applicationDidBecomeActive:(UIApplication *)application {
+    HW_resume();
+    [super applicationDidBecomeActive:application];
+}
 
 @end