1.CCBoot.js中_initEvents接口里面有判断游戏是否进入后台,并抛出了自定义事件
var targetElement = document.documentElement;
var onFullScreenCallback = function(){cc.log("true")};
if(!cc.screen.fullScreen()){ //判断是否是全屏
cc.screen.requestFullScreen(targetElement,onFullScreenCallback);
}else{
cc.screen.exitFullScreen();
}
3.添加侦听事件(进入后台)
cc.eventManager.addCustomListener(cc.game.EVENT_HIDE,function() {
cc.game.hideGame();
});
hideGame : function () {};
4.添加侦听事件(进入游戏)
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function () {
cc.game.showGame();
});;
showGame : function () {};