mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-22 21:16:14 -04:00
Re-introduced power saving mode
This commit is contained in:
parent
9bf7e9534d
commit
bdfe5408b9
6 changed files with 3702 additions and 4 deletions
11
src/game.ts
11
src/game.ts
|
@ -84,6 +84,7 @@ export function pause(playerAskedForPause: boolean) {
|
|||
gameState.pauseTimeout = null;
|
||||
document.body.className = gameState.running ? " running " : " paused ";
|
||||
scoreDisplay.className = "";
|
||||
gameState.needsRender=true
|
||||
},
|
||||
Math.min(Math.max(0, gameState.pauseUsesDuringRun - 5) * 50, 500),
|
||||
);
|
||||
|
@ -455,8 +456,13 @@ export function tick() {
|
|||
gameState.runStatistics.runTime += timeDeltaMs;
|
||||
gameStateTick(gameState, frames);
|
||||
}
|
||||
render(gameState);
|
||||
recordOneFrame(gameState);
|
||||
if(gameState.running || gameState.needsRender){
|
||||
gameState.needsRender=false
|
||||
render(gameState);
|
||||
}
|
||||
if(gameState.running){
|
||||
recordOneFrame(gameState);
|
||||
}
|
||||
requestAnimationFrame(tick);
|
||||
}
|
||||
|
||||
|
@ -684,6 +690,7 @@ async function openSettingsPanel() {
|
|||
});
|
||||
if (cb) {
|
||||
cb();
|
||||
gameState.needsRender=true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue