Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed #1600:update AppDelegate.cpp in xcode template

  • Loading branch information...
commit bfcb19fa79d117b20a5b44eee4aa2468e713ed58 1 parent fdff654
@minggo minggo authored
View
14 template/xcode4/cocos2dx.xctemplate/Classes/AppDelegate.cpp
@@ -46,17 +46,15 @@ bool AppDelegate::applicationDidFinishLaunching()
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
- CCDirector::sharedDirector()->pause();
-
- // if you use SimpleAudioEngine, it must be paused
- // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ CCDirector::sharedDirector()->stopAnimation();
+ SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->pauseAllEffects();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
- CCDirector::sharedDirector()->resume();
-
- // if you use SimpleAudioEngine, it must resume here
- // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ CCDirector::sharedDirector()->startAnimation();
+ SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->resumeAllEffects();
}
View
10 template/xcode4/cocos2dx_box2d.xctemplate/Classes/AppDelegate.cpp
@@ -47,16 +47,14 @@ bool AppDelegate::applicationDidFinishLaunching()
void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->stopAnimation();
-
- // if you use SimpleAudioEngine, it must be paused
- // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->pauseAllEffects();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->startAnimation();
-
- // if you use SimpleAudioEngine, it must resume here
- // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->resumeAllEffects();
}
View
10 template/xcode4/cocos2dx_chipmunk.xctemplate/Classes/AppDelegate.cpp
@@ -47,16 +47,14 @@ bool AppDelegate::applicationDidFinishLaunching()
void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->stopAnimation();
-
- // if you use SimpleAudioEngine, it must be pause
- // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->pauseAllEffects();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->startAnimation();
-
- // if you use SimpleAudioEngine, it must resume here
- // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->resumeAllEffects();
}
View
2  template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp
@@ -56,6 +56,7 @@ void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->stopAnimation();
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->pauseAllEffects();
}
// this function will be called when the app is active again
@@ -63,4 +64,5 @@ void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->startAnimation();
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
+ SimpleAudioEngine::sharedEngine()->resumeAllEffects();
}
Please sign in to comment.
Something went wrong with that request. Please try again.