mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-28 16:20:43 +08:00
Cleanup and minor namespace change
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
$(function () {
|
||||
|
||||
"use strict";
|
||||
|
||||
var canvas = document.getElementById('gameCanvas'), ctxCanvas = canvas.getContext('2d'), keyboard = new THREEx.KeyboardState();
|
||||
|
||||
GarageServerIO.initializeGarageServer('http://garageserver_io.jbillmann.c9.io', {
|
||||
GarageServerIO.initializeGarageServer('http://garageserver_io.jbillmann.c9.io', {
|
||||
logging: true,
|
||||
onUpdatePlayerPhysics: GamePhysics.getNewState,
|
||||
onInterpolation: GamePhysics.getInterpolatedState
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
window.GameLoop = (function (window) {
|
||||
var GameLoop = (function (window) {
|
||||
"use strict";
|
||||
|
||||
var requestAnimFrame = (function () {
|
||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000/60); };
|
||||
})(),
|
||||
}()),
|
||||
_currentTime = new Date().getTime(),
|
||||
_accumulator = 0.0,
|
||||
|
||||
start = function (renderCallback, updateCallback) {
|
||||
loop();
|
||||
|
||||
function loop () {
|
||||
function loop() {
|
||||
requestAnimFrame(loop);
|
||||
|
||||
var newTime = new Date().getTime(), frameTime = newTime - _currentTime;
|
||||
@@ -25,9 +25,10 @@ window.GameLoop = (function (window) {
|
||||
|
||||
renderCallback();
|
||||
}
|
||||
loop();
|
||||
};
|
||||
|
||||
return {
|
||||
start: start
|
||||
};
|
||||
}) (window);
|
||||
}(window));
|
||||
Reference in New Issue
Block a user