Skip to content

Commit d804e05

Browse files
committed
Renaming from State to Scene internally.
This is one monster update.
1 parent 8bae761 commit d804e05

140 files changed

Lines changed: 940 additions & 942 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

v3/src/animation/manager/AnimationManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var Map = require('../../structs/Map');
1515
*
1616
* Sprites and other Game Objects get the data they need from the AnimationManager.
1717
*
18-
* Access it via `state.anims`.
18+
* Access it via `scene.anims`.
1919
*
2020
* @class Phaser.AnimationManager
2121
* @constructor

v3/src/boot/Config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var Config = new Class({
4141
this.canvas = GetValue(config, 'canvas', null);
4242
this.canvasStyle = GetValue(config, 'canvasStyle', null);
4343

44-
this.stateConfig = GetValue(config, 'state', null);
44+
this.sceneConfig = GetValue(config, 'scene', null);
4545

4646
this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]);
4747

v3/src/boot/Game.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var CreateRenderer = require('./CreateRenderer');
1414
var Data = require('../plugins/Data');
1515
var GlobalCache = require('../cache/GlobalCache');
1616
var GlobalInputManager = require('../input/GlobalInputManager');
17-
var GlobalStateManager = require('../state/GlobalStateManager');
17+
var GlobalSceneManager = require('../scene/GlobalSceneManager');
1818
var TextureManager = require('../textures/TextureManager');
1919
var TimeStep = require('./TimeStep');
2020

