Spaces:
Running
Running
index.js
CHANGED
@@ -79,13 +79,13 @@ function GenerateIndices(maxGlyphs) {
|
|
79 |
}
|
80 |
|
81 |
function GameLoop() {
|
82 |
-
state.lastTime = performance.now();
|
83 |
state.timing.accumulator = 0;
|
84 |
|
85 |
function Tick() {
|
86 |
state.timing.currentTime = performance.now();
|
87 |
-
state.timing.frameTime = (state.timing.currentTime - state.lastTime) / 1000;
|
88 |
-
state.lastTime = state.timing.currentTime;
|
89 |
|
90 |
state.timing.deltaTime = Math.min(state.timing.frameTime, state.timing.maxFrameTime);
|
91 |
state.timing.accumulator += state.timing.deltaTime;
|
|
|
79 |
}
|
80 |
|
81 |
function GameLoop() {
|
82 |
+
state.timing.lastTime = performance.now();
|
83 |
state.timing.accumulator = 0;
|
84 |
|
85 |
function Tick() {
|
86 |
state.timing.currentTime = performance.now();
|
87 |
+
state.timing.frameTime = (state.timing.currentTime - state.timing.lastTime) / 1000;
|
88 |
+
state.timing.lastTime = state.timing.currentTime;
|
89 |
|
90 |
state.timing.deltaTime = Math.min(state.timing.frameTime, state.timing.maxFrameTime);
|
91 |
state.timing.accumulator += state.timing.deltaTime;
|