BlueGit

timfa raytracer

requestAnimationFrame test

timfa Tim Falken · pushed by timfa

Authored 2021-07-01 · 5 years ago

Hash
f5246e4200a6e24fe36bc56d76c2d1bcd851baca
Parent
d4c309d6
2 files changed +5 −1
js/GameWindow.js +2 −0
@@ -63,5 +63,7 @@ var GameWindow =
63 63 GameWindow.canvasContext.fillRect(0, 0, GameWindow.width, GameWindow.height);
64 64
65 65 Player.draw3D();
66
67 requestAnimationFrame(GameWindow.redraw);
66 68 }
67 69 }
@@ -63,5 +63,7 @@ var GameWindow =
63 GameWindow.canvasContext.fillRect(0, 0, GameWindow.width, GameWindow.height);
63 GameWindow.canvasContext.fillRect(0, 0, GameWindow.width, GameWindow.height);
64
64
65 Player.draw3D();
65 Player.draw3D();
66
67 requestAnimationFrame(GameWindow.redraw);
66 }
68 }
67}
69}
main.js +3 −1
@@ -28,10 +28,12 @@ window.onload = function()
28 28 GameInput.g_updateKeys();
29 29 Player.update(stepTimeCurr);
30 30
31 GameWindow.redraw();
31
32 32
33 33 this.stepPrevious = stepTime;
34 34 }, 20);
35
36 GameWindow.redraw();
35 37 }
36 38
37 39 var stepPrevious = 0;
@@ -28,10 +28,12 @@ window.onload = function()
28 GameInput.g_updateKeys();
28 GameInput.g_updateKeys();
29 Player.update(stepTimeCurr);
29 Player.update(stepTimeCurr);
30
30
31 GameWindow.redraw();
31
32
32
33 this.stepPrevious = stepTime;
33 this.stepPrevious = stepTime;
34 }, 20);
34 }, 20);
35
36 GameWindow.redraw();
35}
37}
36
38
37var stepPrevious = 0;
39var stepPrevious = 0;