Sitelet https://github.com/phaserjs/phaser-ce/commit/420564a42a311e894df22e6c85505ceb88b1b9a2
Skip to content

Commit 420564a

Browse files
committed
Built Phaser v2.10.2
1 parent f8e63d1 commit 420564a

219 files changed

Lines changed: 11437 additions & 7972 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.

‎build/custom/creature.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎build/custom/p2.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎build/custom/phaser-arcade-physics.js‎

Lines changed: 101 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.10.1 "2018-02-18" - Built: Sun Feb 18 2018 16:36:05
10+
* v2.10.2 "2018-03-15" - Built: Thu Mar 15 2018 17:35:14
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -121,12 +121,15 @@ PIXI.DisplayObject = function () {
121121

122122
/**
123123
* The visibility of this DisplayObject. A value of `false` makes the object invisible.
124-
* A value of `true` makes it visible. Please note that an object with a visible value of
125-
* `false` is skipped during the render pass. Equally a DisplayObject with visible false will
126-
* not render any of its children.
124+
* A value of `true` makes it visible.
125+
*
126+
* An object with a visible value of `false` is skipped during the render pass.
127+
* Equally a DisplayObject with visible `false` will not render any of its children.
127128
*
128129
* The value of this property does not reflect any visible values set further up the display list.
129-
* To obtain that value please see the `worldVisible` property.
130+
* To obtain that value please see the {@link #worldVisible} property.
131+
*
132+
* Objects that are not {@link #worldVisible} do not update their {@link #worldPosition}.
130133
*
131134
* @property {boolean} visible
132135
* @default
@@ -1460,7 +1463,7 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function (renderSession) {
14601463
/**
14611464
* The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
14621465
*
1463-
* @property width
1466+
* @name PIXI.DisplayObjectContainer#width
14641467
* @type Number
14651468
*/
14661469
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
@@ -1489,7 +1492,7 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
14891492
/**
14901493
* The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
14911494
*
1492-
* @property height
1495+
* @name PIXI.DisplayObjectContainer#height
14931496
* @type Number
14941497
*/
14951498
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
@@ -6776,6 +6779,11 @@ PIXI.CanvasRenderer = function (game, config) {
67766779
*/
67776780
this.context = this.view.getContext("2d", { alpha: this.transparent } );
67786781

6782+
if (!this.context)
6783+
{
6784+
throw new Error('Failed to create a Canvas 2d context.');
6785+
}
6786+
67796787
/**
67806788
* Boolean flag controlling canvas refresh.
67816789
*
@@ -7583,7 +7591,7 @@ var Phaser = Phaser || { // jshint ignore:line
75837591
* @constant Phaser.VERSION
75847592
* @type {string}
75857593
*/
7586-
VERSION: '2.10.1',
7594+
VERSION: '2.10.2',
75877595

75887596
/**
75897597
* An array of Phaser game instances.
@@ -16291,27 +16299,27 @@ Phaser.Signal.prototype = {
1629116299
*/
1629216300
dispatch: function () {
1629316301

16294-
if (!this.active || !this._bindings)
16302+
if (!this.active || (!this._bindings && !this.memorize))
1629516303
{
1629616304
return;
1629716305
}
1629816306

1629916307
var paramsArr = Array.prototype.slice.call(arguments);
16300-
var n = this._bindings.length;
16301-
var bindings;
1630216308

1630316309
if (this.memorize)
1630416310
{
1630516311
this._prevParams = paramsArr;
1630616312
}
1630716313

16314+
var n = this._bindings ? this._bindings.length : 0;
16315+
1630816316
if (!n)
1630916317
{
1631016318
// Should come after memorize
1631116319
return;
1631216320
}
1631316321

16314-
bindings = this._bindings.slice(); //clone array in case add/remove items during dispatch
16322+
var bindings = this._bindings.slice(); //clone array in case add/remove items during dispatch
1631516323
this._shouldPropagate = true; //in case `halt` was called before dispatch or during the previous dispatch.
1631616324

1631716325
//execute all callbacks until end of the list or until a callback returns `false` or stops propagation
@@ -17591,6 +17599,14 @@ Phaser.Stage.prototype.checkVisibility = function () {
1759117599
return _this.visibilityChange(event);
1759217600
};
1759317601

17602+
this._onChangePause = function () {
17603+
return this._onChange({ type: 'pause' });
17604+
};
17605+
17606+
this._onChangeResume = function () {
17607+
return this._onChange({ type: 'resume' });
17608+
};
17609+
1759417610
this._onClick = function (event) {
1759517611
if ((document.hasFocus !== undefined) && !document.hasFocus())
1759617612
{
@@ -17612,15 +17628,23 @@ Phaser.Stage.prototype.checkVisibility = function () {
1761217628

1761317629
window.addEventListener('click', this._onClick);
1761417630

17615-
if (this.game.device.cocoonJSApp)
17631+
if (this.game.device.cocoonJSApp && CocoonJS.App)
1761617632
{
17617-
CocoonJS.App.onSuspended.addEventListener(function () {
17618-
Phaser.Stage.prototype.visibilityChange.call(_this, { type: "pause" });
17619-
});
17633+
if (CocoonJS.App.onSuspended)
17634+
{
17635+
CocoonJS.App.onSuspended.addEventListener(this._onChangePause);
17636+
}
1762017637

17621-
CocoonJS.App.onActivated.addEventListener(function () {
17622-
Phaser.Stage.prototype.visibilityChange.call(_this, { type: "resume" });
17623-
});
17638+
if (CocoonJS.App.onActivated)
17639+
{
17640+
CocoonJS.App.onActivated.addEventListener(this._onChangeResume);
17641+
}
17642+
17643+
if (CocoonJS.App.on)
17644+
{
17645+
CocoonJS.App.on('activated', this._onChangeResume);
17646+
CocoonJS.App.on('suspended', this._onChangePause);
17647+
}
1762417648
}
1762517649

1762617650
};
@@ -21598,6 +21622,8 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
2159821622
* Clear the Canvas each frame before rendering the display list.
2159921623
* You can set this to `false` to gain some performance if your game always contains a background that completely fills the display.
2160021624
* This must be `true` to show any {@link Phaser.Stage#backgroundColor} set on the Stage.
21625+
* This is effectively **read-only after the game has booted**.
21626+
* Use the {@link GameConfig} setting `clearBeforeRender` when creating the game, or set `game.renderer.clearBeforeRender` afterwards.
2160121627
* @property {boolean} clearBeforeRender
2160221628
* @default
2160321629
*/
@@ -21957,6 +21983,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
2195721983
* @property {HTMLCanvasElement} [GameConfig.canvas] - An existing canvas to display the game in.
2195821984
* @property {string} [GameConfig.canvasId] - `id` attribute value to assign to the game canvas.
2195921985
* @property {string} [GameConfig.canvasStyle] - `style` attribute value to assign to the game canvas.
21986+
* @property {boolean} [GameConfig.clearBeforeRender=true] - Sets {@link Phaser.Game#clearBeforeRender}.
2196021987
* @property {boolean} [GameConfig.crisp=false] - Sets the canvas's `image-rendering` property to `pixelated` or `crisp-edges`. See {@link Phaser.Canvas.setImageRenderingCrisp}.
2196121988
* @property {boolean} [GameConfig.disableVisibilityChange=false] - Sets {@link Phaser.Stage#disableVisibilityChange}
2196221989
* @property {boolean} [GameConfig.disableStart=false] - Prevents the game loop from starting, allowing you to call updates manually. Helpful for automated testing.
@@ -22032,6 +22059,11 @@ Phaser.Game.prototype = {
2203222059
this.antialias = config['antialias'];
2203322060
}
2203422061

22062+
if (config['clearBeforeRender'] !== undefined)
22063+
{
22064+
this.clearBeforeRender = config['clearBeforeRender'];
22065+
}
22066+
2203522067
if (config['multiTexture'] !== undefined)
2203622068
{
2203722069
this.multiTexture = config['multiTexture'];
@@ -35317,9 +35349,9 @@ Phaser.GameObjectFactory.prototype = {
3531735349
* @param {...*} parameter - Additional parameters that will be passed to the Plugin.init method.
3531835350
* @return {Phaser.Plugin} The Plugin that was added to the manager.
3531935351
*/
35320-
plugin: function (plugin) {
35352+
plugin: function () {
3532135353

35322-
return this.game.plugins.add(plugin);
35354+
return this.game.plugins.add.apply(this.game.plugins, arguments);
3532335355

3532435356
}
3532535357

@@ -41295,6 +41327,10 @@ Phaser.GraphicsData.prototype.clone = function () {
4129541327
* As you can tell, Graphics objects are a bit of a trade-off. While they are extremely useful, you need to be careful
4129641328
* in their complexity and quantity of them in your game.
4129741329
*
41330+
* You may have to modify {@link Phaser.Graphics#scale} rather than {@link Phaser.Graphics#width} or
41331+
* {@link Phaser.Graphics#height} to avoid an unusual race condition
41332+
* ({@link #489 https://github.com/photonstorm/phaser-ce/issues/489}).
41333+
*
4129841334
* @class Phaser.Graphics
4129941335
* @constructor
4130041336
* @extends PIXI.DisplayObjectContainer
@@ -43319,6 +43355,13 @@ Phaser.Text = function (game, x, y, text, style) {
4331943355
text = text.toString();
4332043356
}
4332143357

43358+
/**
43359+
* @property {HTMLCanvasElement} canvas - The canvas element that the text is rendered.
43360+
*/
43361+
this.canvas = Phaser.CanvasPool.create(this);
43362+
43363+
Phaser.Sprite.call(this, game, x, y, PIXI.Texture.fromCanvas(this.canvas));
43364+
4332243365
/**
4332343366
* @property {number} type - The const type of this object.
4332443367
* @default
@@ -43346,11 +43389,6 @@ Phaser.Text = function (game, x, y, text, style) {
4334643389
*/
4334743390
this.textBounds = null;
4334843391

43349-
/**
43350-
* @property {HTMLCanvasElement} canvas - The canvas element that the text is rendered.
43351-
*/
43352-
this.canvas = Phaser.CanvasPool.create(this);
43353-
4335443392
/**
4335543393
* @property {HTMLCanvasElement} context - The context of the canvas element that the text is rendered to.
4335643394
*/
@@ -43459,8 +43497,6 @@ Phaser.Text = function (game, x, y, text, style) {
4345943497
*/
4346043498
this._height = 0;
4346143499

43462-
Phaser.Sprite.call(this, game, x, y, PIXI.Texture.fromCanvas(this.canvas));
43463-
4346443500
/**
4346543501
* @property {object} style
4346643502
* @private
@@ -66821,32 +66857,29 @@ Phaser.SoundManager.prototype = {
6682166857
}
6682266858
else
6682366859
{
66824-
if (!!window['AudioContext'])
66860+
var AudioContext = window.AudioContext || window.webkitAudioContext;
66861+
66862+
if (AudioContext)
6682566863
{
66826-
try {
66827-
this.context = new window['AudioContext']();
66828-
} catch (error) {
66829-
this.context = null;
66830-
this.usingWebAudio = false;
66831-
this.touchLocked = false;
66864+
try
66865+
{
66866+
this.context = new AudioContext();
6683266867
}
66833-
}
66834-
else if (!!window['webkitAudioContext'])
66835-
{
66836-
try {
66837-
this.context = new window['webkitAudioContext']();
66838-
} catch (error) {
66868+
catch (error)
66869+
{
6683966870
this.context = null;
6684066871
this.usingWebAudio = false;
6684166872
this.touchLocked = false;
66873+
66874+
console.warn(error);
6684266875
}
6684366876
}
6684466877
}
6684566878

6684666879
if (this.context === null)
6684766880
{
6684866881
// No Web Audio support - how about legacy Audio?
66849-
if (window['Audio'] === undefined)
66882+
if (window.Audio === undefined)
6685066883
{
6685166884
this.noAudio = true;
6685266885
return;
@@ -66871,6 +66904,13 @@ Phaser.SoundManager.prototype = {
6687166904

6687266905
this.masterGain.gain.value = 1;
6687366906
this.masterGain.connect(this.context.destination);
66907+
66908+
// A suspended context is actually normal (momentarily) in Firefox.
66909+
// In that case the input handler will do nothing, which is fine.
66910+
if (this.context.state === 'suspended')
66911+
{
66912+
this.game.input.onUp.addOnce(this.resumeWebAudio, this);
66913+
}
6687466914
}
6687566915

6687666916
if (!this.noAudio)
@@ -66922,6 +66962,22 @@ Phaser.SoundManager.prototype = {
6692266962

6692366963
},
6692466964

66965+
/**
66966+
* Try to resume a suspended WebAudio context.
66967+
*
66968+
* If the context isn't suspended, or if WebAudio isn't in use, nothing is done.
66969+
*
66970+
* @return {?Promise} - A Promise, if resume was called. See {@link https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/resume}.
66971+
*/
66972+
resumeWebAudio: function () {
66973+
66974+
if (this.usingWebAudio && this.context.state === 'suspended')
66975+
{
66976+
return this.context.resume();
66977+
}
66978+
66979+
},
66980+
6692566981
/**
6692666982
* Enables the audio, usually after the first touch.
6692766983
*
@@ -66959,10 +67015,8 @@ Phaser.SoundManager.prototype = {
6695967015
this._unlockSource.start(0);
6696067016
}
6696167017

66962-
//This fixes locked audio in Chrome > 55 cross origin iframes
66963-
if (this._unlockSource.context.state === 'suspended') {
66964-
this._unlockSource.context.resume();
66965-
}
67018+
// This fixes locked audio in Chrome > 55 cross origin iframes?
67019+
this.resumeWebAudio();
6696667020
}
6696767021

6696867022
// We can remove the event because we've done what we needed (started the unlock sound playing)
@@ -67139,6 +67193,7 @@ Phaser.SoundManager.prototype = {
6713967193
if (this.touchLocked && this._unlockSource !== null && (this._unlockSource.playbackState === this._unlockSource.PLAYING_STATE || this._unlockSource.playbackState === this._unlockSource.FINISHED_STATE))
6714067194
{
6714167195
this.setTouchUnlock();
67196+
this.resumeWebAudio();
6714267197
}
6714367198

6714467199
for (var i = 0; i < this._sounds.length; i++)

‎build/custom/phaser-arcade-physics.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎build/custom/phaser-arcade-physics.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)