Skip to content

Commit f6903df

Browse files
committed
Stage now extends Container.
1 parent 680ce51 commit f6903df

2 files changed

Lines changed: 32 additions & 26 deletions

File tree

src/gameobjects/stage/Stage.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Phaser.Stage = function (game) {
2020
*/
2121
this.game = game;
2222

23-
PIXI.DisplayObjectContainer.call(this);
23+
// PIXI.DisplayObjectContainer.call(this);
24+
Phaser.GameObject.Container.call(this, game);
2425

2526
/**
2627
* @property {string} name - The name of this object.
@@ -43,14 +44,14 @@ Phaser.Stage = function (game) {
4344
* @property {boolean} exists - If exists is true the Stage and all children are updated, otherwise it is skipped.
4445
* @default
4546
*/
46-
this.exists = true;
47+
// this.exists = true;
4748

4849
/**
4950
* @property {Phaser.Matrix} worldTransform - Current transform of the object based on world (parent) factors
5051
* @private
5152
* @readOnly
5253
*/
53-
this.worldTransform = new Phaser.Matrix();
54+
// this.worldTransform = new Phaser.Matrix();
5455

5556
/**
5657
* @property {Phaser.Stage} stage - The stage reference (the Stage is its own stage)
@@ -95,7 +96,8 @@ Phaser.Stage = function (game) {
9596

9697
};
9798

98-
Phaser.Stage.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
99+
// Phaser.Stage.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
100+
Phaser.Stage.prototype = Object.create(Phaser.GameObject.Container.prototype);
99101
Phaser.Stage.prototype.constructor = Phaser.Stage;
100102

101103
/**
@@ -143,12 +145,14 @@ Phaser.Stage.prototype.boot = function () {
143145
*/
144146
Phaser.Stage.prototype.preUpdate = function () {
145147

148+
this.transform.update();
149+
146150
this.currentRenderOrderID = 0;
147151

148152
// This can't loop in reverse, we need the renderOrderID to be in sequence
149-
for (var i = 0; i < this.children.length; i++)
153+
for (var i = 0; i < this.children.list.length; i++)
150154
{
151-
this.children[i].preUpdate();
155+
this.children.list[i].preUpdate();
152156
}
153157

154158
};
@@ -161,11 +165,11 @@ Phaser.Stage.prototype.preUpdate = function () {
161165
Phaser.Stage.prototype.update = function () {
162166

163167
// Goes in reverse, because it's highly likely the child will destroy itself in `update`
164-
var i = this.children.length;
168+
var i = this.children.list.length;
165169

166170
while (i--)
167171
{
168-
this.children[i].update();
172+
this.children.list[i].update();
169173
}
170174

171175
};
@@ -179,6 +183,7 @@ Phaser.Stage.prototype.update = function () {
179183
*/
180184
Phaser.Stage.prototype.postUpdate = function () {
181185

186+
/*
182187
// Apply the camera shake, fade, bounds, etc
183188
this.game.camera.update();
184189
@@ -191,13 +196,14 @@ Phaser.Stage.prototype.postUpdate = function () {
191196
192197
this.game.camera.updateTarget();
193198
}
199+
*/
194200

195-
for (var i = 0; i < this.children.length; i++)
201+
for (var i = 0; i < this.children.list.length; i++)
196202
{
197-
this.children[i].postUpdate();
203+
this.children.list[i].postUpdate();
198204
}
199205

200-
this.updateTransform();
206+
// this.updateTransform();
201207

202208
};
203209

@@ -209,12 +215,12 @@ Phaser.Stage.prototype.postUpdate = function () {
209215
*/
210216
Phaser.Stage.prototype.updateTransform = function () {
211217

212-
this.worldAlpha = 1;
218+
// this.worldAlpha = 1;
213219

214-
for (var i = 0; i < this.children.length; i++)
215-
{
216-
this.children[i].updateTransform();
217-
}
220+
// for (var i = 0; i < this.children.length; i++)
221+
// {
222+
// this.children[i].updateTransform();
223+
// }
218224

219225
};
220226

src/gameobjects/stage/StageCanvasRenderer.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ Phaser.Renderer.Canvas.GameObjects.Stage = {
1717
return;
1818
}
1919

20-
if (src._mask)
21-
{
22-
renderer.pushMask(src._mask);
23-
}
20+
// if (src._mask)
21+
// {
22+
// renderer.pushMask(src._mask);
23+
// }
2424

25-
for (var i = 0; i < src.children.length; i++)
25+
for (var i = 0; i < src.children.list.length; i++)
2626
{
27-
var child = src.children[i];
27+
var child = src.children.list[i];
2828

2929
child.render(renderer, child);
3030
}
3131

32-
if (src._mask)
33-
{
34-
renderer.popMask();
35-
}
32+
// if (src._mask)
33+
// {
34+
// renderer.popMask();
35+
// }
3636

3737
}
3838

0 commit comments

Comments
 (0)