"incorrect playtime count if fps higher than 60" bug fix

This commit is contained in:
no 2026-06-25 20:39:08 +03:00
parent addd068a76
commit 76107952f0
2 changed files with 8 additions and 1 deletions

View file

@ -1883,7 +1883,10 @@ Graphics.render = function(stage) {
this._skipCount--;
this._rendered = false;
}
this.frameCount++;
// NOTE: frameCount is intentionally NOT incremented here. Incrementing it
// per render ties it to the monitor refresh rate, which makes the playtime
// clock run fast on high-refresh-rate displays. It is now incremented once
// per fixed 60Hz logic tick in SceneManager.updateMain instead.
};
/**

View file

@ -1971,6 +1971,7 @@ SceneManager.updateMain = function() {
if (Utils.isMobileSafari()) {
this.changeScene();
this.updateScene();
Graphics.frameCount++;
} else {
var newTime = this._getTimeInMsWithoutMobileSafari();
var fTime = (newTime - this._currentTime) / 1000;
@ -1981,6 +1982,9 @@ SceneManager.updateMain = function() {
this.updateInputData();
this.changeScene();
this.updateScene();
// Tie the playtime/animation clock to the fixed 60Hz logic step so
// it stays accurate regardless of the display's refresh rate.
Graphics.frameCount++;
this._accumulator -= this._deltaTime;
}
}