BlueGit

timfa raytracer

Files

raytracer / archive / legacy-js / main.js

main.js

main.js 805 B Download Raw
1window.onload = function()
2{
3 console.log("Loading Everything");
4 GameWindow.init(0, 0, window.innerWidth - 2, window.innerHeight - 2);
5 GameWindow.fullscreen = true;
6
7 GameInput.g_init();
8
9 Canvas.canvas.requestPointerLock = Canvas.canvas.requestPointerLock ||
10 element.mozRequestPointerLock ||
11 element.webkitRequestPointerLock;
12 // Ask the browser to lock the pointer
13
14 Canvas.canvas.onclick = function() {
15 Canvas.canvas.requestPointerLock();
16 }
17
18 World.loadLevel(0);
19
20 setInterval(function()
21 {
22 var stepTime = Date.now();
23 var stepTimeCurr = (stepTime - stepPrevious) * 0.001;
24
25 if(isNaN(stepTimeCurr))
26 stepTimeCurr = 0;
27
28 GameInput.g_updateKeys();
29 Player.update(stepTimeCurr);
30
31
32
33 this.stepPrevious = stepTime;
34 }, 1);
35
36 GameWindow.redraw();
37}
38
39var stepPrevious = 0;