@@ -64,9 +64,9 @@ var Game = new Class({
6464
this.input = new GlobalInputManager(this, this.config);
6565

6666
/**
67-
* @property {Phaser.GlobalStateManager} state - The StateManager. Phaser instance specific.
67+
* @property {Phaser.GlobalSceneManager} scene - The SceneManager. Phaser instance specific.
6868
*/
69-
this.state = new GlobalStateManager(this, this.config.stateConfig);
69+
this.scene = new GlobalSceneManager(this, this.config.sceneConfig);
7070

7171
/**
7272
* @property {Phaser.Device} device - Contains device information and capabilities (singleton)
@@ -100,7 +100,7 @@ var Game = new Class({
100100

101101
this.anims.boot(this.textures);
102102

103-
this.state.boot();
103+
this.scene.boot();
104104

105105
this.input.boot();
106106

@@ -120,18 +120,18 @@ var Game = new Class({
120120

121121
step: function (time, delta)
122122
{
123-
var active = this.state.active;
123+
var active = this.scene.active;
124124
var renderer = this.renderer;
125125

126126
// Global Managers (Time, Input, etc)
127127

128128
this.input.update(time, delta);
129129

130-
// States
130+
// Scenes
131131

132132
for (var i = 0; i < active.length; i++)
133133
{
134-
active[i].state.sys.step(time, delta);
134+
active[i].scene.sys.step(time, delta);
135135
}
136136

137137
// Render
@@ -140,10 +140,10 @@ var Game = new Class({
140140

141141
renderer.preRender();
142142

143-
// This uses active.length, in case state.update removed the state from the active list
143+
// This uses active.length, in case scene.update removed the scene from the active list
144144
for (i = 0; i < active.length; i++)
145145
{
146-
active[i].state.sys.render(0, renderer);
146+
active[i].scene.sys.render(0, renderer);
147147
}
148148

149149
renderer.postRender();
@@ -153,23 +153,23 @@ var Game = new Class({
153153
{
154154
this.loop.pause();
155155

156-
// var active = this.state.active;
156+
// var active = this.scene.active;
157157

158158
// for (var i = 0; i < active.length; i++)
159159
// {
160-
// active[i].state.sys.pause();
160+
// active[i].scene.sys.pause();
161161
// }
162162
},
163163

164164
onVisible: function ()
165165
{
166166
this.loop.resume();
167167

168-
// var active = this.state.active;
168+
// var active = this.scene.active;
169169

170170
// for (var i = 0; i < active.length; i++)
171171
// {
172-
// active[i].state.sys.resume();
172+
// active[i].scene.sys.resume();
173173
// }
174174
},
175175

v3/src/camera/Camera.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ var Camera = new Class({
171171
return this;
172172
},
173173

174-
setState: function (state)
174+
setScene: function (scene)
175175
{
176-
this.state = state;
176+
this.scene = scene;
177177

178178
return this;
179179
},
@@ -477,7 +477,7 @@ var Camera = new Class({
477477

478478
destroy: function ()
479479
{
480-
this.state = undefined;
480+
this.scene = undefined;
481481
}
482482

483483
});

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '8d1f7160-682b-11e7-b9b9-afea77e03fb0'
2+
build: 'de3f9290-689a-11e7-813e-ffb54ad43616'
33
};
44
module.exports = CHECKSUM;

v3/src/gameobjects/BuildGameObject.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var GetAdvancedValue = require('../utils/object/GetAdvancedValue');
22
var ScaleModes = require('../renderer/ScaleModes');
33
var BlendModes = require('../renderer/BlendModes');
44

5-
var BuildGameObject = function (state, gameObject, config)
5+
var BuildGameObject = function (scene, gameObject, config)
66
{
77
// Position
88

@@ -89,13 +89,13 @@ var BuildGameObject = function (state, gameObject, config)
8989

9090
gameObject.visible = GetAdvancedValue(config, 'visible', true);
9191

92-
// Add to State
92+
// Add to Scene
9393

9494
var add = GetAdvancedValue(config, 'add', true);
9595

9696
if (add)
9797
{
98-
state.children.add(gameObject);
98+
scene.sys.displayList.add(gameObject);
9999
}
100100

101101
return gameObject;

v3/src/gameobjects/GameObject.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ var GameObject = new Class({
1717

1818
initialize:
1919

20-
function GameObject (state, type)
20+
function GameObject (scene, type)
2121
{
22-
this.state = state;
22+
this.scene = scene;
2323

2424
this.type = type;
2525

@@ -39,8 +39,8 @@ var GameObject = new Class({
3939
this.hitArea = null;
4040
this.hitAreaCallback = null;
4141

42-
// Trigger a state z-depth sort
43-
this.state.sys.sortChildrenFlag = true;
42+
// Trigger a scene z-depth sort
43+
this.scene.sys.sortChildrenFlag = true;
4444
},
4545

4646
// For GameObject Pooling and item selection
@@ -58,7 +58,7 @@ var GameObject = new Class({
5858

5959
setHitArea: function (shape, callback)
6060
{
61-
this.state.sys.inputManager.setHitArea(this, shape, callback);
61+
this.scene.sys.inputManager.setHitArea(this, shape, callback);
6262

6363
return this;
6464
},
@@ -73,7 +73,7 @@ var GameObject = new Class({
7373
{
7474
this.parent.remove(this);
7575

76-
this.state = undefined;
76+
this.scene = undefined;
7777
}
7878

7979
});

v3/src/gameobjects/bitmaptext/ParseFromAtlas.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
var ParseXMLBitmapFont = require('./ParseXMLBitmapFont');
22

3-
var ParseFromAtlas = function (state, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing)
3+
var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing)
44
{
5-
var frame = state.sys.textures.getFrame(textureKey, frameKey);
6-
var xml = state.sys.cache.xml.get(xmlKey);
5+
var frame = scene.sys.textures.getFrame(textureKey, frameKey);
6+
var xml = scene.sys.cache.xml.get(xmlKey);
77

88
if (frame && xml)
99
{
1010
var data = ParseXMLBitmapFont(xml, xSpacing, ySpacing, frame);
1111

12-
state.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey });
12+
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey });
1313

1414
return true;
1515
}

v3/src/gameobjects/bitmaptext/ParseRetroFont.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var GetValue = require('../../utils/object/GetValue');
1111
// Phaser.GameObject.RetroFont = function (game, key, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset)
1212

1313
// {
14-
// image: key,
14+
// image: key,
1515
// width: 32,
1616
// height: 32,
1717
// chars: 'string',
@@ -20,7 +20,7 @@ var GetValue = require('../../utils/object/GetValue');
2020
// offset: { x: 0, y: 0 }
2121
// }
2222

23-
var ParseRetroFont = function (state, config)
23+
var ParseRetroFont = function (scene, config)
2424
{
2525
var w = config.width;
2626
var h = config.height;
@@ -38,7 +38,7 @@ var ParseRetroFont = function (state, config)
3838

3939
if (charsPerRow === null)
4040
{
41-
charsPerRow = state.sys.textures.getFrame(key).width / w;
41+
charsPerRow = scene.sys.textures.getFrame(key).width / w;
4242

4343
if (charsPerRow > letters.length)
4444
{

v3/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ var DynamicBitmapText = new Class({
2222

2323
initialize:
2424

25-
function DynamicBitmapText (state, x, y, font, text, size, align)
25+
function DynamicBitmapText (scene, x, y, font, text, size, align)
2626
{
2727
if (text === undefined) { text = ''; }
2828
if (align === undefined) { align = 'left'; }
2929

30-
GameObject.call(this, state, 'DynamicBitmapText');
30+
GameObject.call(this, scene, 'DynamicBitmapText');
3131

32-
this.fontData = this.state.sys.cache.bitmapFont.get(font);
32+
this.fontData = this.scene.sys.cache.bitmapFont.get(font);
3333

3434
this.text = (Array.isArray(text)) ? text.join('\n') : text;
3535

0 commit comments

Comments
 (0)