summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-09-05 00:39:29 -0400
committerStarla Insigna <starla4444@gmail.com>2011-09-05 00:39:29 -0400
commitc505b38ac0ad593ee7c4e56895a06a69878a88d3 (patch)
treee13e128b5af2c1f946adffbb33f24fbc7673ef38
parentf39ff64d51952d8af896daf8b556178abc01d47a (diff)
downloadcartcollect-c505b38ac0ad593ee7c4e56895a06a69878a88d3.tar.gz
cartcollect-c505b38ac0ad593ee7c4e56895a06a69878a88d3.tar.bz2
cartcollect-c505b38ac0ad593ee7c4e56895a06a69878a88d3.zip
Made game automatically pause when resigning active state
Previously, the game paused when it entered the background. Now, it pauses when the game is about to become inactive, which is the proper thing to do.
-rwxr-xr-xClasses/Cart_CollectAppDelegate.m14
1 files changed, 7 insertions, 7 deletions
diff --git a/Classes/Cart_CollectAppDelegate.m b/Classes/Cart_CollectAppDelegate.m index 1a6759c..25a2aa4 100755 --- a/Classes/Cart_CollectAppDelegate.m +++ b/Classes/Cart_CollectAppDelegate.m
@@ -134,6 +134,13 @@
134 134
135- (void)applicationWillResignActive:(UIApplication *)application { 135- (void)applicationWillResignActive:(UIApplication *)application {
136 [[CCDirector sharedDirector] pause]; 136 [[CCDirector sharedDirector] pause];
137
138 [[NSUserDefaults standardUserDefaults] synchronize];
139
140 if ([[CCDirector sharedDirector] runningScene].tag == GAME_SCENE)
141 {
142 [((GameMode*)[[[CCDirector sharedDirector] runningScene] getChildByTag:GAME_LAYER]) pause];
143 }
137} 144}
138 145
139- (void)applicationDidBecomeActive:(UIApplication *)application { 146- (void)applicationDidBecomeActive:(UIApplication *)application {
@@ -146,13 +153,6 @@
146 153
147-(void) applicationDidEnterBackground:(UIApplication*)application { 154-(void) applicationDidEnterBackground:(UIApplication*)application {
148 [[CCDirector sharedDirector] stopAnimation]; 155 [[CCDirector sharedDirector] stopAnimation];
149
150 [[NSUserDefaults standardUserDefaults] synchronize];
151
152 if ([[CCDirector sharedDirector] runningScene].tag == GAME_SCENE)
153 {
154 [((GameMode*)[[[CCDirector sharedDirector] runningScene] getChildByTag:GAME_LAYER]) pause];
155 }
156} 156}
157 157
158-(void) applicationWillEnterForeground:(UIApplication*)application { 158-(void) applicationWillEnterForeground:(UIApplication*)application {