Added onStepCallback to Game step.

This commit is contained in:
photonstorm 2017-07-20 11:34:01 +01:00
parent b438c0ead8
commit 0589effa22

View file

@ -3,6 +3,7 @@ var Class = require('../utils/Class');
var Config = require('./Config'); var Config = require('./Config');
var DebugHeader = require('./DebugHeader'); var DebugHeader = require('./DebugHeader');
var Device = require('../device'); var Device = require('../device');
var NOOP = require('../utils/NOOP');
var AddToDOM = require('../dom/AddToDOM'); var AddToDOM = require('../dom/AddToDOM');
var DOMContentLoaded = require('../dom/DOMContentLoaded'); var DOMContentLoaded = require('../dom/DOMContentLoaded');
@ -79,6 +80,8 @@ var Game = new Class({
*/ */
this.loop = new TimeStep(this, this.config.fps); this.loop = new TimeStep(this, this.config.fps);
this.onStepCallback = NOOP;
// Wait for the DOM Ready event, then call boot. // Wait for the DOM Ready event, then call boot.
DOMContentLoaded(this.boot.bind(this)); DOMContentLoaded(this.boot.bind(this));
@ -129,6 +132,8 @@ var Game = new Class({
// Scenes // Scenes
this.onStepCallback();
for (var i = 0; i < active.length; i++) for (var i = 0; i < active.length; i++)
{ {
active[i].scene.sys.step(time, delta); active[i].scene.sys.step(time, delta);