Cleaning up spaces

This commit is contained in:
Jeremiah Billmann
2013-06-01 16:22:04 -04:00
parent a6c6753815
commit 9038bdc6fb
4 changed files with 20 additions and 19 deletions
+10 -10
View File
@@ -1,14 +1,14 @@
$(function () {
GarageServerIO.connectToGarageServer('http://garageserver_io.jbillmann.c9.io', { logging: true });
var gameCanvas = document.getElementById('gameCanvas'),
keyboard = new THREEx.KeyboardState(),
ctxGameCanvas = gameCanvas.getContext('2d'),
x = 0, y =0, fps = 0, now, lastUpdate = (new Date)*1 - 1, fpsFilter = 50,
requestAnimFrame = (function(){
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000/60); };
})(),
@@ -31,20 +31,20 @@ $(function () {
GarageServerIO.addPlayerInput('up');
}
},
update = function () {
requestAnimFrame(update);
handleInput();
ctxGameCanvas.clearRect(0, 0, gameCanvas.width, gameCanvas.height);
ctxGameCanvas.fillRect(x, y, 10, 10);
var thisFrameFPS = 1000 / ((now=new Date) - lastUpdate);
fps += (thisFrameFPS - fps) / fpsFilter;
lastUpdate = now;
$('#fps').html('FPS: ' + Math.round(fps));
};
update();
});