Files
cocos4/platforms/runtime/common/engine/game.js
T
PP 5109e399b1 update runtime al (#8349)
* optimize  ral.startAccelerometer

* remove jsb.setPreferredFramesPerSecond on runtime

udpate

* update ral

update  ral

update ral

update ral
2021-03-17 10:55:59 +08:00

26 lines
834 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.onHide(function (data) {
cc.game.emit(cc.Game.EVENT_HIDE);
});
ral.onShow(function () {
cc.game.emit(cc.Game.EVENT_SHOW);
});
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);
});