Skip to content

Commit

Permalink
add stopAnimation/startAnimation to game pasue/resume (#3584)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxHuang authored and pandamicro committed Dec 3, 2018
1 parent 198399e commit 6be4789
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cocos2d/core/CCGame.js
Expand Up @@ -286,6 +286,8 @@ var game = {
if (cc.audioEngine) {
cc.audioEngine._break();
}
// Pause animation
cc.director.stopAnimation();
// Pause main loop
if (this._intervalId)
window.cancelAnimFrame(this._intervalId);
Expand All @@ -305,6 +307,8 @@ var game = {
if (cc.audioEngine) {
cc.audioEngine._restore();
}
// Resume animation
cc.director.startAnimation();
// Resume main loop
this._runMainLoop();
},
Expand Down

0 comments on commit 6be4789

Please sign in to comment.