-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.js
35 lines (24 loc) · 891 Bytes
/
client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright 2012-2016 Sven "underscorediscovery" Bergström
written by : http://underscorediscovery.ca
written for : http://buildnewgames.com/real-time-multiplayer/
MIT Licensed.
*/
//A window global for our game root variable.
var game = {};
//When loading, we store references to our
//drawing canvases, and initiate a game instance.
window.onload = function(){
//Create our game client instance.
game = new game_core();
//Fetch the viewport
game.viewport = document.getElementById('viewport');
//Adjust their size
game.viewport.width = game.world.width;
game.viewport.height = game.world.height;
//Fetch the rendering contexts
game.ctx = game.viewport.getContext('2d');
//Set the draw style for the font
game.ctx.font = '11px "Helvetica"';
//Finally, start the loop
game.update( new Date().getTime() );
}; //window.onload