add start of client rendering
This commit is contained in:
parent
9787a9d468
commit
ebcee954bf
13 changed files with 127 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue