Skip to content

Commit f676fc2

Browse files
committed
Recoded the SceneManage
The Scene Manager no longer tries to maintain an 'active' list and instead just iterates the scenes in order, skipping those that aren't awake. Scene array changing events like moveUp etc are queued if the list is being processed and the ScenePlugin has been vastly updated to take care of this. You can now happily move scenes around the list, block scene input, consume input events, switch scenes around and more.
1 parent 2b4d6f1 commit f676fc2

5 files changed

Lines changed: 586 additions & 605 deletions

File tree

src/boot/Game.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ var Game = new Class({
226226
*/
227227
step: function (time, delta)
228228
{
229-
var active = this.scene.active;
230-
var renderer = this.renderer;
231-
232229
// Global Managers
233230

234231
this.input.update(time, delta);
@@ -239,28 +236,21 @@ var Game = new Class({
239236

240237
this.onStepCallback();
241238

242-
for (var i = 0; i < active.length; i++)
243-
{
244-
active[i].scene.sys.step(time, delta);
245-
}
239+
this.scene.update(time, delta);
246240

247241
// Render
248242

249-
// var interpolation = this.frameDelta / this.timestep;
243+
var renderer = this.renderer;
250244

251245
renderer.preRender();
252246

253-
this.events.emit('prerender');
247+
this.events.emit('prerender', renderer);
254248

255-
// This uses active.length, in case scene.update removed the scene from the active list
256-
for (i = 0; i < active.length; i++)
257-
{
258-
active[i].scene.sys.render(0, renderer);
259-
}
249+
this.scene.render(renderer);
260250

261251
renderer.postRender();
262252

263-
this.events.emit('postrender');
253+
this.events.emit('postrender', renderer);
264254
},
265255

266256
/**

0 commit comments

Comments
 (0)