Phaser.Game = function (callbackContext, parent, width, height, preloadCallback, createCallback, updateCallback, renderCallback, destroyCallback){ if (typeof parent === "undefined") { parent = ''; } if (typeof width === "undefined") { width = 800; } if (typeof height === "undefined") { height = 600; } if (typeof preloadCallback === "undefined") { preloadCallback = null ; } if (typeof createCallback === "undefined") { createCallback = null ; } if (typeof updateCallback === "undefined") { updateCallback = null ; } if (typeof renderCallback === "undefined") { renderCallback = null ; } if (typeof destroyCallback === "undefined") { destroyCallback = null ; } this.id = Phaser.GAMES.push(this) - 1; this.callbackContext = callbackContext; this.onPreloadCallback = preloadCallback; this.onCreateCallback = createCallback; this.onUpdateCallback = updateCallback; this.onRenderCallback = renderCallback; this.onDestroyCallback = destroyCallback; var _this = this; if (document.readyState === 'complete' || document.readyState === 'interactive') { _AN_Call_settimeout('setTimeout', window, function (){ return Phaser.GAMES[_this.id].boot(parent, width, height); } ); } else { document.addEventListener('DOMContentLoaded', Phaser.GAMES[_this.id].boot(parent, width, height), false ); window.addEventListener('load', Phaser.GAMES[_this.id].boot(parent, width, height), false ); } } ; Phaser.Game.prototype = { id: 0, _loadComplete: false , _paused: false , _pendingState: null , state: null , onPreloadCallback: null , onCreateCallback: null , onUpdateCallback: null , onRenderCallback: null , onPreRenderCallback: null , onLoadUpdateCallback: null , onLoadRenderCallback: null , onPausedCallback: null , onDestroyCallback: null , isBooted: false , isRunning: false , boot: function (parent, width, height){ var _this = this; if (this.isBooted) { return ; } if (!document.body) { _AN_Call_settimeout('setTimeout', window, function (){ return Phaser.GAMES[_this.id].boot(parent, width, height); } , 13); } else { document.removeEventListener('DOMContentLoaded', Phaser.GAMES[_this.id].boot); window.removeEventListener('load', Phaser.GAMES[_this.id].boot); console.log('Phaser', Phaser.VERSION, 'alive'); this.device = new Phaser.Device(); this.net = new Phaser.Net(this); this.cache = new Phaser.Cache(this); this.load = new Phaser.Loader(this); this.time = new Phaser.Time(this); this.tweens = new Phaser.TweenManager(this); this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()] ); this.isBooted = true ; } } } ;