add start of client rendering

This commit is contained in:
Asraelite 2016-03-21 16:15:49 +00:00
parent 9787a9d468
commit ebcee954bf
13 changed files with 127 additions and 7 deletions

View file

@ -2,8 +2,28 @@
window.addEventListener('load', init);
var socket;
var game;
function init() {
socket = io.connect('http://localhost:8080');
game = new Game();
game.tick();
game.net.connect();
}
function Game() {
var self = this;
this.connected = false;
this.state = 'connecting';
this.net = new Net();
this.renderer = new Renderer();
this.tick = function() {
self.renderer.render(self.state);
requestAnimationFrame(self.tick);
}
}