Skip to content

Commit a366ef8

Browse files
committed
New State Manager up and running.
1 parent dd34e40 commit a366ef8

8 files changed

Lines changed: 579 additions & 94 deletions

File tree

build/config.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@
7474
<script src="$path/src/geom/Rectangle.js"></script>
7575
<script src="$path/src/geom/RoundedRectangle.js"></script>
7676
77+
<script src="$path/src/states/State.js"></script>
78+
<script src="$path/src/states/StateManager.js"></script>
79+
7780
<script src="$path/src/core/Camera.js"></script>
7881
<script src="$path/src/core/Create.js"></script>
79-
<script src="$path/src/core/State.js"></script>
80-
<script src="$path/src/core/StateManager.js"></script>
8182
<script src="$path/src/core/Signal.js"></script>
8283
<script src="$path/src/core/SignalBinding.js"></script>
8384
<script src="$path/src/core/Filter.js"></script>

src/components/Children.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,9 @@ Phaser.Component.Children.prototype = {
594594
}
595595

596596
return newParent;
597-
},
597+
}
598598

599+
/*
599600
preUpdate: function ()
600601
{
601602
for (var i = 0; i < this.list.length; i++)
@@ -605,7 +606,30 @@ Phaser.Component.Children.prototype = {
605606
this.list[i].preUpdate();
606607
}
607608
}
609+
},
610+
611+
update: function ()
612+
{
613+
for (var i = 0; i < this.list.length; i++)
614+
{
615+
if (this.list[i])
616+
{
617+
this.list[i].update();
618+
}
619+
}
620+
},
621+
622+
postUpdate: function ()
623+
{
624+
for (var i = 0; i < this.list.length; i++)
625+
{
626+
if (this.list[i])
627+
{
628+
this.list[i].postUpdate();
629+
}
630+
}
608631
}
632+
*/
609633

610634
};
611635

src/core/Game.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ Phaser.Game.prototype = {
608608
this.updates = new Phaser.UpdateManager(this);
609609

610610
this.scale = new Phaser.ScaleManager(this, this._width, this._height);
611-
this.stage = new Phaser.Stage(this);
611+
// this.stage = new Phaser.Stage(this);
612612

613613
this.setUpRenderer();
614614

@@ -631,7 +631,7 @@ Phaser.Game.prototype = {
631631

632632
this.add = new Phaser.GameObject.Factory(this);
633633

634-
this.make = new Phaser.GameObjectCreator(this);
634+
// this.make = new Phaser.GameObjectCreator(this);
635635
this.cache = new Phaser.Cache(this);
636636
this.load = new Phaser.Loader(this);
637637
this.time = new Phaser.Time(this);
@@ -645,7 +645,7 @@ Phaser.Game.prototype = {
645645
this.net = new Phaser.Net(this);
646646

647647
this.time.boot();
648-
this.stage.boot();
648+
// this.stage.boot();
649649
// this.world.boot();
650650
this.scale.boot();
651651
this.input.boot();
@@ -772,14 +772,8 @@ Phaser.Game.prototype = {
772772
{
773773
// They requested WebGL and their browser supports it
774774

775-
if (this.multiTexture || this.renderType === Phaser.WEBGL_MULTI)
776-
{
777-
PIXI.enableMultiTexture();
778-
}
779-
780775
this.renderType = Phaser.WEBGL;
781776

782-
// this.renderer = new PIXI.WebGLRenderer(this);
783777
this.renderer = new Phaser.Renderer.WebGL(this);
784778

785779
this.context = null;
@@ -789,14 +783,14 @@ Phaser.Game.prototype = {
789783
this.canvas.addEventListener('webglcontextrestored', this.contextRestored.bind(this), false);
790784
}
791785

792-
if (this.device.cocoonJS)
793-
{
794-
this.canvas.screencanvas = (this.renderType === Phaser.CANVAS) ? true : false;
795-
}
786+
// if (this.device.cocoonJS)
787+
// {
788+
// this.canvas.screencanvas = (this.renderType === Phaser.CANVAS) ? true : false;
789+
// }
796790

797791
if (this.renderType !== Phaser.HEADLESS)
798792
{
799-
this.stage.smoothed = this.antialias;
793+
// this.stage.smoothed = this.antialias;
800794

801795
Phaser.Canvas.addToDOM(this.canvas, this.parent, false);
802796
Phaser.Canvas.setTouchAction(this.canvas);
@@ -964,11 +958,11 @@ Phaser.Game.prototype = {
964958
// this.physics.preUpdate();
965959
this.state.preUpdate(timeStep);
966960
// this.plugins.preUpdate(timeStep);
967-
this.stage.preUpdate();
961+
// this.stage.preUpdate();
968962

969963
this.tweens.update();
970964
this.state.update();
971-
this.stage.update();
965+
// this.stage.update();
972966
// this.tweens.update();
973967

974968
// this.sound.update();
@@ -977,7 +971,8 @@ Phaser.Game.prototype = {
977971
// this.particles.update();
978972
// this.plugins.update();
979973

980-
this.stage.postUpdate();
974+
this.state.postUpdate();
975+
981976
this.plugins.postUpdate();
982977
}
983978
else
@@ -1012,16 +1007,17 @@ Phaser.Game.prototype = {
10121007
return;
10131008
}
10141009

1015-
this.state.preRender(elapsedTime);
1010+
// this.state.preRender(elapsedTime);
10161011

10171012
this.updates.start();
10181013

1019-
this.renderer.render(this.stage);
1014+
this.state.render(this.renderer);
10201015

1021-
// this.plugins.render(elapsedTime);
1022-
1023-
this.state.render(elapsedTime);
1016+
// Disabled while building out the new State Manager
1017+
// this.renderer.render();
10241018

1019+
// this.plugins.render(elapsedTime);
1020+
// this.state.render(elapsedTime);
10251021
// this.plugins.postRender(elapsedTime);
10261022

10271023
this.updates.stop();

src/core/State.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

src/loader/Loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2173,7 +2173,7 @@ Phaser.Loader.prototype = {
21732173

21742174
this.onLoadComplete.dispatch();
21752175

2176-
this.game.state.loadComplete();
2176+
// this.game.state.loadComplete();
21772177

21782178
this.reset();
21792179
},

src/renderer/webgl/WebGLRenderer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ Phaser.Renderer.WebGL.prototype = {
442442
* @method render
443443
* @param stage {Stage} the Stage element to be rendered
444444
*/
445-
render: function (stage)
445+
render: function (state)
446446
{
447447
// No point rendering if our context has been blown up!
448448
if (this.contextLost)
@@ -471,10 +471,13 @@ Phaser.Renderer.WebGL.prototype = {
471471

472472
this.batch.start();
473473

474-
stage.render(this, stage);
474+
this.game.state.renderChildren(this, state);
475475

476476
this.batch.stop();
477477

478+
// Call state.render here, so we can do some extra shizzle on the top
479+
// Maybe pass in the FBO texture too?
480+
478481
this.stateFBO.render(null);
479482

480483
this.endTime = Date.now();

0 commit comments

Comments
 (0)