Skip to content
Snippets Groups Projects
Verified Commit cc3b328b authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

refactor: improvements for next tick time

parent 98be84b1
No related branches found
No related tags found
No related merge requests found
Pipeline #670 passed
......@@ -148,10 +148,7 @@ const state = {
// updates the next update time reference to the, so that it
// can be used to control the game loop
state.nextTickTime = Math.max(
state.nextTickTime + 1000 / state.visualFrequency,
currentTime
);
state.nextTickTime += 1000 / state.visualFrequency * ticks;
}
// calculates the amount of time until the next draw operation
......@@ -378,6 +375,7 @@ const pause = () => {
const resume = () => {
state.paused = false;
state.nextTickTime = new Date().getTime();
const buttonPause = document.getElementById("button-pause");
buttonPause.classList.remove("enabled");
buttonPause.textContent = "Pause";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment