Skip to content

Commit efebd79

Browse files
committed
Added State.pause.
1 parent f2cb384 commit efebd79

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

src/renderer/webgl/QuadFBO.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Phaser.Renderer.WebGL.QuadFBO = function (renderer, x, y, width, height)
4848
this.aVertexPosition;
4949
this.aTextureCoord;
5050

51+
this._normal;
52+
this._twirl;
53+
5154
this.init();
5255
};
5356

@@ -178,8 +181,10 @@ Phaser.Renderer.WebGL.QuadFBO.prototype = {
178181
];
179182

180183
// This compiles, attaches and links the shader
181-
this.program = this.renderer.compileProgram(vertexSrc, fragmentSrc);
182-
// this.program = this.renderer.compileProgram(vertexSrc, twirlFragmentSrc);
184+
this._normal = this.renderer.compileProgram(vertexSrc, fragmentSrc);
185+
this._twirl = this.renderer.compileProgram(vertexSrc, twirlFragmentSrc);
186+
187+
this.program = this._normal;
183188

184189
this.aVertexPosition = gl.getAttribLocation(this.program, 'aVertexPosition');
185190
this.aTextureCoord = gl.getAttribLocation(this.program, 'aTextureCoord');

src/states/StateManager.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,26 +413,32 @@ Phaser.StateManager.prototype = {
413413

414414
var i = this.getStateIndex(state);
415415

416-
console.log('startCreate', i);
417-
console.log(state);
418-
419416
this.active.push({ index: i, state: state });
420417

421418
// Sort the 'active' array based on the index property
422-
423-
// FIX: Cannot sort because it contains objects?
424419
this.active.sort(this.sortStates.bind(this));
425420

426421
this.game.updates.running = true;
427422
},
428423

429-
sortStates: function (stateA, stateB)
424+
pause: function (key)
430425
{
431-
// var indexA = this.getActiveStateIndex(stateA.state);
432-
// var indexB = this.getActiveStateIndex(stateB);
426+
var index = this.getActiveStateIndex(key);
427+
428+
if (index > -1)
429+
{
430+
var state = this.getState(key);
431+
432+
state.settings.active = false;
433433

434-
console.log('sorting states', stateA, stateB);
434+
this.active.splice(index, 1);
435435

436+
this.active.sort(this.sortStates.bind(this));
437+
}
438+
},
439+
440+
sortStates: function (stateA, stateB)
441+
{
436442
// Sort descending
437443
if (stateA.index < stateB.index)
438444
{

0 commit comments

Comments
 (0)