Files
cocos4/platforms/runtime/common/engine/game.js
T
PP d916165d85 optimize hide show event implamentation on minigame / runtime platform (#9093)
* fix hide show event on runtime platform

* remove legacy adapter on minigame platform

update
2021-08-04 16:16:36 +08:00

18 lines
694 B
JavaScript

cc.game.restart = function () {
};
cc.game._setAnimFrame = function () {
this._lastTime = performance.now();
const frameRate = this.config.frameRate;
this._frameTime = 1000 / frameRate;
ral.setPreferredFramesPerSecond(frameRate);
window.rAF = window.requestAnimationFrame;
window.cAF = window.cancelAnimationFrame;
};
ral.onWindowResize && ral.onWindowResize(function (width, height) {
// Since the initialization of the creator engine may not take place until after the onWindowResize call,
// you need to determine whether the canvas already exists before you can call the setCanvasSize method
cc.game.canvas && cc.view.setCanvasSize(width, height);
});