From d386116255a518d42535cc9f063252f3d1f6dfd2 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 10 Aug 2011 10:24:06 +0800 Subject: [PATCH] [iOS]fixed #667: call AppDelegate::applicationDidEnterBackground() & AppDeleaget::applicationWillEnterForeground() when application enter background & enter foreground --- HelloLua/ios/AppController.mm | 4 ++-- HelloWorld/ios/AppController.mm | 4 ++-- .../ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- .../ios/___PROJECTNAMEASIDENTIFIER___AppController.mm | 4 ++-- .../ios/___PROJECTNAMEASIDENTIFIER___AppController.mm | 4 ++-- .../ios/___PROJECTNAMEASIDENTIFIER___AppController.mm | 4 ++-- template/xcode3/cocos2d-x_lua_app/ios/AppController.mm | 4 ++-- tests/test.ios/Classes/testsAppDelegate.mm | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/HelloLua/ios/AppController.mm b/HelloLua/ios/AppController.mm index ce006ff323..fb4c058c97 100644 --- a/HelloLua/ios/AppController.mm +++ b/HelloLua/ios/AppController.mm @@ -87,14 +87,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/HelloWorld/ios/AppController.mm b/HelloWorld/ios/AppController.mm index 8281988190..608e86962b 100644 --- a/HelloWorld/ios/AppController.mm +++ b/HelloWorld/ios/AppController.mm @@ -87,14 +87,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id b/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id index 36358cab89..32876e0563 100644 --- a/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -a94593d95f2fff9766c611a35a6593a87d490698 \ No newline at end of file +a5ce034a4fc47a468b772dcde86d19007b7900b5 \ No newline at end of file diff --git a/template/xcode3/cocos2d-x_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm b/template/xcode3/cocos2d-x_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm index d2e8e3dfb8..b598d5f01e 100644 --- a/template/xcode3/cocos2d-x_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm +++ b/template/xcode3/cocos2d-x_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm @@ -61,14 +61,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/template/xcode3/cocos2d-x_box2d_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm b/template/xcode3/cocos2d-x_box2d_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm index fd90891952..8d92bf4f29 100644 --- a/template/xcode3/cocos2d-x_box2d_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm +++ b/template/xcode3/cocos2d-x_box2d_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm @@ -62,14 +62,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/template/xcode3/cocos2d-x_chipmunk_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm b/template/xcode3/cocos2d-x_chipmunk_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm index 1966a57513..bd7adc4d4a 100644 --- a/template/xcode3/cocos2d-x_chipmunk_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm +++ b/template/xcode3/cocos2d-x_chipmunk_app/ios/___PROJECTNAMEASIDENTIFIER___AppController.mm @@ -62,14 +62,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } diff --git a/template/xcode3/cocos2d-x_lua_app/ios/AppController.mm b/template/xcode3/cocos2d-x_lua_app/ios/AppController.mm index ce006ff323..fb4c058c97 100644 --- a/template/xcode3/cocos2d-x_lua_app/ios/AppController.mm +++ b/template/xcode3/cocos2d-x_lua_app/ios/AppController.mm @@ -87,14 +87,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application { diff --git a/tests/test.ios/Classes/testsAppDelegate.mm b/tests/test.ios/Classes/testsAppDelegate.mm index c0ad31a32d..faa2ce5a8b 100644 --- a/tests/test.ios/Classes/testsAppDelegate.mm +++ b/tests/test.ios/Classes/testsAppDelegate.mm @@ -75,14 +75,14 @@ static AppDelegate s_sharedApplication; Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, called instead of applicationWillTerminate: when the user quits. */ - cocos2d::CCDirector::sharedDirector()->stopAnimation(); + cocos2d::CCApplication::sharedApplication().applicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication *)application { /* Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. */ - cocos2d::CCDirector::sharedDirector()->startAnimation(); + cocos2d::CCApplication::sharedApplication().applicationWillEnterForeground(); } - (void)applicationWillTerminate:(UIApplication *)application {