phaser-rails 2.4.2.0 → 2.4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phaser/rails/version.rb +1 -1
- data/vendor/assets/javascripts/phaser.js +1298 -477
- data/vendor/assets/javascripts/phaser.map +1 -1
- data/vendor/assets/javascripts/phaser.min.js +22 -21
- metadata +3 -3
@@ -7,7 +7,7 @@
|
|
7
7
|
*
|
8
8
|
* Phaser - http://phaser.io
|
9
9
|
*
|
10
|
-
* v2.4.
|
10
|
+
* v2.4.3 "Coramen" - Built: Mon Aug 24 2015 13:54:08
|
11
11
|
*
|
12
12
|
* By Richard Davey http://www.photonstorm.com @photonstorm
|
13
13
|
*
|
@@ -14090,8 +14090,13 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', {
|
|
14090
14090
|
|
14091
14091
|
/**
|
14092
14092
|
* Sets the filters for the displayObject.
|
14093
|
-
*
|
14094
|
-
*
|
14093
|
+
* IMPORTANT: This is a webGL only feature and will be ignored by the Canvas renderer.
|
14094
|
+
*
|
14095
|
+
* To remove filters simply set this property to 'null'.
|
14096
|
+
*
|
14097
|
+
* You cannot have a filter and a multiply blend mode active at the same time. Setting a filter will reset
|
14098
|
+
* this objects blend mode to NORMAL.
|
14099
|
+
*
|
14095
14100
|
* @property filters
|
14096
14101
|
* @type Array(Filter)
|
14097
14102
|
*/
|
@@ -14123,6 +14128,11 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', {
|
|
14123
14128
|
}
|
14124
14129
|
|
14125
14130
|
this._filters = value;
|
14131
|
+
|
14132
|
+
if (this.blendMode && this.blendMode === PIXI.blendModes.MULTIPLY)
|
14133
|
+
{
|
14134
|
+
this.blendMode = PIXI.blendModes.NORMAL;
|
14135
|
+
}
|
14126
14136
|
}
|
14127
14137
|
});
|
14128
14138
|
|
@@ -14141,7 +14151,10 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', {
|
|
14141
14151
|
|
14142
14152
|
set: function(value) {
|
14143
14153
|
|
14144
|
-
if (this._cacheAsBitmap === value)
|
14154
|
+
if (this._cacheAsBitmap === value)
|
14155
|
+
{
|
14156
|
+
return;
|
14157
|
+
}
|
14145
14158
|
|
14146
14159
|
if (value)
|
14147
14160
|
{
|
@@ -14154,6 +14167,7 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', {
|
|
14154
14167
|
|
14155
14168
|
this._cacheAsBitmap = value;
|
14156
14169
|
}
|
14170
|
+
|
14157
14171
|
});
|
14158
14172
|
|
14159
14173
|
/*
|
@@ -14411,29 +14425,29 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()
|
|
14411
14425
|
|
14412
14426
|
var bounds = this.getLocalBounds();
|
14413
14427
|
|
14428
|
+
this.updateTransform();
|
14429
|
+
|
14414
14430
|
if (!this._cachedSprite)
|
14415
14431
|
{
|
14416
|
-
var renderTexture = new PIXI.RenderTexture(bounds.width |
|
14417
|
-
|
14432
|
+
var renderTexture = new PIXI.RenderTexture(bounds.width | 1, bounds.height | 1);
|
14418
14433
|
this._cachedSprite = new PIXI.Sprite(renderTexture);
|
14419
14434
|
this._cachedSprite.worldTransform = this.worldTransform;
|
14420
14435
|
}
|
14421
14436
|
else
|
14422
14437
|
{
|
14423
|
-
this._cachedSprite.texture.resize(bounds.width |
|
14438
|
+
this._cachedSprite.texture.resize(bounds.width | 1, bounds.height | 1);
|
14424
14439
|
}
|
14425
14440
|
|
14426
|
-
//
|
14441
|
+
// Remove filters
|
14427
14442
|
var tempFilters = this._filters;
|
14428
14443
|
this._filters = null;
|
14429
|
-
|
14430
14444
|
this._cachedSprite.filters = tempFilters;
|
14431
14445
|
|
14446
|
+
// PIXI.DisplayObject._tempMatrix.identity();
|
14432
14447
|
PIXI.DisplayObject._tempMatrix.tx = -bounds.x;
|
14433
14448
|
PIXI.DisplayObject._tempMatrix.ty = -bounds.y;
|
14434
|
-
|
14435
|
-
this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true);
|
14436
14449
|
|
14450
|
+
this._cachedSprite.texture.render(this, PIXI.DisplayObject._tempMatrix, true);
|
14437
14451
|
this._cachedSprite.anchor.x = -( bounds.x / bounds.width );
|
14438
14452
|
this._cachedSprite.anchor.y = -( bounds.y / bounds.height );
|
14439
14453
|
|
@@ -15123,6 +15137,8 @@ PIXI.Sprite = function(texture)
|
|
15123
15137
|
/**
|
15124
15138
|
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
|
15125
15139
|
*
|
15140
|
+
* Warning: You cannot have a blend mode and a filter active on the same Sprite. Doing so will render the sprite invisible.
|
15141
|
+
*
|
15126
15142
|
* @property blendMode
|
15127
15143
|
* @type Number
|
15128
15144
|
* @default PIXI.blendModes.NORMAL;
|
@@ -15190,13 +15206,20 @@ Object.defineProperty(PIXI.Sprite.prototype, 'height', {
|
|
15190
15206
|
});
|
15191
15207
|
|
15192
15208
|
/**
|
15193
|
-
* Sets the texture of the sprite
|
15209
|
+
* Sets the texture of the sprite. Be warned that this doesn't remove or destroy the previous
|
15210
|
+
* texture this Sprite was using.
|
15194
15211
|
*
|
15195
15212
|
* @method setTexture
|
15196
15213
|
* @param texture {Texture} The PIXI texture that is displayed by the sprite
|
15214
|
+
* @param [destroy=false] {boolean} Call Texture.destroy on the current texture before replacing it with the new one?
|
15197
15215
|
*/
|
15198
|
-
PIXI.Sprite.prototype.setTexture = function(texture)
|
15216
|
+
PIXI.Sprite.prototype.setTexture = function(texture, destroyBase)
|
15199
15217
|
{
|
15218
|
+
if (destroyBase !== undefined)
|
15219
|
+
{
|
15220
|
+
this.texture.baseTexture.destroy();
|
15221
|
+
}
|
15222
|
+
|
15200
15223
|
this.texture = texture;
|
15201
15224
|
this.texture.valid = true;
|
15202
15225
|
};
|
@@ -15437,8 +15460,8 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession, matrix)
|
|
15437
15460
|
if (renderSession.roundPixels)
|
15438
15461
|
{
|
15439
15462
|
renderSession.context.setTransform(wt.a, wt.b, wt.c, wt.d, (wt.tx * renderSession.resolution) | 0, (wt.ty * renderSession.resolution) | 0);
|
15440
|
-
dx
|
15441
|
-
dy
|
15463
|
+
dx |= 0;
|
15464
|
+
dy |= 0;
|
15442
15465
|
}
|
15443
15466
|
else
|
15444
15467
|
{
|
@@ -15818,9 +15841,7 @@ PIXI.canUseNewCanvasBlendModes = function()
|
|
15818
15841
|
var yellow = new Image();
|
15819
15842
|
yellow.src = pngHead + '/wCKxvRF' + pngEnd;
|
15820
15843
|
|
15821
|
-
var canvas =
|
15822
|
-
canvas.width = 6;
|
15823
|
-
canvas.height = 1;
|
15844
|
+
var canvas = PIXI.CanvasPool.create(this, 6, 1);
|
15824
15845
|
var context = canvas.getContext('2d');
|
15825
15846
|
context.globalCompositeOperation = 'multiply';
|
15826
15847
|
context.drawImage(magenta, 0, 0);
|
@@ -15833,7 +15854,10 @@ PIXI.canUseNewCanvasBlendModes = function()
|
|
15833
15854
|
|
15834
15855
|
var data = context.getImageData(2,0,1,1).data;
|
15835
15856
|
|
15857
|
+
PIXI.CanvasPool.remove(this);
|
15858
|
+
|
15836
15859
|
return (data[0] === 255 && data[1] === 0 && data[2] === 0);
|
15860
|
+
|
15837
15861
|
};
|
15838
15862
|
|
15839
15863
|
/**
|
@@ -16038,6 +16062,151 @@ PIXI.PolyK._convex = function(ax, ay, bx, by, cx, cy, sign)
|
|
16038
16062
|
return ((ay-by)*(cx-bx) + (bx-ax)*(cy-by) >= 0) === sign;
|
16039
16063
|
};
|
16040
16064
|
|
16065
|
+
/**
|
16066
|
+
* @author Richard Davey <rich@photonstorm.com>
|
16067
|
+
* @copyright 2015 Photon Storm Ltd.
|
16068
|
+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
16069
|
+
*/
|
16070
|
+
|
16071
|
+
/**
|
16072
|
+
* The CanvasPool is a global static object that allows Pixi and Phaser to pool
|
16073
|
+
*
|
16074
|
+
* @class PIXI.CanvasPool
|
16075
|
+
* @static
|
16076
|
+
*/
|
16077
|
+
PIXI.CanvasPool = {
|
16078
|
+
|
16079
|
+
/**
|
16080
|
+
*
|
16081
|
+
*
|
16082
|
+
* @method PIXI.CanvasPool.create
|
16083
|
+
* @static
|
16084
|
+
* @param {any} parent - The parent of the canvas element.
|
16085
|
+
* @param {number} width - The width of the canvas element.
|
16086
|
+
* @param {number} height - The height of the canvas element.
|
16087
|
+
* @return {HTMLCanvasElement} The canvas element.
|
16088
|
+
*/
|
16089
|
+
create: function (parent, width, height) {
|
16090
|
+
|
16091
|
+
var idx = PIXI.CanvasPool.getFirst();
|
16092
|
+
var canvas;
|
16093
|
+
|
16094
|
+
if (idx === -1)
|
16095
|
+
{
|
16096
|
+
var container = {
|
16097
|
+
parent: parent,
|
16098
|
+
canvas: document.createElement('canvas')
|
16099
|
+
}
|
16100
|
+
|
16101
|
+
PIXI.CanvasPool.pool.push(container);
|
16102
|
+
|
16103
|
+
canvas = container.canvas;
|
16104
|
+
|
16105
|
+
// console.log('CanvasPool created', PIXI.CanvasPool.pool.length);
|
16106
|
+
}
|
16107
|
+
else
|
16108
|
+
{
|
16109
|
+
PIXI.CanvasPool.pool[idx].parent = parent;
|
16110
|
+
|
16111
|
+
canvas = PIXI.CanvasPool.pool[idx].canvas;
|
16112
|
+
|
16113
|
+
// console.log('CanvasPool recycled', idx);
|
16114
|
+
}
|
16115
|
+
|
16116
|
+
if (width !== undefined)
|
16117
|
+
{
|
16118
|
+
canvas.width = width;
|
16119
|
+
canvas.height = height;
|
16120
|
+
}
|
16121
|
+
|
16122
|
+
return canvas;
|
16123
|
+
|
16124
|
+
},
|
16125
|
+
|
16126
|
+
getFirst: function () {
|
16127
|
+
|
16128
|
+
var pool = PIXI.CanvasPool.pool;
|
16129
|
+
|
16130
|
+
for (var i = 0; i < pool.length; i++)
|
16131
|
+
{
|
16132
|
+
if (pool[i].parent === null)
|
16133
|
+
{
|
16134
|
+
return i;
|
16135
|
+
}
|
16136
|
+
}
|
16137
|
+
|
16138
|
+
return -1;
|
16139
|
+
|
16140
|
+
},
|
16141
|
+
|
16142
|
+
remove: function (parent) {
|
16143
|
+
|
16144
|
+
var pool = PIXI.CanvasPool.pool;
|
16145
|
+
|
16146
|
+
for (var i = 0; i < pool.length; i++)
|
16147
|
+
{
|
16148
|
+
if (pool[i].parent === parent)
|
16149
|
+
{
|
16150
|
+
pool[i].parent = null;
|
16151
|
+
|
16152
|
+
// console.log('CanvasPool removed', i);
|
16153
|
+
}
|
16154
|
+
}
|
16155
|
+
|
16156
|
+
},
|
16157
|
+
|
16158
|
+
removeByCanvas: function (canvas) {
|
16159
|
+
|
16160
|
+
var pool = PIXI.CanvasPool.pool;
|
16161
|
+
|
16162
|
+
for (var i = 0; i < pool.length; i++)
|
16163
|
+
{
|
16164
|
+
if (pool[i].canvas === canvas)
|
16165
|
+
{
|
16166
|
+
pool[i].parent = null;
|
16167
|
+
}
|
16168
|
+
}
|
16169
|
+
|
16170
|
+
},
|
16171
|
+
|
16172
|
+
getTotal: function () {
|
16173
|
+
|
16174
|
+
var pool = PIXI.CanvasPool.pool;
|
16175
|
+
var c = 0;
|
16176
|
+
|
16177
|
+
for (var i = 0; i < pool.length; i++)
|
16178
|
+
{
|
16179
|
+
if (pool[i].parent !== null)
|
16180
|
+
{
|
16181
|
+
c++;
|
16182
|
+
}
|
16183
|
+
}
|
16184
|
+
|
16185
|
+
return c;
|
16186
|
+
|
16187
|
+
},
|
16188
|
+
|
16189
|
+
getFree: function () {
|
16190
|
+
|
16191
|
+
var pool = PIXI.CanvasPool.pool;
|
16192
|
+
var c = 0;
|
16193
|
+
|
16194
|
+
for (var i = 0; i < pool.length; i++)
|
16195
|
+
{
|
16196
|
+
if (pool[i].parent === null)
|
16197
|
+
{
|
16198
|
+
c++;
|
16199
|
+
}
|
16200
|
+
}
|
16201
|
+
|
16202
|
+
return c;
|
16203
|
+
|
16204
|
+
}
|
16205
|
+
|
16206
|
+
};
|
16207
|
+
|
16208
|
+
PIXI.CanvasPool.pool = [];
|
16209
|
+
|
16041
16210
|
/**
|
16042
16211
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
16043
16212
|
*/
|
@@ -18071,8 +18240,8 @@ PIXI.WebGLRenderer = function(width, height, options)
|
|
18071
18240
|
this._contextOptions = {
|
18072
18241
|
alpha: this.transparent,
|
18073
18242
|
antialias: options.antialias, // SPEED UP??
|
18074
|
-
premultipliedAlpha:this.transparent && this.transparent !== 'notMultiplied',
|
18075
|
-
stencil:true,
|
18243
|
+
premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied',
|
18244
|
+
stencil: true,
|
18076
18245
|
preserveDrawingBuffer: options.preserveDrawingBuffer
|
18077
18246
|
};
|
18078
18247
|
|
@@ -18387,6 +18556,8 @@ PIXI.WebGLRenderer.prototype.destroy = function()
|
|
18387
18556
|
this.gl = null;
|
18388
18557
|
this.renderSession = null;
|
18389
18558
|
|
18559
|
+
PIXI.CanvasPool.remove(this);
|
18560
|
+
|
18390
18561
|
PIXI.instances[this.glContextId] = null;
|
18391
18562
|
|
18392
18563
|
PIXI.WebGLRenderer.glContextId--;
|
@@ -20708,7 +20879,7 @@ PIXI.CanvasBuffer = function(width, height)
|
|
20708
20879
|
* @property canvas
|
20709
20880
|
* @type HTMLCanvasElement
|
20710
20881
|
*/
|
20711
|
-
this.canvas =
|
20882
|
+
this.canvas = PIXI.CanvasPool.create(this, this.width, this.height);
|
20712
20883
|
|
20713
20884
|
/**
|
20714
20885
|
* A CanvasRenderingContext2D object representing a two-dimensional rendering context.
|
@@ -20749,6 +20920,16 @@ PIXI.CanvasBuffer.prototype.resize = function(width, height)
|
|
20749
20920
|
this.height = this.canvas.height = height;
|
20750
20921
|
};
|
20751
20922
|
|
20923
|
+
/**
|
20924
|
+
* Frees the canvas up for use again.
|
20925
|
+
*
|
20926
|
+
* @method destroy
|
20927
|
+
*/
|
20928
|
+
PIXI.CanvasBuffer.prototype.destroy = function()
|
20929
|
+
{
|
20930
|
+
PIXI.CanvasPool.remove(this);
|
20931
|
+
};
|
20932
|
+
|
20752
20933
|
/**
|
20753
20934
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
20754
20935
|
*/
|
@@ -20831,7 +21012,7 @@ PIXI.CanvasTinter = function() {};
|
|
20831
21012
|
*/
|
20832
21013
|
PIXI.CanvasTinter.getTintedTexture = function(sprite, color)
|
20833
21014
|
{
|
20834
|
-
var canvas = sprite.tintedTexture ||
|
21015
|
+
var canvas = sprite.tintedTexture || PIXI.CanvasPool.create(this);
|
20835
21016
|
|
20836
21017
|
PIXI.CanvasTinter.tintMethod(sprite.texture, color, canvas);
|
20837
21018
|
|
@@ -21089,14 +21270,14 @@ PIXI.CanvasRenderer = function(width, height, options)
|
|
21089
21270
|
* @property view
|
21090
21271
|
* @type HTMLCanvasElement
|
21091
21272
|
*/
|
21092
|
-
this.view = options.view ||
|
21273
|
+
this.view = options.view || PIXI.CanvasPool.create(this, this.width, this.height);
|
21093
21274
|
|
21094
21275
|
/**
|
21095
21276
|
* The canvas 2d context that everything is drawn with
|
21096
21277
|
* @property context
|
21097
21278
|
* @type CanvasRenderingContext2D
|
21098
21279
|
*/
|
21099
|
-
this.context = this.view.getContext(
|
21280
|
+
this.context = this.view.getContext("2d", { alpha: this.transparent } );
|
21100
21281
|
|
21101
21282
|
/**
|
21102
21283
|
* Boolean flag controlling canvas refresh.
|
@@ -21841,6 +22022,8 @@ PIXI.BaseTexture.prototype.destroy = function()
|
|
21841
22022
|
}
|
21842
22023
|
else if (this.source && this.source._pixiId)
|
21843
22024
|
{
|
22025
|
+
PIXI.CanvasPool.removeByCanvas(this.source);
|
22026
|
+
|
21844
22027
|
delete PIXI.BaseTextureCache[this.source._pixiId];
|
21845
22028
|
}
|
21846
22029
|
|
@@ -21924,7 +22107,7 @@ PIXI.BaseTexture.fromImage = function(imageUrl, crossorigin, scaleMode)
|
|
21924
22107
|
{
|
21925
22108
|
// new Image() breaks tex loading in some versions of Chrome.
|
21926
22109
|
// See https://code.google.com/p/chromium/issues/detail?id=238071
|
21927
|
-
var image = new Image()
|
22110
|
+
var image = new Image();
|
21928
22111
|
|
21929
22112
|
if (crossorigin)
|
21930
22113
|
{
|
@@ -21957,7 +22140,7 @@ PIXI.BaseTexture.fromImage = function(imageUrl, crossorigin, scaleMode)
|
|
21957
22140
|
*/
|
21958
22141
|
PIXI.BaseTexture.fromCanvas = function(canvas, scaleMode)
|
21959
22142
|
{
|
21960
|
-
if(!canvas._pixiId)
|
22143
|
+
if (!canvas._pixiId)
|
21961
22144
|
{
|
21962
22145
|
canvas._pixiId = 'canvas_' + PIXI.TextureCacheIdGenerator++;
|
21963
22146
|
}
|
@@ -21974,7 +22157,7 @@ PIXI.BaseTexture.fromCanvas = function(canvas, scaleMode)
|
|
21974
22157
|
|
21975
22158
|
var baseTexture = PIXI.BaseTextureCache[canvas._pixiId];
|
21976
22159
|
|
21977
|
-
if(!baseTexture)
|
22160
|
+
if (!baseTexture)
|
21978
22161
|
{
|
21979
22162
|
baseTexture = new PIXI.BaseTexture(canvas, scaleMode);
|
21980
22163
|
PIXI.BaseTextureCache[canvas._pixiId] = baseTexture;
|
@@ -22290,7 +22473,6 @@ PIXI.Texture.fromCanvas = function(canvas, scaleMode)
|
|
22290
22473
|
var baseTexture = PIXI.BaseTexture.fromCanvas(canvas, scaleMode);
|
22291
22474
|
|
22292
22475
|
return new PIXI.Texture(baseTexture);
|
22293
|
-
|
22294
22476
|
};
|
22295
22477
|
|
22296
22478
|
/**
|
@@ -22602,6 +22784,16 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, matrix, clea
|
|
22602
22784
|
return;
|
22603
22785
|
}
|
22604
22786
|
|
22787
|
+
// Let's create a nice matrix to apply to our display object.
|
22788
|
+
// Frame buffers come in upside down so we need to flip the matrix.
|
22789
|
+
var wt = displayObject.worldTransform;
|
22790
|
+
wt.identity();
|
22791
|
+
|
22792
|
+
if (matrix)
|
22793
|
+
{
|
22794
|
+
wt.append(matrix);
|
22795
|
+
}
|
22796
|
+
|
22605
22797
|
// Time to update all the children of the displayObject with the new matrix (what new matrix? there isn't one!)
|
22606
22798
|
for (var i = 0; i < displayObject.children.length; i++)
|
22607
22799
|
{
|
@@ -23644,12 +23836,7 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
|
23644
23836
|
var wt = this.worldTransform;
|
23645
23837
|
var resolution = renderSession.resolution;
|
23646
23838
|
|
23647
|
-
context.setTransform(wt.a * resolution,
|
23648
|
-
wt.b * resolution,
|
23649
|
-
wt.c * resolution,
|
23650
|
-
wt.d * resolution,
|
23651
|
-
wt.tx * resolution,
|
23652
|
-
wt.ty * resolution);
|
23839
|
+
context.setTransform(wt.a * resolution, wt.b * resolution, wt.c * resolution, wt.d * resolution, wt.tx * resolution, wt.ty * resolution);
|
23653
23840
|
|
23654
23841
|
if (this.refreshTexture)
|
23655
23842
|
{
|
@@ -23694,10 +23881,10 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
|
23694
23881
|
// Allow for pixel rounding
|
23695
23882
|
if (renderSession.roundPixels)
|
23696
23883
|
{
|
23697
|
-
tx
|
23698
|
-
ty
|
23699
|
-
tw
|
23700
|
-
th
|
23884
|
+
tx |= 0;
|
23885
|
+
ty |= 0;
|
23886
|
+
tw |= 0;
|
23887
|
+
th |= 0;
|
23701
23888
|
}
|
23702
23889
|
|
23703
23890
|
context.fillRect(tx, ty, tw, th);
|
@@ -23902,6 +24089,8 @@ PIXI.TilingSprite.prototype.getBounds = function()
|
|
23902
24089
|
|
23903
24090
|
PIXI.TilingSprite.prototype.destroy = function () {
|
23904
24091
|
|
24092
|
+
this.canvasBuffer.destroy();
|
24093
|
+
|
23905
24094
|
PIXI.Sprite.prototype.destroy.call(this);
|
23906
24095
|
|
23907
24096
|
this.tileScale = null;
|
@@ -23996,7 +24185,7 @@ var Phaser = Phaser || {
|
|
23996
24185
|
* @constant
|
23997
24186
|
* @type {string}
|
23998
24187
|
*/
|
23999
|
-
VERSION: '2.4.
|
24188
|
+
VERSION: '2.4.3',
|
24000
24189
|
|
24001
24190
|
/**
|
24002
24191
|
* An array of Phaser game instances.
|
@@ -25909,8 +26098,9 @@ Phaser.Line.prototype = {
|
|
25909
26098
|
* Rotates the line by the amount specified in `angle`.
|
25910
26099
|
*
|
25911
26100
|
* Rotation takes place from the center of the line.
|
26101
|
+
* If you wish to rotate around a different point see Line.rotateAround.
|
25912
26102
|
*
|
25913
|
-
* If you wish to rotate
|
26103
|
+
* If you wish to rotate the ends of the Line then see Line.start.rotate or Line.end.rotate.
|
25914
26104
|
*
|
25915
26105
|
* @method Phaser.Line#rotate
|
25916
26106
|
* @param {number} angle - The angle in radians (unless asDegrees is true) to rotate the line by.
|
@@ -25919,11 +26109,30 @@ Phaser.Line.prototype = {
|
|
25919
26109
|
*/
|
25920
26110
|
rotate: function (angle, asDegrees) {
|
25921
26111
|
|
25922
|
-
var
|
25923
|
-
var
|
26112
|
+
var cx = (this.start.x + this.end.x) / 2;
|
26113
|
+
var cy = (this.start.y + this.end.y) / 2;
|
26114
|
+
|
26115
|
+
this.start.rotate(cx, cy, angle, asDegrees);
|
26116
|
+
this.end.rotate(cx, cy, angle, asDegrees);
|
26117
|
+
|
26118
|
+
return this;
|
26119
|
+
|
26120
|
+
},
|
26121
|
+
|
26122
|
+
/**
|
26123
|
+
* Rotates the line by the amount specified in `angle`.
|
26124
|
+
*
|
26125
|
+
* Rotation takes place around the coordinates given.
|
26126
|
+
*
|
26127
|
+
* @method Phaser.Line#rotateAround
|
26128
|
+
* @param {number} angle - The angle in radians (unless asDegrees is true) to rotate the line by.
|
26129
|
+
* @param {boolean} [asDegrees=false] - Is the given angle in radians (false) or degrees (true)?
|
26130
|
+
* @return {Phaser.Line} This line object
|
26131
|
+
*/
|
26132
|
+
rotateAround: function (x, y, angle, asDegrees) {
|
25924
26133
|
|
25925
|
-
this.start.rotate(
|
25926
|
-
this.end.rotate(x, y, angle, asDegrees
|
26134
|
+
this.start.rotate(x, y, angle, asDegrees);
|
26135
|
+
this.end.rotate(x, y, angle, asDegrees);
|
25927
26136
|
|
25928
26137
|
return this;
|
25929
26138
|
|
@@ -25960,6 +26169,48 @@ Phaser.Line.prototype = {
|
|
25960
26169
|
|
25961
26170
|
},
|
25962
26171
|
|
26172
|
+
/**
|
26173
|
+
* Returns a Point object where the x and y values correspond to the center (or midpoint) of the Line segment.
|
26174
|
+
*
|
26175
|
+
* @method Phaser.Line#midPoint
|
26176
|
+
* @param {Phaser.Point} [out] - A Phaser.Point object into which the result will be populated. If not given a new Point object is created.
|
26177
|
+
* @return {Phaser.Point} A Phaser.Point object with the x and y values set to the center of the line segment.
|
26178
|
+
*/
|
26179
|
+
midPoint: function (out) {
|
26180
|
+
|
26181
|
+
if (out === undefined) { out = new Phaser.Point(); }
|
26182
|
+
|
26183
|
+
out.x = (this.start.x + this.end.x) / 2;
|
26184
|
+
out.y = (this.start.y + this.end.y) / 2;
|
26185
|
+
|
26186
|
+
return out;
|
26187
|
+
|
26188
|
+
},
|
26189
|
+
|
26190
|
+
/**
|
26191
|
+
* Centers this Line on the given coordinates.
|
26192
|
+
*
|
26193
|
+
* The line is centered by positioning the start and end points so that the lines midpoint matches
|
26194
|
+
* the coordinates given.
|
26195
|
+
*
|
26196
|
+
* @method Phaser.Line#centerOn
|
26197
|
+
* @param {number} x - The x position to center the line on.
|
26198
|
+
* @param {number} y - The y position to center the line on.
|
26199
|
+
* @return {Phaser.Line} This line object
|
26200
|
+
*/
|
26201
|
+
centerOn: function (x, y) {
|
26202
|
+
|
26203
|
+
var cx = (this.start.x + this.end.x) / 2;
|
26204
|
+
var cy = (this.start.y + this.end.y) / 2;
|
26205
|
+
|
26206
|
+
var tx = x - cx;
|
26207
|
+
var ty = y - cy;
|
26208
|
+
|
26209
|
+
this.start.add(tx, ty);
|
26210
|
+
this.end.add(tx, ty);
|
26211
|
+
|
26212
|
+
},
|
26213
|
+
|
25963
26214
|
/**
|
25964
26215
|
* Tests if the given coordinates fall on this line. See pointOnSegment to test against just the line segment.
|
25965
26216
|
*
|
@@ -27576,24 +27827,27 @@ Phaser.Point.normalize = function (a, out) {
|
|
27576
27827
|
*/
|
27577
27828
|
Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) {
|
27578
27829
|
|
27579
|
-
if (asDegrees
|
27580
|
-
if (distance === undefined) { distance = null; }
|
27830
|
+
if (asDegrees) { angle = Phaser.Math.degToRad(angle); }
|
27581
27831
|
|
27582
|
-
if (
|
27832
|
+
if (distance === undefined)
|
27583
27833
|
{
|
27584
|
-
|
27585
|
-
}
|
27834
|
+
a.subtract(x, y);
|
27586
27835
|
|
27587
|
-
|
27588
|
-
|
27589
|
-
// Get distance from origin (cx/cy) to this point
|
27590
|
-
distance = Math.sqrt(((x - a.x) * (x - a.x)) + ((y - a.y) * (y - a.y)));
|
27591
|
-
}
|
27836
|
+
var s = Math.sin(angle);
|
27837
|
+
var c = Math.cos(angle);
|
27592
27838
|
|
27593
|
-
|
27839
|
+
var tx = c * a.x - s * a.y;
|
27840
|
+
var ty = s * a.x + c * a.y;
|
27594
27841
|
|
27595
|
-
|
27596
|
-
|
27842
|
+
a.x = tx + x;
|
27843
|
+
a.y = ty + y;
|
27844
|
+
}
|
27845
|
+
else
|
27846
|
+
{
|
27847
|
+
var t = angle + Math.atan2(a.y - y, a.x - x);
|
27848
|
+
a.x = x + distance * Math.cos(t);
|
27849
|
+
a.y = y + distance * Math.sin(t);
|
27850
|
+
}
|
27597
27851
|
|
27598
27852
|
return a;
|
27599
27853
|
|
@@ -30809,7 +31063,7 @@ Object.defineProperty(Phaser.StateManager.prototype, "created", {
|
|
30809
31063
|
*/
|
30810
31064
|
|
30811
31065
|
/**
|
30812
|
-
* A Signal is an event dispatch
|
31066
|
+
* A Signal is an event dispatch mechanism that supports broadcasting to multiple listeners.
|
30813
31067
|
*
|
30814
31068
|
* Event listeners are uniquely identified by the listener/callback function and the context.
|
30815
31069
|
*
|
@@ -37407,8 +37661,6 @@ Phaser.ScaleManager.prototype = {
|
|
37407
37661
|
|
37408
37662
|
this.updateLayout();
|
37409
37663
|
this.queueUpdate(true);
|
37410
|
-
|
37411
|
-
this.enterFullScreen.dispatch(this.width, this.height);
|
37412
37664
|
}
|
37413
37665
|
else
|
37414
37666
|
{
|
@@ -37418,11 +37670,9 @@ Phaser.ScaleManager.prototype = {
|
|
37418
37670
|
|
37419
37671
|
this.updateLayout();
|
37420
37672
|
this.queueUpdate(true);
|
37421
|
-
|
37422
|
-
this.leaveFullScreen.dispatch(this.width, this.height);
|
37423
37673
|
}
|
37424
37674
|
|
37425
|
-
this.onFullScreenChange.dispatch(this);
|
37675
|
+
this.onFullScreenChange.dispatch(this, this.width, this.height);
|
37426
37676
|
|
37427
37677
|
},
|
37428
37678
|
|
@@ -38526,14 +38776,7 @@ Phaser.Game.prototype = {
|
|
38526
38776
|
*/
|
38527
38777
|
setUpRenderer: function () {
|
38528
38778
|
|
38529
|
-
|
38530
|
-
{
|
38531
|
-
this.canvas = Phaser.Canvas.create(this.width, this.height, this.config['canvasID']);
|
38532
|
-
}
|
38533
|
-
else
|
38534
|
-
{
|
38535
|
-
this.canvas = Phaser.Canvas.create(this.width, this.height);
|
38536
|
-
}
|
38779
|
+
this.canvas = Phaser.Canvas.create(this, this.width, this.height, this.config['canvasID'], true);
|
38537
38780
|
|
38538
38781
|
if (this.config['canvasStyle'])
|
38539
38782
|
{
|
@@ -39437,9 +39680,7 @@ Phaser.Input.prototype = {
|
|
39437
39680
|
|
39438
39681
|
this.activePointer = this.mousePointer;
|
39439
39682
|
|
39440
|
-
this.hitCanvas =
|
39441
|
-
this.hitCanvas.width = 1;
|
39442
|
-
this.hitCanvas.height = 1;
|
39683
|
+
this.hitCanvas = PIXI.CanvasPool.create(this, 1, 1);
|
39443
39684
|
this.hitContext = this.hitCanvas.getContext('2d');
|
39444
39685
|
|
39445
39686
|
this.mouse.start();
|
@@ -39485,6 +39726,8 @@ Phaser.Input.prototype = {
|
|
39485
39726
|
|
39486
39727
|
this.moveCallbacks = [];
|
39487
39728
|
|
39729
|
+
PIXI.CanvasPool.remove(this);
|
39730
|
+
|
39488
39731
|
this.game.canvas.removeEventListener('click', this._onClickTrampoline);
|
39489
39732
|
|
39490
39733
|
},
|
@@ -40556,16 +40799,12 @@ Phaser.Mouse.prototype = {
|
|
40556
40799
|
},
|
40557
40800
|
|
40558
40801
|
/**
|
40559
|
-
|
40560
|
-
|
40561
|
-
|
40562
|
-
|
40563
|
-
|
40564
|
-
|
40565
|
-
|
40566
|
-
if (this._wheelEvent) {
|
40567
|
-
event = this._wheelEvent.bindEvent(event);
|
40568
|
-
}
|
40802
|
+
* The internal method that handles the mouse over event from the browser.
|
40803
|
+
*
|
40804
|
+
* @method Phaser.Mouse#onMouseOver
|
40805
|
+
* @param {MouseEvent} event - The native event from the browser. This gets stored in Mouse.event.
|
40806
|
+
*/
|
40807
|
+
onMouseOver: function (event) {
|
40569
40808
|
|
40570
40809
|
this.event = event;
|
40571
40810
|
|
@@ -40574,23 +40813,26 @@ Phaser.Mouse.prototype = {
|
|
40574
40813
|
event.preventDefault();
|
40575
40814
|
}
|
40576
40815
|
|
40577
|
-
|
40578
|
-
this.wheelDelta = Phaser.Math.clamp(-event.deltaY, -1, 1);
|
40816
|
+
this.input.mousePointer.withinGame = true;
|
40579
40817
|
|
40580
|
-
if (this.
|
40818
|
+
if (this.mouseOverCallback)
|
40581
40819
|
{
|
40582
|
-
this.
|
40820
|
+
this.mouseOverCallback.call(this.callbackContext, event);
|
40583
40821
|
}
|
40584
40822
|
|
40585
40823
|
},
|
40586
40824
|
|
40587
40825
|
/**
|
40588
|
-
|
40589
|
-
|
40590
|
-
|
40591
|
-
|
40592
|
-
|
40593
|
-
|
40826
|
+
* The internal method that handles the mouse wheel event from the browser.
|
40827
|
+
*
|
40828
|
+
* @method Phaser.Mouse#onMouseWheel
|
40829
|
+
* @param {MouseEvent} event - The native event from the browser.
|
40830
|
+
*/
|
40831
|
+
onMouseWheel: function (event) {
|
40832
|
+
|
40833
|
+
if (this._wheelEvent) {
|
40834
|
+
event = this._wheelEvent.bindEvent(event);
|
40835
|
+
}
|
40594
40836
|
|
40595
40837
|
this.event = event;
|
40596
40838
|
|
@@ -40599,16 +40841,12 @@ Phaser.Mouse.prototype = {
|
|
40599
40841
|
event.preventDefault();
|
40600
40842
|
}
|
40601
40843
|
|
40602
|
-
|
40603
|
-
|
40604
|
-
if (this.mouseOverCallback)
|
40605
|
-
{
|
40606
|
-
this.mouseOverCallback.call(this.callbackContext, event);
|
40607
|
-
}
|
40844
|
+
// reverse detail for firefox
|
40845
|
+
this.wheelDelta = Phaser.Math.clamp(-event.deltaY, -1, 1);
|
40608
40846
|
|
40609
|
-
if (
|
40847
|
+
if (this.mouseWheelCallback)
|
40610
40848
|
{
|
40611
|
-
|
40849
|
+
this.mouseWheelCallback.call(this.callbackContext, event);
|
40612
40850
|
}
|
40613
40851
|
|
40614
40852
|
},
|
@@ -40901,6 +41139,24 @@ Phaser.MSPointer = function (game) {
|
|
40901
41139
|
*/
|
40902
41140
|
this._onMSPointerUp = null;
|
40903
41141
|
|
41142
|
+
/**
|
41143
|
+
* @property {function} _onMSPointerUpGlobal - Internal function to handle MSPointer events.
|
41144
|
+
* @private
|
41145
|
+
*/
|
41146
|
+
this._onMSPointerUpGlobal = null;
|
41147
|
+
|
41148
|
+
/**
|
41149
|
+
* @property {function} _onMSPointerOut - Internal function to handle MSPointer events.
|
41150
|
+
* @private
|
41151
|
+
*/
|
41152
|
+
this._onMSPointerOut = null;
|
41153
|
+
|
41154
|
+
/**
|
41155
|
+
* @property {function} _onMSPointerOver - Internal function to handle MSPointer events.
|
41156
|
+
* @private
|
41157
|
+
*/
|
41158
|
+
this._onMSPointerOver = null;
|
41159
|
+
|
40904
41160
|
};
|
40905
41161
|
|
40906
41162
|
Phaser.MSPointer.prototype = {
|
@@ -40933,6 +41189,18 @@ Phaser.MSPointer.prototype = {
|
|
40933
41189
|
return _this.onPointerUp(event);
|
40934
41190
|
};
|
40935
41191
|
|
41192
|
+
this._onMSPointerUpGlobal = function (event) {
|
41193
|
+
return _this.onPointerUpGlobal(event);
|
41194
|
+
};
|
41195
|
+
|
41196
|
+
this._onMSPointerOut = function (event) {
|
41197
|
+
return _this.onPointerOut(event);
|
41198
|
+
};
|
41199
|
+
|
41200
|
+
this._onMSPointerOver = function (event) {
|
41201
|
+
return _this.onPointerOver(event);
|
41202
|
+
};
|
41203
|
+
|
40936
41204
|
var canvas = this.game.canvas;
|
40937
41205
|
|
40938
41206
|
canvas.addEventListener('MSPointerDown', this._onMSPointerDown, false);
|
@@ -40940,12 +41208,24 @@ Phaser.MSPointer.prototype = {
|
|
40940
41208
|
canvas.addEventListener('MSPointerUp', this._onMSPointerUp, false);
|
40941
41209
|
|
40942
41210
|
// IE11+ uses non-prefix events
|
40943
|
-
canvas.addEventListener('
|
40944
|
-
canvas.addEventListener('
|
40945
|
-
canvas.addEventListener('
|
41211
|
+
canvas.addEventListener('pointerdown', this._onMSPointerDown, false);
|
41212
|
+
canvas.addEventListener('pointermove', this._onMSPointerMove, false);
|
41213
|
+
canvas.addEventListener('pointerup', this._onMSPointerUp, false);
|
40946
41214
|
|
40947
41215
|
canvas.style['-ms-content-zooming'] = 'none';
|
40948
41216
|
canvas.style['-ms-touch-action'] = 'none';
|
41217
|
+
|
41218
|
+
if (!this.game.device.cocoonJS)
|
41219
|
+
{
|
41220
|
+
window.addEventListener('MSPointerUp', this._onMSPointerUpGlobal, true);
|
41221
|
+
canvas.addEventListener('MSPointerOver', this._onMSPointerOver, true);
|
41222
|
+
canvas.addEventListener('MSPointerOut', this._onMSPointerOut, true);
|
41223
|
+
|
41224
|
+
// IE11+ uses non-prefix events
|
41225
|
+
window.addEventListener('pointerup', this._onMSPointerUpGlobal, true);
|
41226
|
+
canvas.addEventListener('pointerover', this._onMSPointerOver, true);
|
41227
|
+
canvas.addEventListener('pointerout', this._onMSPointerOut, true);
|
41228
|
+
}
|
40949
41229
|
}
|
40950
41230
|
|
40951
41231
|
},
|
@@ -41062,6 +41342,121 @@ Phaser.MSPointer.prototype = {
|
|
41062
41342
|
|
41063
41343
|
},
|
41064
41344
|
|
41345
|
+
/**
|
41346
|
+
* The internal method that handles the mouse up event from the window.
|
41347
|
+
*
|
41348
|
+
* @method Phaser.MSPointer#onPointerUpGlobal
|
41349
|
+
* @param {PointerEvent} event - The native event from the browser. This gets stored in MSPointer.event.
|
41350
|
+
*/
|
41351
|
+
onPointerUpGlobal: function (event) {
|
41352
|
+
|
41353
|
+
if ((event.pointerType === 'mouse' || event.pointerType === 0x00000004) && !this.input.mousePointer.withinGame)
|
41354
|
+
{
|
41355
|
+
this.onPointerUp(event);
|
41356
|
+
}
|
41357
|
+
else
|
41358
|
+
{
|
41359
|
+
var pointer = this.input.getPointerFromIdentifier(event.identifier);
|
41360
|
+
|
41361
|
+
if (pointer && pointer.withinGame)
|
41362
|
+
{
|
41363
|
+
this.onPointerUp(event);
|
41364
|
+
}
|
41365
|
+
}
|
41366
|
+
|
41367
|
+
},
|
41368
|
+
|
41369
|
+
/**
|
41370
|
+
* The internal method that handles the pointer out event from the browser.
|
41371
|
+
*
|
41372
|
+
* @method Phaser.MSPointer#onPointerOut
|
41373
|
+
* @param {PointerEvent} event - The native event from the browser. This gets stored in MSPointer.event.
|
41374
|
+
*/
|
41375
|
+
onPointerOut: function (event) {
|
41376
|
+
|
41377
|
+
this.event = event;
|
41378
|
+
|
41379
|
+
if (this.capture)
|
41380
|
+
{
|
41381
|
+
event.preventDefault();
|
41382
|
+
}
|
41383
|
+
|
41384
|
+
if (event.pointerType === 'mouse' || event.pointerType === 0x00000004)
|
41385
|
+
{
|
41386
|
+
this.input.mousePointer.withinGame = false;
|
41387
|
+
}
|
41388
|
+
else
|
41389
|
+
{
|
41390
|
+
var pointer = this.input.getPointerFromIdentifier(event.identifier);
|
41391
|
+
|
41392
|
+
if (pointer)
|
41393
|
+
{
|
41394
|
+
pointer.withinGame = false;
|
41395
|
+
}
|
41396
|
+
}
|
41397
|
+
|
41398
|
+
if (this.input.mouse.mouseOutCallback)
|
41399
|
+
{
|
41400
|
+
this.input.mouse.mouseOutCallback.call(this.input.mouse.callbackContext, event);
|
41401
|
+
}
|
41402
|
+
|
41403
|
+
if (!this.input.enabled || !this.enabled)
|
41404
|
+
{
|
41405
|
+
return;
|
41406
|
+
}
|
41407
|
+
|
41408
|
+
if (this.input.mouse.stopOnGameOut)
|
41409
|
+
{
|
41410
|
+
event['identifier'] = 0;
|
41411
|
+
|
41412
|
+
if (pointer)
|
41413
|
+
{
|
41414
|
+
pointer.stop(event);
|
41415
|
+
}
|
41416
|
+
else
|
41417
|
+
{
|
41418
|
+
this.input.mousePointer.stop(event);
|
41419
|
+
}
|
41420
|
+
}
|
41421
|
+
|
41422
|
+
},
|
41423
|
+
|
41424
|
+
/**
|
41425
|
+
* The internal method that handles the pointer out event from the browser.
|
41426
|
+
*
|
41427
|
+
* @method Phaser.MSPointer#onPointerOut
|
41428
|
+
* @param {PointerEvent} event - The native event from the browser. This gets stored in MSPointer.event.
|
41429
|
+
*/
|
41430
|
+
onPointerOver: function (event) {
|
41431
|
+
|
41432
|
+
this.event = event;
|
41433
|
+
|
41434
|
+
if (this.capture)
|
41435
|
+
{
|
41436
|
+
event.preventDefault();
|
41437
|
+
}
|
41438
|
+
|
41439
|
+
if (event.pointerType === 'mouse' || event.pointerType === 0x00000004)
|
41440
|
+
{
|
41441
|
+
this.input.mousePointer.withinGame = true;
|
41442
|
+
}
|
41443
|
+
else
|
41444
|
+
{
|
41445
|
+
var pointer = this.input.getPointerFromIdentifier(event.identifier);
|
41446
|
+
|
41447
|
+
if (pointer)
|
41448
|
+
{
|
41449
|
+
pointer.withinGame = true;
|
41450
|
+
}
|
41451
|
+
}
|
41452
|
+
|
41453
|
+
if (this.input.mouse.mouseOverCallback)
|
41454
|
+
{
|
41455
|
+
this.input.mouse.mouseOverCallback.call(this.input.mouse.callbackContext, event);
|
41456
|
+
}
|
41457
|
+
|
41458
|
+
},
|
41459
|
+
|
41065
41460
|
/**
|
41066
41461
|
* Stop the event listeners.
|
41067
41462
|
* @method Phaser.MSPointer#stop
|
@@ -41073,10 +41468,17 @@ Phaser.MSPointer.prototype = {
|
|
41073
41468
|
canvas.removeEventListener('MSPointerDown', this._onMSPointerDown);
|
41074
41469
|
canvas.removeEventListener('MSPointerMove', this._onMSPointerMove);
|
41075
41470
|
canvas.removeEventListener('MSPointerUp', this._onMSPointerUp);
|
41471
|
+
canvas.removeEventListener('MSPointerOver', this._onMSPointerOver);
|
41472
|
+
canvas.removeEventListener('MSPointerOut', this._onMSPointerOut);
|
41076
41473
|
|
41077
|
-
canvas.removeEventListener('
|
41078
|
-
canvas.removeEventListener('
|
41079
|
-
canvas.removeEventListener('
|
41474
|
+
canvas.removeEventListener('pointerdown', this._onMSPointerDown);
|
41475
|
+
canvas.removeEventListener('pointermove', this._onMSPointerMove);
|
41476
|
+
canvas.removeEventListener('pointerup', this._onMSPointerUp);
|
41477
|
+
canvas.removeEventListener('pointerover', this._onMSPointerOver);
|
41478
|
+
canvas.removeEventListener('pointerout', this._onMSPointerOut);
|
41479
|
+
|
41480
|
+
window.removeEventListener('MSPointerUp', this._onMSPointerUpGlobal);
|
41481
|
+
window.removeEventListener('pointerup', this._onMSPointerUpGlobal);
|
41080
41482
|
|
41081
41483
|
}
|
41082
41484
|
|
@@ -41991,8 +42393,6 @@ Phaser.Pointer.prototype = {
|
|
41991
42393
|
*/
|
41992
42394
|
start: function (event) {
|
41993
42395
|
|
41994
|
-
// console.log(event);
|
41995
|
-
|
41996
42396
|
if (event['pointerId'])
|
41997
42397
|
{
|
41998
42398
|
this.pointerId = event.pointerId;
|
@@ -42011,10 +42411,11 @@ Phaser.Pointer.prototype = {
|
|
42011
42411
|
this.isUp = false;
|
42012
42412
|
}
|
42013
42413
|
|
42014
|
-
this._history = [];
|
42015
42414
|
this.active = true;
|
42016
42415
|
this.withinGame = true;
|
42017
42416
|
this.dirty = false;
|
42417
|
+
|
42418
|
+
this._history = [];
|
42018
42419
|
this._clickTrampolines = null;
|
42019
42420
|
this._trampolineTargetObject = null;
|
42020
42421
|
|
@@ -42111,7 +42512,9 @@ Phaser.Pointer.prototype = {
|
|
42111
42512
|
*/
|
42112
42513
|
move: function (event, fromClick) {
|
42113
42514
|
|
42114
|
-
|
42515
|
+
var input = this.game.input;
|
42516
|
+
|
42517
|
+
if (input.pollLocked)
|
42115
42518
|
{
|
42116
42519
|
return;
|
42117
42520
|
}
|
@@ -42137,7 +42540,7 @@ Phaser.Pointer.prototype = {
|
|
42137
42540
|
this.screenX = event.screenX;
|
42138
42541
|
this.screenY = event.screenY;
|
42139
42542
|
|
42140
|
-
if (this.isMouse &&
|
42543
|
+
if (this.isMouse && input.mouse.locked && !fromClick)
|
42141
42544
|
{
|
42142
42545
|
this.rawMovementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
|
42143
42546
|
this.rawMovementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
|
@@ -42146,23 +42549,23 @@ Phaser.Pointer.prototype = {
|
|
42146
42549
|
this.movementY += this.rawMovementY;
|
42147
42550
|
}
|
42148
42551
|
|
42149
|
-
this.x = (this.pageX - this.game.scale.offset.x) *
|
42150
|
-
this.y = (this.pageY - this.game.scale.offset.y) *
|
42552
|
+
this.x = (this.pageX - this.game.scale.offset.x) * input.scale.x;
|
42553
|
+
this.y = (this.pageY - this.game.scale.offset.y) * input.scale.y;
|
42151
42554
|
|
42152
42555
|
this.position.setTo(this.x, this.y);
|
42153
42556
|
this.circle.x = this.x;
|
42154
42557
|
this.circle.y = this.y;
|
42155
42558
|
|
42156
|
-
if (
|
42157
|
-
|
42158
|
-
(
|
42559
|
+
if (input.multiInputOverride === Phaser.Input.MOUSE_OVERRIDES_TOUCH ||
|
42560
|
+
input.multiInputOverride === Phaser.Input.MOUSE_TOUCH_COMBINE ||
|
42561
|
+
(input.multiInputOverride === Phaser.Input.TOUCH_OVERRIDES_MOUSE && input.totalActivePointers === 0))
|
42159
42562
|
{
|
42160
|
-
|
42161
|
-
|
42162
|
-
|
42163
|
-
|
42164
|
-
|
42165
|
-
|
42563
|
+
input.activePointer = this;
|
42564
|
+
input.x = this.x;
|
42565
|
+
input.y = this.y;
|
42566
|
+
input.position.setTo(input.x, input.y);
|
42567
|
+
input.circle.x = input.x;
|
42568
|
+
input.circle.y = input.y;
|
42166
42569
|
}
|
42167
42570
|
|
42168
42571
|
this.withinGame = this.game.scale.bounds.contains(this.pageX, this.pageY);
|
@@ -42173,11 +42576,11 @@ Phaser.Pointer.prototype = {
|
|
42173
42576
|
return this;
|
42174
42577
|
}
|
42175
42578
|
|
42176
|
-
var i =
|
42579
|
+
var i = input.moveCallbacks.length;
|
42177
42580
|
|
42178
42581
|
while (i--)
|
42179
42582
|
{
|
42180
|
-
|
42583
|
+
input.moveCallbacks[i].callback.call(input.moveCallbacks[i].context, this, this.x, this.y, fromClick);
|
42181
42584
|
}
|
42182
42585
|
|
42183
42586
|
// Easy out if we're dragging something and it still exists
|
@@ -42188,7 +42591,7 @@ Phaser.Pointer.prototype = {
|
|
42188
42591
|
this.targetObject = null;
|
42189
42592
|
}
|
42190
42593
|
}
|
42191
|
-
else if (
|
42594
|
+
else if (input.interactiveItems.total > 0)
|
42192
42595
|
{
|
42193
42596
|
this.processInteractiveObjects(fromClick);
|
42194
42597
|
}
|
@@ -42334,16 +42737,6 @@ Phaser.Pointer.prototype = {
|
|
42334
42737
|
return;
|
42335
42738
|
}
|
42336
42739
|
|
42337
|
-
if (this.isMouse)
|
42338
|
-
{
|
42339
|
-
this.updateButtons(event);
|
42340
|
-
}
|
42341
|
-
else
|
42342
|
-
{
|
42343
|
-
this.isDown = false;
|
42344
|
-
this.isUp = true;
|
42345
|
-
}
|
42346
|
-
|
42347
42740
|
this.timeUp = this.game.time.time;
|
42348
42741
|
|
42349
42742
|
if (this.game.input.multiInputOverride === Phaser.Input.MOUSE_OVERRIDES_TOUCH ||
|
@@ -42371,13 +42764,23 @@ Phaser.Pointer.prototype = {
|
|
42371
42764
|
}
|
42372
42765
|
}
|
42373
42766
|
|
42767
|
+
if (this.isMouse)
|
42768
|
+
{
|
42769
|
+
this.updateButtons(event);
|
42770
|
+
}
|
42771
|
+
else
|
42772
|
+
{
|
42773
|
+
this.isDown = false;
|
42774
|
+
this.isUp = true;
|
42775
|
+
}
|
42776
|
+
|
42374
42777
|
// Mouse is always active
|
42375
42778
|
if (this.id > 0)
|
42376
42779
|
{
|
42377
42780
|
this.active = false;
|
42378
42781
|
}
|
42379
42782
|
|
42380
|
-
this.withinGame =
|
42783
|
+
this.withinGame = this.game.scale.bounds.contains(event.pageX, event.pageY);
|
42381
42784
|
this.pointerId = null;
|
42382
42785
|
this.identifier = null;
|
42383
42786
|
|
@@ -43740,7 +44143,10 @@ Phaser.InputHandler.prototype = {
|
|
43740
44143
|
// Need to pass it a temp point, in case we need it again for the pixel check
|
43741
44144
|
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
|
43742
44145
|
{
|
43743
|
-
if (fastTest === undefined)
|
44146
|
+
if (fastTest === undefined)
|
44147
|
+
{
|
44148
|
+
fastTest = false;
|
44149
|
+
}
|
43744
44150
|
|
43745
44151
|
if (!fastTest && this.pixelPerfectClick)
|
43746
44152
|
{
|
@@ -43775,7 +44181,10 @@ Phaser.InputHandler.prototype = {
|
|
43775
44181
|
// Need to pass it a temp point, in case we need it again for the pixel check
|
43776
44182
|
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
|
43777
44183
|
{
|
43778
|
-
if (fastTest === undefined)
|
44184
|
+
if (fastTest === undefined)
|
44185
|
+
{
|
44186
|
+
fastTest = false;
|
44187
|
+
}
|
43779
44188
|
|
43780
44189
|
if (!fastTest && this.pixelPerfectOver)
|
43781
44190
|
{
|
@@ -43915,15 +44324,17 @@ Phaser.InputHandler.prototype = {
|
|
43915
44324
|
return;
|
43916
44325
|
}
|
43917
44326
|
|
43918
|
-
|
44327
|
+
var data = this._pointerData[pointer.id];
|
44328
|
+
|
44329
|
+
if (data.isOver === false || pointer.dirty)
|
43919
44330
|
{
|
43920
|
-
|
43921
|
-
|
43922
|
-
|
43923
|
-
|
43924
|
-
|
44331
|
+
data.isOver = true;
|
44332
|
+
data.isOut = false;
|
44333
|
+
data.timeOver = this.game.time.time;
|
44334
|
+
data.x = pointer.x - this.sprite.x;
|
44335
|
+
data.y = pointer.y - this.sprite.y;
|
43925
44336
|
|
43926
|
-
if (this.useHandCursor &&
|
44337
|
+
if (this.useHandCursor && data.isDragged === false)
|
43927
44338
|
{
|
43928
44339
|
this.game.canvas.style.cursor = "pointer";
|
43929
44340
|
this._setHandCursor = true;
|
@@ -43952,11 +44363,13 @@ Phaser.InputHandler.prototype = {
|
|
43952
44363
|
return;
|
43953
44364
|
}
|
43954
44365
|
|
43955
|
-
this._pointerData[pointer.id]
|
43956
|
-
this._pointerData[pointer.id].isOut = true;
|
43957
|
-
this._pointerData[pointer.id].timeOut = this.game.time.time;
|
44366
|
+
var data = this._pointerData[pointer.id];
|
43958
44367
|
|
43959
|
-
|
44368
|
+
data.isOver = false;
|
44369
|
+
data.isOut = true;
|
44370
|
+
data.timeOut = this.game.time.time;
|
44371
|
+
|
44372
|
+
if (this.useHandCursor && data.isDragged === false)
|
43960
44373
|
{
|
43961
44374
|
this.game.canvas.style.cursor = "default";
|
43962
44375
|
this._setHandCursor = false;
|
@@ -43984,16 +44397,18 @@ Phaser.InputHandler.prototype = {
|
|
43984
44397
|
return;
|
43985
44398
|
}
|
43986
44399
|
|
43987
|
-
|
44400
|
+
var data = this._pointerData[pointer.id];
|
44401
|
+
|
44402
|
+
if (!data.isDown && data.isOver)
|
43988
44403
|
{
|
43989
44404
|
if (this.pixelPerfectClick && !this.checkPixel(null, null, pointer))
|
43990
44405
|
{
|
43991
44406
|
return;
|
43992
44407
|
}
|
43993
44408
|
|
43994
|
-
|
43995
|
-
|
43996
|
-
|
44409
|
+
data.isDown = true;
|
44410
|
+
data.isUp = false;
|
44411
|
+
data.timeDown = this.game.time.time;
|
43997
44412
|
|
43998
44413
|
if (this.sprite && this.sprite.events)
|
43999
44414
|
{
|
@@ -44034,40 +44449,39 @@ Phaser.InputHandler.prototype = {
|
|
44034
44449
|
return;
|
44035
44450
|
}
|
44036
44451
|
|
44452
|
+
var data = this._pointerData[pointer.id];
|
44453
|
+
|
44037
44454
|
// If was previously touched by this Pointer, check if still is AND still over this item
|
44038
|
-
if (
|
44455
|
+
if (data.isDown && pointer.isUp)
|
44039
44456
|
{
|
44040
|
-
|
44041
|
-
|
44042
|
-
|
44043
|
-
|
44457
|
+
data.isDown = false;
|
44458
|
+
data.isUp = true;
|
44459
|
+
data.timeUp = this.game.time.time;
|
44460
|
+
data.downDuration = data.timeUp - data.timeDown;
|
44044
44461
|
|
44045
44462
|
// Only release the InputUp signal if the pointer is still over this sprite
|
44046
|
-
|
44463
|
+
var isOver = this.checkPointerOver(pointer);
|
44464
|
+
|
44465
|
+
if (this.sprite && this.sprite.events)
|
44047
44466
|
{
|
44048
|
-
|
44049
|
-
|
44467
|
+
this.sprite.events.onInputUp$dispatch(this.sprite, pointer, isOver);
|
44468
|
+
|
44469
|
+
// The onInputUp event may have changed the sprite so that checkPointerOver is no longer true, so update it.
|
44470
|
+
if (isOver)
|
44050
44471
|
{
|
44051
|
-
this.
|
44472
|
+
isOver = this.checkPointerOver(pointer);
|
44052
44473
|
}
|
44053
44474
|
}
|
44054
|
-
|
44055
|
-
|
44056
|
-
// Release the inputUp signal and provide optional parameter if pointer is still over the sprite or not
|
44057
|
-
if (this.sprite && this.sprite.events)
|
44058
|
-
{
|
44059
|
-
this.sprite.events.onInputUp$dispatch(this.sprite, pointer, false);
|
44060
|
-
}
|
44475
|
+
|
44476
|
+
data.isOver = isOver;
|
44061
44477
|
|
44062
|
-
|
44063
|
-
|
44064
|
-
|
44065
|
-
|
44066
|
-
this._setHandCursor = false;
|
44067
|
-
}
|
44478
|
+
if (!isOver && this.useHandCursor)
|
44479
|
+
{
|
44480
|
+
this.game.canvas.style.cursor = "default";
|
44481
|
+
this._setHandCursor = false;
|
44068
44482
|
}
|
44069
44483
|
|
44070
|
-
// It's possible the onInputUp event created a new Sprite that is on-top of this one, so
|
44484
|
+
// It's possible the onInputUp event created a new Sprite that is on-top of this one, so force a Pointer update
|
44071
44485
|
pointer.dirty = true;
|
44072
44486
|
|
44073
44487
|
// Stop drag
|
@@ -45954,7 +46368,7 @@ Phaser.Key = function (game, keycode) {
|
|
45954
46368
|
this.onHoldContext = null;
|
45955
46369
|
|
45956
46370
|
/**
|
45957
|
-
* @property {Phaser.Signal} onUp - This Signal is dispatched every time this Key is
|
46371
|
+
* @property {Phaser.Signal} onUp - This Signal is dispatched every time this Key is released. It is only dispatched once (until the key is pressed and released again).
|
45958
46372
|
*/
|
45959
46373
|
this.onUp = new Phaser.Signal();
|
45960
46374
|
|
@@ -47937,6 +48351,8 @@ Phaser.Component.Destroy.prototype = {
|
|
47937
48351
|
this._currentBounds = null;
|
47938
48352
|
this._mask = null;
|
47939
48353
|
|
48354
|
+
|
48355
|
+
|
47940
48356
|
this._destroyCachedSprite();
|
47941
48357
|
|
47942
48358
|
this.destroyPhase = false;
|
@@ -51877,7 +52293,8 @@ Phaser.BitmapData = function (game, key, width, height) {
|
|
51877
52293
|
* @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
|
51878
52294
|
* @default
|
51879
52295
|
*/
|
51880
|
-
this.canvas = Phaser.Canvas.create(width, height, '', true);
|
52296
|
+
// this.canvas = Phaser.Canvas.create(width, height, '', true);
|
52297
|
+
this.canvas = PIXI.CanvasPool.create(this, width, height);
|
51881
52298
|
|
51882
52299
|
/**
|
51883
52300
|
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
|
@@ -51892,6 +52309,8 @@ Phaser.BitmapData = function (game, key, width, height) {
|
|
51892
52309
|
|
51893
52310
|
/**
|
51894
52311
|
* @property {ImageData} imageData - The context image data.
|
52312
|
+
* Please note that a call to BitmapData.draw() or BitmapData.copy() does not update immediately this property for performance reason. Use BitmapData.update() to do so.
|
52313
|
+
* This property is updated automatically after the first game loop, according to the dirty flag property.
|
51895
52314
|
*/
|
51896
52315
|
this.imageData = this.context.getImageData(0, 0, width, height);
|
51897
52316
|
|
@@ -52045,7 +52464,7 @@ Phaser.BitmapData = function (game, key, width, height) {
|
|
52045
52464
|
* @property {HTMLCanvasElement} _swapCanvas - A swap canvas.
|
52046
52465
|
* @private
|
52047
52466
|
*/
|
52048
|
-
this._swapCanvas =
|
52467
|
+
this._swapCanvas = PIXI.CanvasPool.create(this, width, height);
|
52049
52468
|
|
52050
52469
|
};
|
52051
52470
|
|
@@ -52748,7 +53167,6 @@ Phaser.BitmapData.prototype = {
|
|
52748
53167
|
* @param {number} red - The red color value, between 0 and 0xFF (255).
|
52749
53168
|
* @param {number} green - The green color value, between 0 and 0xFF (255).
|
52750
53169
|
* @param {number} blue - The blue color value, between 0 and 0xFF (255).
|
52751
|
-
* @param {number} alpha - The alpha color value, between 0 and 0xFF (255).
|
52752
53170
|
* @param {boolean} [immediate=true] - If `true` the context.putImageData will be called and the dirty flag set.
|
52753
53171
|
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
|
52754
53172
|
*/
|
@@ -53013,7 +53431,7 @@ Phaser.BitmapData.prototype = {
|
|
53013
53431
|
|
53014
53432
|
this._image = source;
|
53015
53433
|
|
53016
|
-
if (source instanceof Phaser.Sprite || source instanceof Phaser.Image || source instanceof Phaser.Text)
|
53434
|
+
if (source instanceof Phaser.Sprite || source instanceof Phaser.Image || source instanceof Phaser.Text || source instanceof PIXI.Sprite)
|
53017
53435
|
{
|
53018
53436
|
// Copy over sprite values
|
53019
53437
|
this._pos.set(source.texture.crop.x, source.texture.crop.y);
|
@@ -53139,15 +53557,17 @@ Phaser.BitmapData.prototype = {
|
|
53139
53557
|
return;
|
53140
53558
|
}
|
53141
53559
|
|
53142
|
-
|
53560
|
+
var ctx = this.context;
|
53143
53561
|
|
53144
|
-
this.
|
53562
|
+
this._alpha.prev = ctx.globalAlpha;
|
53145
53563
|
|
53146
|
-
|
53564
|
+
ctx.save();
|
53565
|
+
|
53566
|
+
ctx.globalAlpha = this._alpha.current;
|
53147
53567
|
|
53148
53568
|
if (blendMode)
|
53149
53569
|
{
|
53150
|
-
this.
|
53570
|
+
this.op = blendMode;
|
53151
53571
|
}
|
53152
53572
|
|
53153
53573
|
if (roundPx)
|
@@ -53156,17 +53576,17 @@ Phaser.BitmapData.prototype = {
|
|
53156
53576
|
ty |= 0;
|
53157
53577
|
}
|
53158
53578
|
|
53159
|
-
|
53579
|
+
ctx.translate(tx, ty);
|
53160
53580
|
|
53161
|
-
|
53581
|
+
ctx.scale(this._scale.x, this._scale.y);
|
53162
53582
|
|
53163
|
-
|
53583
|
+
ctx.rotate(this._rotate);
|
53164
53584
|
|
53165
|
-
|
53585
|
+
ctx.drawImage(this._image, this._pos.x + x, this._pos.y + y, this._size.x, this._size.y, -newWidth * this._anchor.x, -newHeight * this._anchor.y, newWidth, newHeight);
|
53166
53586
|
|
53167
|
-
|
53587
|
+
ctx.restore();
|
53168
53588
|
|
53169
|
-
|
53589
|
+
ctx.globalAlpha = this._alpha.prev;
|
53170
53590
|
|
53171
53591
|
this.dirty = true;
|
53172
53592
|
|
@@ -53239,6 +53659,64 @@ Phaser.BitmapData.prototype = {
|
|
53239
53659
|
|
53240
53660
|
},
|
53241
53661
|
|
53662
|
+
/**
|
53663
|
+
* Draws the Game Object or Group to this BitmapData and then recursively iterates through all of its children.
|
53664
|
+
*
|
53665
|
+
* If a child has an `exists` property then it (and its children) will be only be drawn if exists is `true`.
|
53666
|
+
*
|
53667
|
+
* The children will be drawn at their `x` and `y` world space coordinates. If this is outside the bounds of the BitmapData
|
53668
|
+
* they won't be drawn. Depending on your requirements you may need to resize the BitmapData in advance to match the
|
53669
|
+
* bounds of the top-level Game Object.
|
53670
|
+
*
|
53671
|
+
* When drawing it will take into account the child's world rotation, scale and alpha values.
|
53672
|
+
*
|
53673
|
+
* It's perfectly valid to pass in `game.world` as the parent object, and it will iterate through the entire display list.
|
53674
|
+
*
|
53675
|
+
* Note: If you are trying to grab your entire game at the start of a State then you should ensure that at least 1 full update
|
53676
|
+
* has taken place before doing so, otherwise all of the objects will render with incorrect positions and scales. You can
|
53677
|
+
* trigger an update yourself by calling `stage.updateTransform()` before calling `drawFull`.
|
53678
|
+
*
|
53679
|
+
* @method Phaser.BitmapData#drawFull
|
53680
|
+
* @param {Phaser.World|Phaser.Group|Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapText} parent - The Game Object to draw onto this BitmapData and then recursively draw all of its children.
|
53681
|
+
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
|
53682
|
+
* @param {boolean} [roundPx=false] - Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.
|
53683
|
+
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
|
53684
|
+
*/
|
53685
|
+
drawFull: function (parent, blendMode, roundPx) {
|
53686
|
+
|
53687
|
+
if (parent.worldVisible === false || parent.worldAlpha === 0 || (parent.hasOwnProperty('exists') && parent.exists === false))
|
53688
|
+
{
|
53689
|
+
return this;
|
53690
|
+
}
|
53691
|
+
|
53692
|
+
if (parent.type !== Phaser.GROUP && parent.type !== Phaser.EMITTER && parent.type !== Phaser.BITMAPTEXT)
|
53693
|
+
{
|
53694
|
+
if (parent.type === Phaser.GRAPHICS)
|
53695
|
+
{
|
53696
|
+
var bounds = parent.getBounds();
|
53697
|
+
this.ctx.save();
|
53698
|
+
this.ctx.translate(bounds.x, bounds.y);
|
53699
|
+
PIXI.CanvasGraphics.renderGraphics(parent, this.ctx);
|
53700
|
+
this.ctx.restore();
|
53701
|
+
}
|
53702
|
+
else
|
53703
|
+
{
|
53704
|
+
this.copy(parent, null, null, null, null, parent.worldPosition.x, parent.worldPosition.y, null, null, parent.worldRotation, null, null, parent.worldScale.x, parent.worldScale.y, parent.worldAlpha, blendMode, roundPx);
|
53705
|
+
}
|
53706
|
+
}
|
53707
|
+
|
53708
|
+
if (parent.children)
|
53709
|
+
{
|
53710
|
+
for (var i = 0; i < parent.children.length; i++)
|
53711
|
+
{
|
53712
|
+
this.drawFull(parent.children[i], blendMode, roundPx);
|
53713
|
+
}
|
53714
|
+
}
|
53715
|
+
|
53716
|
+
return this;
|
53717
|
+
|
53718
|
+
},
|
53719
|
+
|
53242
53720
|
/**
|
53243
53721
|
* Sets the shadow properties of this BitmapDatas context which will affect all draw operations made to it.
|
53244
53722
|
* You can cancel an existing shadow by calling this method and passing no parameters.
|
@@ -53253,16 +53731,18 @@ Phaser.BitmapData.prototype = {
|
|
53253
53731
|
*/
|
53254
53732
|
shadow: function (color, blur, x, y) {
|
53255
53733
|
|
53734
|
+
var ctx = this.context;
|
53735
|
+
|
53256
53736
|
if (color === undefined || color === null)
|
53257
53737
|
{
|
53258
|
-
|
53738
|
+
ctx.shadowColor = 'rgba(0,0,0,0)';
|
53259
53739
|
}
|
53260
53740
|
else
|
53261
53741
|
{
|
53262
|
-
|
53263
|
-
|
53264
|
-
|
53265
|
-
|
53742
|
+
ctx.shadowColor = color;
|
53743
|
+
ctx.shadowBlur = blur || 5;
|
53744
|
+
ctx.shadowOffsetX = x || 10;
|
53745
|
+
ctx.shadowOffsetY = y || 10;
|
53266
53746
|
}
|
53267
53747
|
|
53268
53748
|
},
|
@@ -53400,20 +53880,21 @@ Phaser.BitmapData.prototype = {
|
|
53400
53880
|
if (color === undefined) { color = 'rgb(255,255,255)'; }
|
53401
53881
|
if (shadow === undefined) { shadow = true; }
|
53402
53882
|
|
53403
|
-
var
|
53883
|
+
var ctx = this.context;
|
53884
|
+
var prevFont = ctx.font;
|
53404
53885
|
|
53405
|
-
|
53886
|
+
ctx.font = font;
|
53406
53887
|
|
53407
53888
|
if (shadow)
|
53408
53889
|
{
|
53409
|
-
|
53410
|
-
|
53890
|
+
ctx.fillStyle = 'rgb(0,0,0)';
|
53891
|
+
ctx.fillText(text, x + 1, y + 1);
|
53411
53892
|
}
|
53412
53893
|
|
53413
|
-
|
53414
|
-
|
53894
|
+
ctx.fillStyle = color;
|
53895
|
+
ctx.fillText(text, x, y);
|
53415
53896
|
|
53416
|
-
|
53897
|
+
ctx.font = prevFont;
|
53417
53898
|
|
53418
53899
|
},
|
53419
53900
|
|
@@ -53429,16 +53910,52 @@ Phaser.BitmapData.prototype = {
|
|
53429
53910
|
*/
|
53430
53911
|
circle: function (x, y, radius, fillStyle) {
|
53431
53912
|
|
53432
|
-
|
53913
|
+
var ctx = this.context;
|
53914
|
+
|
53915
|
+
if (fillStyle !== undefined)
|
53433
53916
|
{
|
53434
|
-
|
53917
|
+
ctx.fillStyle = fillStyle;
|
53435
53918
|
}
|
53436
53919
|
|
53437
|
-
|
53438
|
-
|
53439
|
-
|
53920
|
+
ctx.beginPath();
|
53921
|
+
ctx.arc(x, y, radius, 0, Math.PI * 2, false);
|
53922
|
+
ctx.closePath();
|
53440
53923
|
|
53441
|
-
|
53924
|
+
ctx.fill();
|
53925
|
+
|
53926
|
+
return this;
|
53927
|
+
|
53928
|
+
},
|
53929
|
+
|
53930
|
+
/**
|
53931
|
+
* Draws a line between the coordinates given in the color and thickness specified.
|
53932
|
+
*
|
53933
|
+
* @method Phaser.BitmapData#line
|
53934
|
+
* @param {number} x1 - The x coordinate to start the line from.
|
53935
|
+
* @param {number} y1 - The y coordinate to start the line from.
|
53936
|
+
* @param {number} x2 - The x coordinate to draw the line to.
|
53937
|
+
* @param {number} y2 - The y coordinate to draw the line to.
|
53938
|
+
* @param {string} [color='#fff'] - The stroke color that the line will be drawn in.
|
53939
|
+
* @param {number} [width=1] - The line thickness.
|
53940
|
+
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
|
53941
|
+
*/
|
53942
|
+
line: function (x1, y1, x2, y2, color, width) {
|
53943
|
+
|
53944
|
+
if (color === undefined) { color = '#fff'; }
|
53945
|
+
if (width === undefined) { width = 1; }
|
53946
|
+
|
53947
|
+
var ctx = this.context;
|
53948
|
+
|
53949
|
+
ctx.beginPath();
|
53950
|
+
|
53951
|
+
ctx.moveTo(x1, y1);
|
53952
|
+
ctx.lineTo(x2, y2);
|
53953
|
+
|
53954
|
+
ctx.lineWidth = width;
|
53955
|
+
ctx.strokeStyle = color;
|
53956
|
+
ctx.stroke();
|
53957
|
+
|
53958
|
+
ctx.closePath();
|
53442
53959
|
|
53443
53960
|
return this;
|
53444
53961
|
|
@@ -53474,17 +53991,19 @@ Phaser.BitmapData.prototype = {
|
|
53474
53991
|
width = image.width;
|
53475
53992
|
}
|
53476
53993
|
|
53477
|
-
|
53994
|
+
var ctx = this.context;
|
53995
|
+
|
53996
|
+
ctx.fillStyle = ctx.createPattern(image, repeat);
|
53478
53997
|
|
53479
53998
|
this._circle = new Phaser.Circle(line.start.x, line.start.y, image.height);
|
53480
53999
|
|
53481
54000
|
this._circle.circumferencePoint(line.angle - 1.5707963267948966, false, this._pos);
|
53482
54001
|
|
53483
|
-
|
53484
|
-
|
53485
|
-
|
53486
|
-
|
53487
|
-
|
54002
|
+
ctx.save();
|
54003
|
+
ctx.translate(this._pos.x, this._pos.y);
|
54004
|
+
ctx.rotate(line.angle);
|
54005
|
+
ctx.fillRect(0, 0, width, image.height);
|
54006
|
+
ctx.restore();
|
53488
54007
|
|
53489
54008
|
this.dirty = true;
|
53490
54009
|
|
@@ -53512,6 +54031,17 @@ Phaser.BitmapData.prototype = {
|
|
53512
54031
|
|
53513
54032
|
},
|
53514
54033
|
|
54034
|
+
/**
|
54035
|
+
* Destroys this BitmapData and puts the canvas it was using back into the canvas pool for re-use.
|
54036
|
+
*
|
54037
|
+
* @method Phaser.BitmapData#destroy
|
54038
|
+
*/
|
54039
|
+
destroy: function () {
|
54040
|
+
|
54041
|
+
PIXI.CanvasPool.remove(this);
|
54042
|
+
|
54043
|
+
},
|
54044
|
+
|
53515
54045
|
/**
|
53516
54046
|
* Resets the blend mode (effectively sets it to 'source-over')
|
53517
54047
|
*
|
@@ -53520,7 +54050,7 @@ Phaser.BitmapData.prototype = {
|
|
53520
54050
|
*/
|
53521
54051
|
blendReset: function () {
|
53522
54052
|
|
53523
|
-
this.
|
54053
|
+
this.op = 'source-over';
|
53524
54054
|
return this;
|
53525
54055
|
|
53526
54056
|
},
|
@@ -53533,7 +54063,7 @@ Phaser.BitmapData.prototype = {
|
|
53533
54063
|
*/
|
53534
54064
|
blendSourceOver: function () {
|
53535
54065
|
|
53536
|
-
this.
|
54066
|
+
this.op = 'source-over';
|
53537
54067
|
return this;
|
53538
54068
|
|
53539
54069
|
},
|
@@ -53546,7 +54076,7 @@ Phaser.BitmapData.prototype = {
|
|
53546
54076
|
*/
|
53547
54077
|
blendSourceIn: function () {
|
53548
54078
|
|
53549
|
-
this.
|
54079
|
+
this.op = 'source-in';
|
53550
54080
|
return this;
|
53551
54081
|
|
53552
54082
|
},
|
@@ -53559,7 +54089,7 @@ Phaser.BitmapData.prototype = {
|
|
53559
54089
|
*/
|
53560
54090
|
blendSourceOut: function () {
|
53561
54091
|
|
53562
|
-
this.
|
54092
|
+
this.op = 'source-out';
|
53563
54093
|
return this;
|
53564
54094
|
|
53565
54095
|
},
|
@@ -53572,7 +54102,7 @@ Phaser.BitmapData.prototype = {
|
|
53572
54102
|
*/
|
53573
54103
|
blendSourceAtop: function () {
|
53574
54104
|
|
53575
|
-
this.
|
54105
|
+
this.op = 'source-atop';
|
53576
54106
|
return this;
|
53577
54107
|
|
53578
54108
|
},
|
@@ -53585,7 +54115,7 @@ Phaser.BitmapData.prototype = {
|
|
53585
54115
|
*/
|
53586
54116
|
blendDestinationOver: function () {
|
53587
54117
|
|
53588
|
-
this.
|
54118
|
+
this.op = 'destination-over';
|
53589
54119
|
return this;
|
53590
54120
|
|
53591
54121
|
},
|
@@ -53598,7 +54128,7 @@ Phaser.BitmapData.prototype = {
|
|
53598
54128
|
*/
|
53599
54129
|
blendDestinationIn: function () {
|
53600
54130
|
|
53601
|
-
this.
|
54131
|
+
this.op = 'destination-in';
|
53602
54132
|
return this;
|
53603
54133
|
|
53604
54134
|
},
|
@@ -53611,7 +54141,7 @@ Phaser.BitmapData.prototype = {
|
|
53611
54141
|
*/
|
53612
54142
|
blendDestinationOut: function () {
|
53613
54143
|
|
53614
|
-
this.
|
54144
|
+
this.op = 'destination-out';
|
53615
54145
|
return this;
|
53616
54146
|
|
53617
54147
|
},
|
@@ -53624,7 +54154,7 @@ Phaser.BitmapData.prototype = {
|
|
53624
54154
|
*/
|
53625
54155
|
blendDestinationAtop: function () {
|
53626
54156
|
|
53627
|
-
this.
|
54157
|
+
this.op = 'destination-atop';
|
53628
54158
|
return this;
|
53629
54159
|
|
53630
54160
|
},
|
@@ -53637,7 +54167,7 @@ Phaser.BitmapData.prototype = {
|
|
53637
54167
|
*/
|
53638
54168
|
blendXor: function () {
|
53639
54169
|
|
53640
|
-
this.
|
54170
|
+
this.op = 'xor';
|
53641
54171
|
return this;
|
53642
54172
|
|
53643
54173
|
},
|
@@ -53650,7 +54180,7 @@ Phaser.BitmapData.prototype = {
|
|
53650
54180
|
*/
|
53651
54181
|
blendAdd: function () {
|
53652
54182
|
|
53653
|
-
this.
|
54183
|
+
this.op = 'lighter';
|
53654
54184
|
return this;
|
53655
54185
|
|
53656
54186
|
},
|
@@ -53663,7 +54193,7 @@ Phaser.BitmapData.prototype = {
|
|
53663
54193
|
*/
|
53664
54194
|
blendMultiply: function () {
|
53665
54195
|
|
53666
|
-
this.
|
54196
|
+
this.op = 'multiply';
|
53667
54197
|
return this;
|
53668
54198
|
|
53669
54199
|
},
|
@@ -53676,7 +54206,7 @@ Phaser.BitmapData.prototype = {
|
|
53676
54206
|
*/
|
53677
54207
|
blendScreen: function () {
|
53678
54208
|
|
53679
|
-
this.
|
54209
|
+
this.op = 'screen';
|
53680
54210
|
return this;
|
53681
54211
|
|
53682
54212
|
},
|
@@ -53689,7 +54219,7 @@ Phaser.BitmapData.prototype = {
|
|
53689
54219
|
*/
|
53690
54220
|
blendOverlay: function () {
|
53691
54221
|
|
53692
|
-
this.
|
54222
|
+
this.op = 'overlay';
|
53693
54223
|
return this;
|
53694
54224
|
|
53695
54225
|
},
|
@@ -53702,7 +54232,7 @@ Phaser.BitmapData.prototype = {
|
|
53702
54232
|
*/
|
53703
54233
|
blendDarken: function () {
|
53704
54234
|
|
53705
|
-
this.
|
54235
|
+
this.op = 'darken';
|
53706
54236
|
return this;
|
53707
54237
|
|
53708
54238
|
},
|
@@ -53715,7 +54245,7 @@ Phaser.BitmapData.prototype = {
|
|
53715
54245
|
*/
|
53716
54246
|
blendLighten: function () {
|
53717
54247
|
|
53718
|
-
this.
|
54248
|
+
this.op = 'lighten';
|
53719
54249
|
return this;
|
53720
54250
|
|
53721
54251
|
},
|
@@ -53728,7 +54258,7 @@ Phaser.BitmapData.prototype = {
|
|
53728
54258
|
*/
|
53729
54259
|
blendColorDodge: function () {
|
53730
54260
|
|
53731
|
-
this.
|
54261
|
+
this.op = 'color-dodge';
|
53732
54262
|
return this;
|
53733
54263
|
|
53734
54264
|
},
|
@@ -53741,7 +54271,7 @@ Phaser.BitmapData.prototype = {
|
|
53741
54271
|
*/
|
53742
54272
|
blendColorBurn: function () {
|
53743
54273
|
|
53744
|
-
this.
|
54274
|
+
this.op = 'color-burn';
|
53745
54275
|
return this;
|
53746
54276
|
|
53747
54277
|
},
|
@@ -53754,7 +54284,7 @@ Phaser.BitmapData.prototype = {
|
|
53754
54284
|
*/
|
53755
54285
|
blendHardLight: function () {
|
53756
54286
|
|
53757
|
-
this.
|
54287
|
+
this.op = 'hard-light';
|
53758
54288
|
return this;
|
53759
54289
|
|
53760
54290
|
},
|
@@ -53767,7 +54297,7 @@ Phaser.BitmapData.prototype = {
|
|
53767
54297
|
*/
|
53768
54298
|
blendSoftLight: function () {
|
53769
54299
|
|
53770
|
-
this.
|
54300
|
+
this.op = 'soft-light';
|
53771
54301
|
return this;
|
53772
54302
|
|
53773
54303
|
},
|
@@ -53780,7 +54310,7 @@ Phaser.BitmapData.prototype = {
|
|
53780
54310
|
*/
|
53781
54311
|
blendDifference: function () {
|
53782
54312
|
|
53783
|
-
this.
|
54313
|
+
this.op = 'difference';
|
53784
54314
|
return this;
|
53785
54315
|
|
53786
54316
|
},
|
@@ -53793,7 +54323,7 @@ Phaser.BitmapData.prototype = {
|
|
53793
54323
|
*/
|
53794
54324
|
blendExclusion: function () {
|
53795
54325
|
|
53796
|
-
this.
|
54326
|
+
this.op = 'exclusion';
|
53797
54327
|
return this;
|
53798
54328
|
|
53799
54329
|
},
|
@@ -53806,7 +54336,7 @@ Phaser.BitmapData.prototype = {
|
|
53806
54336
|
*/
|
53807
54337
|
blendHue: function () {
|
53808
54338
|
|
53809
|
-
this.
|
54339
|
+
this.op = 'hue';
|
53810
54340
|
return this;
|
53811
54341
|
|
53812
54342
|
},
|
@@ -53819,7 +54349,7 @@ Phaser.BitmapData.prototype = {
|
|
53819
54349
|
*/
|
53820
54350
|
blendSaturation: function () {
|
53821
54351
|
|
53822
|
-
this.
|
54352
|
+
this.op = 'saturation';
|
53823
54353
|
return this;
|
53824
54354
|
|
53825
54355
|
},
|
@@ -53832,7 +54362,7 @@ Phaser.BitmapData.prototype = {
|
|
53832
54362
|
*/
|
53833
54363
|
blendColor: function () {
|
53834
54364
|
|
53835
|
-
this.
|
54365
|
+
this.op = 'color';
|
53836
54366
|
return this;
|
53837
54367
|
|
53838
54368
|
},
|
@@ -53845,7 +54375,7 @@ Phaser.BitmapData.prototype = {
|
|
53845
54375
|
*/
|
53846
54376
|
blendLuminosity: function () {
|
53847
54377
|
|
53848
|
-
this.
|
54378
|
+
this.op = 'luminosity';
|
53849
54379
|
return this;
|
53850
54380
|
|
53851
54381
|
}
|
@@ -53872,6 +54402,26 @@ Object.defineProperty(Phaser.BitmapData.prototype, "smoothed", {
|
|
53872
54402
|
|
53873
54403
|
});
|
53874
54404
|
|
54405
|
+
/**
|
54406
|
+
* @memberof Phaser.BitmapData
|
54407
|
+
* @property {string} op - A short-hand code to get or set the global composite operation of the BitmapDatas canvas.
|
54408
|
+
*/
|
54409
|
+
Object.defineProperty(Phaser.BitmapData.prototype, "op", {
|
54410
|
+
|
54411
|
+
get: function () {
|
54412
|
+
|
54413
|
+
return this.context.globalCompositeOperation;
|
54414
|
+
|
54415
|
+
},
|
54416
|
+
|
54417
|
+
set: function (value) {
|
54418
|
+
|
54419
|
+
this.context.globalCompositeOperation = value;
|
54420
|
+
|
54421
|
+
}
|
54422
|
+
|
54423
|
+
});
|
54424
|
+
|
53875
54425
|
/**
|
53876
54426
|
* Gets a JavaScript object that has 6 properties set that are used by BitmapData in a transform.
|
53877
54427
|
*
|
@@ -54554,7 +55104,7 @@ PIXI.Graphics.prototype.generateTexture = function(resolution, scaleMode)
|
|
54554
55104
|
|
54555
55105
|
canvasBuffer.context.scale(resolution, resolution);
|
54556
55106
|
|
54557
|
-
canvasBuffer.context.translate(-bounds.x
|
55107
|
+
canvasBuffer.context.translate(-bounds.x, -bounds.y);
|
54558
55108
|
|
54559
55109
|
PIXI.CanvasGraphics.renderGraphics(this, canvasBuffer.context);
|
54560
55110
|
|
@@ -54724,84 +55274,84 @@ PIXI.Graphics.prototype._renderCanvas = function(renderSession)
|
|
54724
55274
|
*/
|
54725
55275
|
PIXI.Graphics.prototype.getBounds = function(matrix)
|
54726
55276
|
{
|
54727
|
-
if(!this._currentBounds)
|
55277
|
+
if (!this._currentBounds)
|
54728
55278
|
{
|
54729
|
-
|
54730
|
-
// return an empty object if the item is a mask!
|
55279
|
+
// Return an empty object if the item is a mask!
|
54731
55280
|
if (!this.renderable)
|
54732
55281
|
{
|
54733
55282
|
return PIXI.EmptyRectangle;
|
54734
55283
|
}
|
54735
55284
|
|
54736
|
-
|
54737
|
-
|
54738
|
-
|
54739
|
-
|
54740
|
-
|
54741
|
-
|
54742
|
-
|
55285
|
+
if (this.dirty)
|
55286
|
+
{
|
55287
|
+
this.updateLocalBounds();
|
55288
|
+
this.webGLDirty = true;
|
55289
|
+
this.cachedSpriteDirty = true;
|
55290
|
+
this.dirty = false;
|
55291
|
+
}
|
54743
55292
|
|
54744
|
-
|
55293
|
+
var bounds = this._localBounds;
|
54745
55294
|
|
54746
|
-
|
54747
|
-
|
55295
|
+
var w0 = bounds.x;
|
55296
|
+
var w1 = bounds.width + bounds.x;
|
54748
55297
|
|
54749
|
-
|
54750
|
-
|
55298
|
+
var h0 = bounds.y;
|
55299
|
+
var h1 = bounds.height + bounds.y;
|
54751
55300
|
|
54752
|
-
|
55301
|
+
var worldTransform = matrix || this.worldTransform;
|
54753
55302
|
|
54754
|
-
|
54755
|
-
|
54756
|
-
|
54757
|
-
|
54758
|
-
|
54759
|
-
|
55303
|
+
var a = worldTransform.a;
|
55304
|
+
var b = worldTransform.b;
|
55305
|
+
var c = worldTransform.c;
|
55306
|
+
var d = worldTransform.d;
|
55307
|
+
var tx = worldTransform.tx;
|
55308
|
+
var ty = worldTransform.ty;
|
54760
55309
|
|
54761
|
-
|
54762
|
-
|
55310
|
+
var x1 = a * w1 + c * h1 + tx;
|
55311
|
+
var y1 = d * h1 + b * w1 + ty;
|
54763
55312
|
|
54764
|
-
|
54765
|
-
|
55313
|
+
var x2 = a * w0 + c * h1 + tx;
|
55314
|
+
var y2 = d * h1 + b * w0 + ty;
|
54766
55315
|
|
54767
|
-
|
54768
|
-
|
55316
|
+
var x3 = a * w0 + c * h0 + tx;
|
55317
|
+
var y3 = d * h0 + b * w0 + ty;
|
54769
55318
|
|
54770
|
-
|
54771
|
-
|
55319
|
+
var x4 = a * w1 + c * h0 + tx;
|
55320
|
+
var y4 = d * h0 + b * w1 + ty;
|
54772
55321
|
|
54773
|
-
|
54774
|
-
|
55322
|
+
var maxX = x1;
|
55323
|
+
var maxY = y1;
|
54775
55324
|
|
54776
|
-
|
54777
|
-
|
55325
|
+
var minX = x1;
|
55326
|
+
var minY = y1;
|
54778
55327
|
|
54779
|
-
|
54780
|
-
|
54781
|
-
|
55328
|
+
minX = x2 < minX ? x2 : minX;
|
55329
|
+
minX = x3 < minX ? x3 : minX;
|
55330
|
+
minX = x4 < minX ? x4 : minX;
|
54782
55331
|
|
54783
|
-
|
54784
|
-
|
54785
|
-
|
55332
|
+
minY = y2 < minY ? y2 : minY;
|
55333
|
+
minY = y3 < minY ? y3 : minY;
|
55334
|
+
minY = y4 < minY ? y4 : minY;
|
54786
55335
|
|
54787
|
-
|
54788
|
-
|
54789
|
-
|
55336
|
+
maxX = x2 > maxX ? x2 : maxX;
|
55337
|
+
maxX = x3 > maxX ? x3 : maxX;
|
55338
|
+
maxX = x4 > maxX ? x4 : maxX;
|
54790
55339
|
|
54791
|
-
|
54792
|
-
|
54793
|
-
|
55340
|
+
maxY = y2 > maxY ? y2 : maxY;
|
55341
|
+
maxY = y3 > maxY ? y3 : maxY;
|
55342
|
+
maxY = y4 > maxY ? y4 : maxY;
|
54794
55343
|
|
54795
|
-
|
54796
|
-
|
55344
|
+
this._bounds.x = minX;
|
55345
|
+
this._bounds.width = maxX - minX;
|
54797
55346
|
|
54798
|
-
|
54799
|
-
|
55347
|
+
this._bounds.y = minY;
|
55348
|
+
this._bounds.height = maxY - minY;
|
54800
55349
|
|
54801
55350
|
this._currentBounds = this._bounds;
|
54802
55351
|
}
|
54803
55352
|
|
54804
55353
|
return this._currentBounds;
|
55354
|
+
|
54805
55355
|
};
|
54806
55356
|
|
54807
55357
|
/**
|
@@ -54828,7 +55378,7 @@ PIXI.Graphics.prototype.containsPoint = function( point )
|
|
54828
55378
|
// only deal with fills..
|
54829
55379
|
if (data.shape)
|
54830
55380
|
{
|
54831
|
-
if (
|
55381
|
+
if (data.shape.contains(tempPoint.x, tempPoint.y))
|
54832
55382
|
{
|
54833
55383
|
return true;
|
54834
55384
|
}
|
@@ -54836,6 +55386,7 @@ PIXI.Graphics.prototype.containsPoint = function( point )
|
|
54836
55386
|
}
|
54837
55387
|
|
54838
55388
|
return false;
|
55389
|
+
|
54839
55390
|
};
|
54840
55391
|
|
54841
55392
|
/**
|
@@ -55617,7 +56168,16 @@ Phaser.Text = function (game, x, y, text, style) {
|
|
55617
56168
|
|
55618
56169
|
x = x || 0;
|
55619
56170
|
y = y || 0;
|
55620
|
-
|
56171
|
+
|
56172
|
+
if (text === undefined || text === null)
|
56173
|
+
{
|
56174
|
+
text = '';
|
56175
|
+
}
|
56176
|
+
else
|
56177
|
+
{
|
56178
|
+
text = text.toString();
|
56179
|
+
}
|
56180
|
+
|
55621
56181
|
style = style || {};
|
55622
56182
|
|
55623
56183
|
/**
|
@@ -55650,7 +56210,7 @@ Phaser.Text = function (game, x, y, text, style) {
|
|
55650
56210
|
/**
|
55651
56211
|
* @property {HTMLCanvasElement} canvas - The canvas element that the text is rendered.
|
55652
56212
|
*/
|
55653
|
-
this.canvas =
|
56213
|
+
this.canvas = PIXI.CanvasPool.create(this);
|
55654
56214
|
|
55655
56215
|
/**
|
55656
56216
|
* @property {HTMLCanvasElement} context - The context of the canvas element that the text is rendered to.
|
@@ -55667,6 +56227,16 @@ Phaser.Text = function (game, x, y, text, style) {
|
|
55667
56227
|
*/
|
55668
56228
|
this.strokeColors = [];
|
55669
56229
|
|
56230
|
+
/**
|
56231
|
+
* @property {array} fontStyles - An array of the font styles values as specified by {@link Phaser.Text#addFontStyle addFontStyle}.
|
56232
|
+
*/
|
56233
|
+
this.fontStyles = [];
|
56234
|
+
|
56235
|
+
/**
|
56236
|
+
* @property {array} fontWeights - An array of the font weights values as specified by {@link Phaser.Text#addFontWeight addFontWeight}.
|
56237
|
+
*/
|
56238
|
+
this.fontWeights = [];
|
56239
|
+
|
55670
56240
|
/**
|
55671
56241
|
* Should the linePositionX and Y values be automatically rounded before rendering the Text?
|
55672
56242
|
* You may wish to enable this if you want to remove the effect of sub-pixel aliasing from text.
|
@@ -55768,15 +56338,17 @@ Phaser.Text.prototype.destroy = function (destroyChildren) {
|
|
55768
56338
|
|
55769
56339
|
this.texture.destroy(true);
|
55770
56340
|
|
55771
|
-
|
55772
|
-
|
55773
|
-
|
55774
|
-
|
55775
|
-
|
55776
|
-
|
55777
|
-
|
55778
|
-
|
55779
|
-
|
56341
|
+
PIXI.CanvasPool.remove(this);
|
56342
|
+
|
56343
|
+
// if (this.canvas && this.canvas.parentNode)
|
56344
|
+
// {
|
56345
|
+
// this.canvas.parentNode.removeChild(this.canvas);
|
56346
|
+
// }
|
56347
|
+
// else
|
56348
|
+
// {
|
56349
|
+
// this.canvas = null;
|
56350
|
+
// this.context = null;
|
56351
|
+
// }
|
55780
56352
|
|
55781
56353
|
Phaser.Component.Destroy.prototype.destroy.call(this, destroyChildren);
|
55782
56354
|
|
@@ -56049,7 +56621,7 @@ Phaser.Text.prototype.updateText = function () {
|
|
56049
56621
|
linePositionY = Math.round(linePositionY);
|
56050
56622
|
}
|
56051
56623
|
|
56052
|
-
if (this.colors.length > 0 || this.strokeColors.length > 0)
|
56624
|
+
if (this.colors.length > 0 || this.strokeColors.length > 0 || this.fontWeights.length > 0 || this.fontStyles.length > 0)
|
56053
56625
|
{
|
56054
56626
|
this.updateLine(lines[i], linePositionX, linePositionY);
|
56055
56627
|
}
|
@@ -56180,7 +56752,7 @@ Phaser.Text.prototype.updateShadow = function (state) {
|
|
56180
56752
|
};
|
56181
56753
|
|
56182
56754
|
/**
|
56183
|
-
* Updates a line of text, applying fill and stroke per-character colors if applicable.
|
56755
|
+
* Updates a line of text, applying fill and stroke per-character colors or style and weight per-character font if applicable.
|
56184
56756
|
*
|
56185
56757
|
* @method Phaser.Text#updateLine
|
56186
56758
|
* @private
|
@@ -56191,6 +56763,23 @@ Phaser.Text.prototype.updateLine = function (line, x, y) {
|
|
56191
56763
|
{
|
56192
56764
|
var letter = line[i];
|
56193
56765
|
|
56766
|
+
if (this.fontWeights.length > 0 || this.fontStyles.length > 0)
|
56767
|
+
{
|
56768
|
+
var components = this.fontToComponents(this.context.font);
|
56769
|
+
|
56770
|
+
if (this.fontStyles[this._charCount])
|
56771
|
+
{
|
56772
|
+
components.fontStyle = this.fontStyles[this._charCount];
|
56773
|
+
}
|
56774
|
+
|
56775
|
+
if (this.fontWeights[this._charCount])
|
56776
|
+
{
|
56777
|
+
components.fontWeight = this.fontWeights[this._charCount];
|
56778
|
+
}
|
56779
|
+
|
56780
|
+
this.context.font = this.componentsToFont(components);
|
56781
|
+
}
|
56782
|
+
|
56194
56783
|
if (this.style.stroke && this.style.strokeThickness)
|
56195
56784
|
{
|
56196
56785
|
if (this.strokeColors[this._charCount])
|
@@ -56236,6 +56825,22 @@ Phaser.Text.prototype.clearColors = function () {
|
|
56236
56825
|
|
56237
56826
|
};
|
56238
56827
|
|
56828
|
+
/**
|
56829
|
+
* Clears any text styles or weights font that were set by `addFontStyle` or `addFontWeight`.
|
56830
|
+
*
|
56831
|
+
* @method Phaser.Text#clearFontValues
|
56832
|
+
* @return {Phaser.Text} This Text instance.
|
56833
|
+
*/
|
56834
|
+
Phaser.Text.prototype.clearFontValues = function () {
|
56835
|
+
|
56836
|
+
this.fontStyles = [];
|
56837
|
+
this.fontWeights = [];
|
56838
|
+
this.dirty = true;
|
56839
|
+
|
56840
|
+
return this;
|
56841
|
+
|
56842
|
+
};
|
56843
|
+
|
56239
56844
|
/**
|
56240
56845
|
* Set specific colors for certain characters within the Text.
|
56241
56846
|
*
|
@@ -56286,6 +56891,54 @@ Phaser.Text.prototype.addStrokeColor = function (color, position) {
|
|
56286
56891
|
|
56287
56892
|
};
|
56288
56893
|
|
56894
|
+
/**
|
56895
|
+
* Set specific font styles for certain characters within the Text.
|
56896
|
+
*
|
56897
|
+
* It works by taking a font style value, which is a typical string such as `normal`, `italic` or `oblique`.
|
56898
|
+
* The position value is the index of the character in the Text string to start applying this font style to.
|
56899
|
+
* Once set the font style remains in use until either another font style or the end of the string is encountered.
|
56900
|
+
* For example if the Text was `Photon Storm` and you did `Text.addFontStyle('italic', 6)` it would font style in the word `Storm` in italic.
|
56901
|
+
*
|
56902
|
+
* If you wish to change the text font weight see addFontWeight instead.
|
56903
|
+
*
|
56904
|
+
* @method Phaser.Text#addFontStyle
|
56905
|
+
* @param {string} style - A canvas font-style that will be used on the text style eg `normal`, `italic`, `oblique`.
|
56906
|
+
* @param {number} position - The index of the character in the string to start applying this font style value from.
|
56907
|
+
* @return {Phaser.Text} This Text instance.
|
56908
|
+
*/
|
56909
|
+
Phaser.Text.prototype.addFontStyle = function (style, position) {
|
56910
|
+
|
56911
|
+
this.fontStyles[position] = style;
|
56912
|
+
this.dirty = true;
|
56913
|
+
|
56914
|
+
return this;
|
56915
|
+
|
56916
|
+
};
|
56917
|
+
|
56918
|
+
/**
|
56919
|
+
* Set specific font weights for certain characters within the Text.
|
56920
|
+
*
|
56921
|
+
* It works by taking a font weight value, which is a typical string such as `normal`, `bold`, `bolder`, etc.
|
56922
|
+
* The position value is the index of the character in the Text string to start applying this font weight to.
|
56923
|
+
* Once set the font weight remains in use until either another font weight or the end of the string is encountered.
|
56924
|
+
* For example if the Text was `Photon Storm` and you did `Text.addFontWeight('bold', 6)` it would font weight in the word `Storm` in bold.
|
56925
|
+
*
|
56926
|
+
* If you wish to change the text font style see addFontStyle instead.
|
56927
|
+
*
|
56928
|
+
* @method Phaser.Text#addFontWeight
|
56929
|
+
* @param {string} style - A canvas font-weight that will be used on the text weight eg `normal`, `bold`, `bolder`, `lighter`, etc.
|
56930
|
+
* @param {number} position - The index of the character in the string to start applying this font weight value from.
|
56931
|
+
* @return {Phaser.Text} This Text instance.
|
56932
|
+
*/
|
56933
|
+
Phaser.Text.prototype.addFontWeight = function (weight, position) {
|
56934
|
+
|
56935
|
+
this.fontWeights[position] = weight;
|
56936
|
+
this.dirty = true;
|
56937
|
+
|
56938
|
+
return this;
|
56939
|
+
|
56940
|
+
};
|
56941
|
+
|
56289
56942
|
/**
|
56290
56943
|
* Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds.
|
56291
56944
|
*
|
@@ -56613,20 +57266,20 @@ Phaser.Text.prototype.updateTexture = function () {
|
|
56613
57266
|
// Align the canvas based on the bounds
|
56614
57267
|
if (this.style.boundsAlignH === 'right')
|
56615
57268
|
{
|
56616
|
-
x
|
57269
|
+
x += this.textBounds.width - this.canvas.width;
|
56617
57270
|
}
|
56618
57271
|
else if (this.style.boundsAlignH === 'center')
|
56619
57272
|
{
|
56620
|
-
x
|
57273
|
+
x += this.textBounds.halfWidth - (this.canvas.width / 2);
|
56621
57274
|
}
|
56622
57275
|
|
56623
57276
|
if (this.style.boundsAlignV === 'bottom')
|
56624
57277
|
{
|
56625
|
-
y
|
57278
|
+
y += this.textBounds.height - this.canvas.height;
|
56626
57279
|
}
|
56627
57280
|
else if (this.style.boundsAlignV === 'middle')
|
56628
57281
|
{
|
56629
|
-
y
|
57282
|
+
y += this.textBounds.halfHeight - (this.canvas.height / 2);
|
56630
57283
|
}
|
56631
57284
|
|
56632
57285
|
this.pivot.x = -x;
|
@@ -56636,6 +57289,8 @@ Phaser.Text.prototype.updateTexture = function () {
|
|
56636
57289
|
// Can't render something with a zero sized dimension
|
56637
57290
|
this.renderable = (w !== 0 && h !== 0);
|
56638
57291
|
|
57292
|
+
this.texture.requiresReTint = true;
|
57293
|
+
|
56639
57294
|
this.texture.baseTexture.dirty();
|
56640
57295
|
|
56641
57296
|
};
|
@@ -57457,7 +58112,7 @@ Object.defineProperty(Phaser.Text.prototype, 'height', {
|
|
57457
58112
|
|
57458
58113
|
Phaser.Text.fontPropertiesCache = {};
|
57459
58114
|
|
57460
|
-
Phaser.Text.fontPropertiesCanvas =
|
58115
|
+
Phaser.Text.fontPropertiesCanvas = PIXI.CanvasPool.create(Phaser.Text.fontPropertiesCanvas);
|
57461
58116
|
Phaser.Text.fontPropertiesContext = Phaser.Text.fontPropertiesCanvas.getContext('2d');
|
57462
58117
|
|
57463
58118
|
/**
|
@@ -57837,8 +58492,6 @@ Phaser.BitmapText.prototype.updateText = function () {
|
|
57837
58492
|
{
|
57838
58493
|
// Sprite already exists in the glyphs pool, so we'll reuse it for this letter
|
57839
58494
|
g.texture = charData.texture;
|
57840
|
-
// g.name = line.text[c];
|
57841
|
-
// console.log('reusing', g.name, 'as', line.text[c]);
|
57842
58495
|
}
|
57843
58496
|
else
|
57844
58497
|
{
|
@@ -57846,7 +58499,6 @@ Phaser.BitmapText.prototype.updateText = function () {
|
|
57846
58499
|
g = new PIXI.Sprite(charData.texture);
|
57847
58500
|
g.name = line.text[c];
|
57848
58501
|
this._glyphs.push(g);
|
57849
|
-
// console.log('new', line.text[c]);
|
57850
58502
|
}
|
57851
58503
|
|
57852
58504
|
g.position.x = (line.chars[c] + align) - ax;
|
@@ -57854,6 +58506,7 @@ Phaser.BitmapText.prototype.updateText = function () {
|
|
57854
58506
|
|
57855
58507
|
g.scale.set(scale);
|
57856
58508
|
g.tint = this.tint;
|
58509
|
+
g.texture.requiresReTint = true;
|
57857
58510
|
|
57858
58511
|
if (!g.parent)
|
57859
58512
|
{
|
@@ -57990,6 +58643,7 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'font', {
|
|
57990
58643
|
if (value !== this._font)
|
57991
58644
|
{
|
57992
58645
|
this._font = value.trim();
|
58646
|
+
this._data = this.game.cache.getBitmapFont(this._font);
|
57993
58647
|
this.updateText();
|
57994
58648
|
}
|
57995
58649
|
|
@@ -58076,6 +58730,39 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'maxWidth', {
|
|
58076
58730
|
|
58077
58731
|
});
|
58078
58732
|
|
58733
|
+
/**
|
58734
|
+
* Enable or disable texture smoothing for this BitmapText.
|
58735
|
+
*
|
58736
|
+
* The smoothing is applied to the BaseTexture of this font, which all letters of the text reference.
|
58737
|
+
*
|
58738
|
+
* Smoothing is enabled by default.
|
58739
|
+
*
|
58740
|
+
* @name Phaser.BitmapText#smoothed
|
58741
|
+
* @property {boolean} smoothed
|
58742
|
+
*/
|
58743
|
+
Object.defineProperty(Phaser.BitmapText.prototype, 'smoothed', {
|
58744
|
+
|
58745
|
+
get: function() {
|
58746
|
+
|
58747
|
+
return !this._data.base.scaleMode;
|
58748
|
+
|
58749
|
+
},
|
58750
|
+
|
58751
|
+
set: function(value) {
|
58752
|
+
|
58753
|
+
if (value)
|
58754
|
+
{
|
58755
|
+
this._data.base.scaleMode = 0;
|
58756
|
+
}
|
58757
|
+
else
|
58758
|
+
{
|
58759
|
+
this._data.base.scaleMode = 1;
|
58760
|
+
}
|
58761
|
+
|
58762
|
+
}
|
58763
|
+
|
58764
|
+
});
|
58765
|
+
|
58079
58766
|
/**
|
58080
58767
|
* @author Richard Davey <rich@photonstorm.com>
|
58081
58768
|
* @copyright 2015 Photon Storm Ltd.
|
@@ -60257,7 +60944,7 @@ Phaser.Device._initialize = function () {
|
|
60257
60944
|
return false;
|
60258
60945
|
}
|
60259
60946
|
|
60260
|
-
var elem =
|
60947
|
+
var elem = PIXI.CanvasPool.create(this, 1, 1);
|
60261
60948
|
var ctx = elem.getContext('2d');
|
60262
60949
|
|
60263
60950
|
if (!ctx)
|
@@ -60267,6 +60954,8 @@ Phaser.Device._initialize = function () {
|
|
60267
60954
|
|
60268
60955
|
var image = ctx.createImageData(1, 1);
|
60269
60956
|
|
60957
|
+
PIXI.CanvasPool.remove(this);
|
60958
|
+
|
60270
60959
|
return image.data instanceof Uint8ClampedArray;
|
60271
60960
|
|
60272
60961
|
}
|
@@ -60880,7 +61569,8 @@ Phaser.Device.whenReady(function (device) {
|
|
60880
61569
|
*/
|
60881
61570
|
|
60882
61571
|
/**
|
60883
|
-
* The Canvas class handles everything related to creating the `canvas` DOM tag that Phaser will use,
|
61572
|
+
* The Canvas class handles everything related to creating the `canvas` DOM tag that Phaser will use,
|
61573
|
+
* including styles, offset and aspect ratio.
|
60884
61574
|
*
|
60885
61575
|
* @class Phaser.Canvas
|
60886
61576
|
* @static
|
@@ -60891,17 +61581,26 @@ Phaser.Canvas = {
|
|
60891
61581
|
* Creates a `canvas` DOM element. The element is not automatically added to the document.
|
60892
61582
|
*
|
60893
61583
|
* @method Phaser.Canvas.create
|
61584
|
+
* @param {object} parent - The object that will own the canvas that is created.
|
60894
61585
|
* @param {number} [width=256] - The width of the canvas element.
|
60895
61586
|
* @param {number} [height=256] - The height of the canvas element..
|
60896
61587
|
* @param {string} [id=(none)] - If specified, and not the empty string, this will be set as the ID of the canvas element. Otherwise no ID will be set.
|
61588
|
+
* @param {boolean} [skipPool=false] - If `true` the canvas will not be placed in the CanvasPool global.
|
60897
61589
|
* @return {HTMLCanvasElement} The newly created canvas element.
|
60898
61590
|
*/
|
60899
|
-
create: function (width, height, id) {
|
61591
|
+
create: function (parent, width, height, id, skipPool) {
|
60900
61592
|
|
60901
61593
|
width = width || 256;
|
60902
61594
|
height = height || 256;
|
60903
61595
|
|
60904
|
-
|
61596
|
+
if (skipPool === undefined)
|
61597
|
+
{
|
61598
|
+
var canvas = PIXI.CanvasPool.create(parent, width, height);
|
61599
|
+
}
|
61600
|
+
else
|
61601
|
+
{
|
61602
|
+
var canvas = document.createElement('canvas');
|
61603
|
+
}
|
60905
61604
|
|
60906
61605
|
if (typeof id === 'string' && id !== '')
|
60907
61606
|
{
|
@@ -60910,7 +61609,6 @@ Phaser.Canvas = {
|
|
60910
61609
|
|
60911
61610
|
canvas.width = width;
|
60912
61611
|
canvas.height = height;
|
60913
|
-
|
60914
61612
|
canvas.style.display = 'block';
|
60915
61613
|
|
60916
61614
|
return canvas;
|
@@ -63197,6 +63895,19 @@ Phaser.TweenManager = function (game) {
|
|
63197
63895
|
*/
|
63198
63896
|
this.game = game;
|
63199
63897
|
|
63898
|
+
/**
|
63899
|
+
* Are all newly created Tweens frame or time based? A frame based tween will use the physics elapsed timer when updating. This means
|
63900
|
+
* it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should
|
63901
|
+
* be given in frames.
|
63902
|
+
*
|
63903
|
+
* If the Tween uses a time based update (which is the default) then the duration is given in milliseconds.
|
63904
|
+
* In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween
|
63905
|
+
* has actually been through. For very short tweens you may wish to experiment with a frame based update instead.
|
63906
|
+
* @property {boolean} frameBased
|
63907
|
+
* @default
|
63908
|
+
*/
|
63909
|
+
this.frameBased = false;
|
63910
|
+
|
63200
63911
|
/**
|
63201
63912
|
* @property {array<Phaser.Tween>} _tweens - All of the currently running tweens.
|
63202
63913
|
* @private
|
@@ -63655,6 +64366,22 @@ Phaser.Tween = function (target, game, manager) {
|
|
63655
64366
|
*/
|
63656
64367
|
this.isPaused = false;
|
63657
64368
|
|
64369
|
+
/**
|
64370
|
+
* Is this Tween frame or time based? A frame based tween will use the physics elapsed timer when updating. This means
|
64371
|
+
* it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should
|
64372
|
+
* be given in frames.
|
64373
|
+
*
|
64374
|
+
* If the Tween uses a time based update (which is the default) then the duration is given in milliseconds.
|
64375
|
+
* In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween
|
64376
|
+
* has actually been through. For very short tweens you may wish to experiment with a frame based update instead.
|
64377
|
+
*
|
64378
|
+
* The default value is whatever you've set in TweenManager.frameBased.
|
64379
|
+
*
|
64380
|
+
* @property {boolean} frameBased
|
64381
|
+
* @default
|
64382
|
+
*/
|
64383
|
+
this.frameBased = manager.frameBased;
|
64384
|
+
|
63658
64385
|
/**
|
63659
64386
|
* @property {function} _onUpdateCallback - An onUpdate callback.
|
63660
64387
|
* @private
|
@@ -63699,7 +64426,7 @@ Phaser.Tween.prototype = {
|
|
63699
64426
|
*
|
63700
64427
|
* @method Phaser.Tween#to
|
63701
64428
|
* @param {object} properties - An object containing the properties you want to tween, such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
|
63702
|
-
* @param {number} [duration=1000] - Duration of this tween in ms.
|
64429
|
+
* @param {number} [duration=1000] - Duration of this tween in ms. Or if `Tween.frameBased` is true this represents the number of frames that should elapse.
|
63703
64430
|
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
|
63704
64431
|
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
|
63705
64432
|
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
|
@@ -63746,7 +64473,7 @@ Phaser.Tween.prototype = {
|
|
63746
64473
|
*
|
63747
64474
|
* @method Phaser.Tween#from
|
63748
64475
|
* @param {object} properties - An object containing the properties you want to tween., such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
|
63749
|
-
* @param {number} [duration=1000] - Duration of this tween in ms.
|
64476
|
+
* @param {number} [duration=1000] - Duration of this tween in ms. Or if `Tween.frameBased` is true this represents the number of frames that should elapse.
|
63750
64477
|
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
|
63751
64478
|
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
|
63752
64479
|
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
|
@@ -64781,14 +65508,16 @@ Phaser.TweenData.prototype = {
|
|
64781
65508
|
}
|
64782
65509
|
}
|
64783
65510
|
|
65511
|
+
var ms = (this.parent.frameBased) ? this.game.time.physicsElapsedMS : this.game.time.elapsedMS;
|
65512
|
+
|
64784
65513
|
if (this.parent.reverse)
|
64785
65514
|
{
|
64786
|
-
this.dt -=
|
65515
|
+
this.dt -= ms * this.parent.timeScale;
|
64787
65516
|
this.dt = Math.max(this.dt, 0);
|
64788
65517
|
}
|
64789
65518
|
else
|
64790
65519
|
{
|
64791
|
-
this.dt +=
|
65520
|
+
this.dt += ms * this.parent.timeScale;
|
64792
65521
|
this.dt = Math.min(this.dt, this.duration);
|
64793
65522
|
}
|
64794
65523
|
|
@@ -69726,6 +70455,10 @@ Phaser.Cache.prototype = {
|
|
69726
70455
|
*/
|
69727
70456
|
addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax, margin, spacing) {
|
69728
70457
|
|
70458
|
+
if (frameMax === undefined) { frameMax = -1; }
|
70459
|
+
if (margin === undefined) { margin = 0; }
|
70460
|
+
if (spacing === undefined) { spacing = 0; }
|
70461
|
+
|
69729
70462
|
var obj = {
|
69730
70463
|
key: key,
|
69731
70464
|
url: url,
|
@@ -70538,7 +71271,7 @@ Phaser.Cache.prototype = {
|
|
70538
71271
|
*
|
70539
71272
|
* @method Phaser.Cache#getRenderTexture
|
70540
71273
|
* @param {string} key - The key of the asset to retrieve from the cache.
|
70541
|
-
* @return {
|
71274
|
+
* @return {Object} The object with Phaser.RenderTexture and Phaser.Frame.
|
70542
71275
|
*/
|
70543
71276
|
getRenderTexture: function (key) {
|
70544
71277
|
|
@@ -71864,6 +72597,51 @@ Phaser.Loader.prototype = {
|
|
71864
72597
|
|
71865
72598
|
},
|
71866
72599
|
|
72600
|
+
/**
|
72601
|
+
* Adds an array of images to the current load queue.
|
72602
|
+
*
|
72603
|
+
* It works by passing each element of the array to the Loader.image method.
|
72604
|
+
*
|
72605
|
+
* The files are **not** loaded immediately after calling this method. The files are added to the queue ready to be loaded when the loader starts.
|
72606
|
+
*
|
72607
|
+
* Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle.
|
72608
|
+
*
|
72609
|
+
* The keys must be unique Strings. They are used to add the files to the Phaser.Cache upon successful load.
|
72610
|
+
*
|
72611
|
+
* Retrieve the images via `Cache.getImage(key)`
|
72612
|
+
*
|
72613
|
+
* The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it.
|
72614
|
+
*
|
72615
|
+
* If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien"
|
72616
|
+
* and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension.
|
72617
|
+
* If you do not desire this action then provide a URL.
|
72618
|
+
*
|
72619
|
+
* @method Phaser.Loader#images
|
72620
|
+
* @param {array} keys - An array of unique asset keys of the image files.
|
72621
|
+
* @param {array} [urls] - Optional array of URLs. If undefined or `null` the url will be set to `<key>.png`, i.e. if `key` was "alien" then the URL will be "alien.png". If provided the URLs array length must match the keys array length.
|
72622
|
+
* @return {Phaser.Loader} This Loader instance.
|
72623
|
+
*/
|
72624
|
+
images: function (keys, urls) {
|
72625
|
+
|
72626
|
+
if (Array.isArray(urls))
|
72627
|
+
{
|
72628
|
+
for (var i = 0; i < keys.length; i++)
|
72629
|
+
{
|
72630
|
+
this.image(keys[i], urls[i]);
|
72631
|
+
}
|
72632
|
+
}
|
72633
|
+
else
|
72634
|
+
{
|
72635
|
+
for (var i = 0; i < keys.length; i++)
|
72636
|
+
{
|
72637
|
+
this.image(keys[i]);
|
72638
|
+
}
|
72639
|
+
}
|
72640
|
+
|
72641
|
+
return this;
|
72642
|
+
|
72643
|
+
},
|
72644
|
+
|
71867
72645
|
/**
|
71868
72646
|
* Adds a Text file to the current load queue.
|
71869
72647
|
*
|
@@ -72422,6 +73200,7 @@ Phaser.Loader.prototype = {
|
|
72422
73200
|
* @return {Phaser.Loader} This Loader instance.
|
72423
73201
|
*/
|
72424
73202
|
bitmapFont: function (key, textureURL, atlasURL, atlasData, xSpacing, ySpacing) {
|
73203
|
+
|
72425
73204
|
if (textureURL === undefined || textureURL === null)
|
72426
73205
|
{
|
72427
73206
|
textureURL = key + '.png';
|
@@ -73289,6 +74068,7 @@ Phaser.Loader.prototype = {
|
|
73289
74068
|
_this.fileComplete(file);
|
73290
74069
|
}
|
73291
74070
|
};
|
74071
|
+
|
73292
74072
|
file.data.onerror = function () {
|
73293
74073
|
if (file.data.onload)
|
73294
74074
|
{
|
@@ -76492,7 +77272,7 @@ Phaser.Utils.Debug.prototype = {
|
|
76492
77272
|
this.sprite = this.game.make.image(0, 0, this.bmd);
|
76493
77273
|
this.game.stage.addChild(this.sprite);
|
76494
77274
|
|
76495
|
-
this.canvas =
|
77275
|
+
this.canvas = PIXI.CanvasPool.create(this, this.game.width, this.game.height);
|
76496
77276
|
this.context = this.canvas.getContext('2d');
|
76497
77277
|
}
|
76498
77278
|
|
@@ -76738,7 +77518,7 @@ Phaser.Utils.Debug.prototype = {
|
|
76738
77518
|
// Render the text
|
76739
77519
|
this.line('ID: ' + pointer.id + " Active: " + pointer.active);
|
76740
77520
|
this.line('World X: ' + pointer.worldX + " World Y: " + pointer.worldY);
|
76741
|
-
this.line('Screen X: ' + pointer.x + " Screen Y: " + pointer.y);
|
77521
|
+
this.line('Screen X: ' + pointer.x + " Screen Y: " + pointer.y + " In: " + pointer.withinGame);
|
76742
77522
|
this.line('Duration: ' + pointer.duration + " ms");
|
76743
77523
|
this.line('is Down: ' + pointer.isDown + " is Up: " + pointer.isUp);
|
76744
77524
|
this.stop();
|
@@ -77196,6 +77976,17 @@ Phaser.Utils.Debug.prototype = {
|
|
77196
77976
|
Phaser.Physics.Box2D.renderBody(this.context, body, color);
|
77197
77977
|
this.stop();
|
77198
77978
|
|
77979
|
+
},
|
77980
|
+
|
77981
|
+
/**
|
77982
|
+
* Destroy this object.
|
77983
|
+
*
|
77984
|
+
* @method Phaser.Utils.Debug#destroy
|
77985
|
+
*/
|
77986
|
+
destroy: function () {
|
77987
|
+
|
77988
|
+
PIXI.CanvasPool.remove(this);
|
77989
|
+
|
77199
77990
|
}
|
77200
77991
|
|
77201
77992
|
};
|
@@ -77502,7 +78293,7 @@ Phaser.ArrayUtils = {
|
|
77502
78293
|
* Fetch a random entry from the given array.
|
77503
78294
|
*
|
77504
78295
|
* Will return null if there are no array items that fall within the specified range
|
77505
|
-
* or if there is no item for the randomly
|
78296
|
+
* or if there is no item for the randomly chosen index.
|
77506
78297
|
*
|
77507
78298
|
* @method
|
77508
78299
|
* @param {any[]} objects - An array of objects.
|
@@ -77512,14 +78303,12 @@ Phaser.ArrayUtils = {
|
|
77512
78303
|
*/
|
77513
78304
|
getRandomItem: function (objects, startIndex, length) {
|
77514
78305
|
|
77515
|
-
if (objects
|
77516
|
-
return null;
|
77517
|
-
}
|
77518
|
-
|
78306
|
+
if (objects === null) { return null; }
|
77519
78307
|
if (startIndex === undefined) { startIndex = 0; }
|
77520
78308
|
if (length === undefined) { length = objects.length; }
|
77521
78309
|
|
77522
78310
|
var randomIndex = startIndex + Math.floor(Math.random() * length);
|
78311
|
+
|
77523
78312
|
return objects[randomIndex] === undefined ? null : objects[randomIndex];
|
77524
78313
|
|
77525
78314
|
},
|
@@ -77528,7 +78317,7 @@ Phaser.ArrayUtils = {
|
|
77528
78317
|
* Removes a random object from the given array and returns it.
|
77529
78318
|
*
|
77530
78319
|
* Will return null if there are no array items that fall within the specified range
|
77531
|
-
* or if there is no item for the randomly
|
78320
|
+
* or if there is no item for the randomly chosen index.
|
77532
78321
|
*
|
77533
78322
|
* @method
|
77534
78323
|
* @param {any[]} objects - An array of objects.
|
@@ -77614,7 +78403,7 @@ Phaser.ArrayUtils = {
|
|
77614
78403
|
*
|
77615
78404
|
* @method
|
77616
78405
|
* @param {Array<any[]>} matrix - The array to rotate; this matrix _may_ be altered.
|
77617
|
-
* @param {number|string} direction - The amount to rotate: the
|
78406
|
+
* @param {number|string} direction - The amount to rotate: the rotation in degrees (90, -90, 270, -270, 180) or a string command ('rotateLeft', 'rotateRight' or 'rotate180').
|
77618
78407
|
* @return {Array<any[]>} The rotated matrix. The source matrix should be discarded for the returned matrix.
|
77619
78408
|
*/
|
77620
78409
|
rotateMatrix: function (matrix, direction) {
|
@@ -77723,14 +78512,14 @@ Phaser.ArrayUtils = {
|
|
77723
78512
|
* Create an array of numbers (positive and/or negative) progressing from `start`
|
77724
78513
|
* up to but not including `end` by advancing by `step`.
|
77725
78514
|
*
|
77726
|
-
* If `start` is less than `
|
78515
|
+
* If `start` is less than `end` a zero-length range is created unless a negative `step` is specified.
|
77727
78516
|
*
|
77728
78517
|
* Certain values for `start` and `end` (eg. NaN/undefined/null) are currently coerced to 0;
|
77729
78518
|
* for forward compatibility make sure to pass in actual numbers.
|
77730
78519
|
*
|
77731
78520
|
* @method Phaser.ArrayUtils#numberArrayStep
|
77732
78521
|
* @param {number} start - The start of the range.
|
77733
|
-
* @param {number} end - The end of the range.
|
78522
|
+
* @param {number} [end] - The end of the range.
|
77734
78523
|
* @param {number} [step=1] - The value to increment or decrement by.
|
77735
78524
|
* @returns {Array} Returns the new array of numbers.
|
77736
78525
|
* @example
|
@@ -77752,39 +78541,24 @@ Phaser.ArrayUtils = {
|
|
77752
78541
|
* Phaser.ArrayUtils.numberArrayStep(0);
|
77753
78542
|
* // => []
|
77754
78543
|
*/
|
77755
|
-
numberArrayStep: function(start, end, step) {
|
77756
|
-
|
77757
|
-
start = +start || 0;
|
78544
|
+
numberArrayStep: function (start, end, step) {
|
77758
78545
|
|
77759
|
-
|
77760
|
-
var type = typeof end;
|
78546
|
+
if (start === undefined || start === null) { start = 0; }
|
77761
78547
|
|
77762
|
-
if (
|
77763
|
-
{
|
77764
|
-
end = step = null;
|
77765
|
-
}
|
77766
|
-
|
77767
|
-
step = step == null ? 1 : (+step || 0);
|
77768
|
-
|
77769
|
-
if (end === null)
|
78548
|
+
if (end === undefined || end === null)
|
77770
78549
|
{
|
77771
78550
|
end = start;
|
77772
78551
|
start = 0;
|
77773
78552
|
}
|
77774
|
-
else
|
77775
|
-
{
|
77776
|
-
end = +end || 0;
|
77777
|
-
}
|
77778
78553
|
|
77779
|
-
|
77780
|
-
|
77781
|
-
var
|
77782
|
-
var
|
77783
|
-
var result = new Array(length);
|
78554
|
+
if (step === undefined) { step = 1; }
|
78555
|
+
|
78556
|
+
var result = [];
|
78557
|
+
var total = Math.max(Phaser.Math.roundAwayFromZero((end - start) / (step || 1)), 0);
|
77784
78558
|
|
77785
|
-
|
78559
|
+
for (var i = 0; i < total; i++)
|
77786
78560
|
{
|
77787
|
-
result
|
78561
|
+
result.push(start);
|
77788
78562
|
start += step;
|
77789
78563
|
}
|
77790
78564
|
|
@@ -80079,8 +80853,8 @@ Phaser.Physics.Arcade.prototype = {
|
|
80079
80853
|
* @method Phaser.Physics.Arcade#overlap
|
80080
80854
|
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|array} object1 - The first object or array of objects to check. Can be Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
|
80081
80855
|
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|array} object2 - The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
|
80082
|
-
* @param {function} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them
|
80083
|
-
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then overlapCallback will only be called if
|
80856
|
+
* @param {function} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter.
|
80857
|
+
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`.
|
80084
80858
|
* @param {object} [callbackContext] - The context in which to run the callbacks.
|
80085
80859
|
* @return {boolean} True if an overlap occurred otherwise false.
|
80086
80860
|
*/
|
@@ -85730,6 +86504,7 @@ Phaser.Physics.P2.Body.prototype = {
|
|
85730
86504
|
|
85731
86505
|
/**
|
85732
86506
|
* Apply impulse to a point local to the body.
|
86507
|
+
*
|
85733
86508
|
* This could for example be a point on the Body surface. An impulse is a force added to a body during a short
|
85734
86509
|
* period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.
|
85735
86510
|
*
|
@@ -85738,14 +86513,17 @@ Phaser.Physics.P2.Body.prototype = {
|
|
85738
86513
|
* @param {number} localX - A local point on the body.
|
85739
86514
|
* @param {number} localY - A local point on the body.
|
85740
86515
|
*/
|
85741
|
-
applyImpulseLocal: function (
|
86516
|
+
applyImpulseLocal: function (impulse, localX, localY) {
|
85742
86517
|
|
85743
|
-
this.data.applyImpulseLocal(
|
86518
|
+
this.data.applyImpulseLocal(impulse, [this.world.pxmi(localX), this.world.pxmi(localY)]);
|
85744
86519
|
|
85745
86520
|
},
|
85746
86521
|
|
85747
86522
|
/**
|
85748
|
-
* Apply force to a world point.
|
86523
|
+
* Apply force to a world point.
|
86524
|
+
*
|
86525
|
+
* This could for example be a point on the RigidBody surface. Applying force
|
86526
|
+
* this way will add to Body.force and Body.angularForce.
|
85749
86527
|
*
|
85750
86528
|
* @method Phaser.Physics.P2.Body#applyForce
|
85751
86529
|
* @param {Float32Array|Array} force - The force vector to add.
|
@@ -86681,11 +87459,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "static", {
|
|
86681
87459
|
else if (!value && this.data.type === Phaser.Physics.P2.Body.STATIC)
|
86682
87460
|
{
|
86683
87461
|
this.data.type = Phaser.Physics.P2.Body.DYNAMIC;
|
86684
|
-
|
86685
|
-
if (this.mass === 0)
|
86686
|
-
{
|
86687
|
-
this.mass = 1;
|
86688
|
-
}
|
87462
|
+
this.mass = 1;
|
86689
87463
|
}
|
86690
87464
|
|
86691
87465
|
}
|
@@ -86709,11 +87483,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "dynamic", {
|
|
86709
87483
|
if (value && this.data.type !== Phaser.Physics.P2.Body.DYNAMIC)
|
86710
87484
|
{
|
86711
87485
|
this.data.type = Phaser.Physics.P2.Body.DYNAMIC;
|
86712
|
-
|
86713
|
-
if (this.mass === 0)
|
86714
|
-
{
|
86715
|
-
this.mass = 1;
|
86716
|
-
}
|
87486
|
+
this.mass = 1;
|
86717
87487
|
}
|
86718
87488
|
else if (!value && this.data.type === Phaser.Physics.P2.Body.DYNAMIC)
|
86719
87489
|
{
|
@@ -87166,7 +87936,7 @@ Phaser.Physics.P2.BodyDebug = function(game, body, settings) {
|
|
87166
87936
|
* @private
|
87167
87937
|
*/
|
87168
87938
|
var defaultSettings = {
|
87169
|
-
pixelsPerLengthUnit:
|
87939
|
+
pixelsPerLengthUnit: game.physics.p2.mpx(1),
|
87170
87940
|
debugPolygons: false,
|
87171
87941
|
lineWidth: 1,
|
87172
87942
|
alpha: 0.5
|
@@ -89033,50 +89803,46 @@ Phaser.Tilemap.prototype = {
|
|
89033
89803
|
return;
|
89034
89804
|
}
|
89035
89805
|
|
89036
|
-
var
|
89037
|
-
var found = false;
|
89038
|
-
|
89039
|
-
for (var i = 0, len = this.objects[name].length; i < len; i++)
|
89806
|
+
for (var i = 0; i < this.objects[name].length; i++)
|
89040
89807
|
{
|
89041
|
-
|
89808
|
+
var found = false;
|
89809
|
+
var obj = this.objects[name][i];
|
89810
|
+
|
89811
|
+
if (obj.gid !== undefined && typeof gid === 'number' && obj.gid === gid)
|
89042
89812
|
{
|
89043
|
-
|
89044
|
-
{
|
89045
|
-
found = true;
|
89046
|
-
}
|
89813
|
+
found = true;
|
89047
89814
|
}
|
89048
|
-
|
89049
|
-
if (typeof this.objects[name][i].id !== 'undefined' && typeof gid === 'number')
|
89815
|
+
else if (obj.id !== undefined && typeof gid === 'number' && obj.id === gid)
|
89050
89816
|
{
|
89051
|
-
|
89052
|
-
{
|
89053
|
-
found = true;
|
89054
|
-
}
|
89817
|
+
found = true;
|
89055
89818
|
}
|
89056
|
-
|
89057
|
-
if (typeof this.objects[name][i].name !== 'undefined' && typeof gid === 'string')
|
89819
|
+
else if (obj.name !== undefined && typeof gid === 'string' && obj.name === gid)
|
89058
89820
|
{
|
89059
|
-
|
89060
|
-
{
|
89061
|
-
found = true;
|
89062
|
-
}
|
89821
|
+
found = true;
|
89063
89822
|
}
|
89064
89823
|
|
89065
89824
|
if (found)
|
89066
89825
|
{
|
89067
|
-
sprite = new CustomClass(this.game,
|
89826
|
+
var sprite = new CustomClass(this.game, parseFloat(obj.x, 10), parseFloat(obj.y, 10), key, frame);
|
89068
89827
|
|
89069
|
-
sprite.name =
|
89070
|
-
sprite.visible =
|
89828
|
+
sprite.name = obj.name;
|
89829
|
+
sprite.visible = obj.visible;
|
89071
89830
|
sprite.autoCull = autoCull;
|
89072
89831
|
sprite.exists = exists;
|
89073
89832
|
|
89074
|
-
|
89075
|
-
|
89833
|
+
if (obj.width)
|
89834
|
+
{
|
89835
|
+
sprite.width = obj.width;
|
89836
|
+
}
|
89837
|
+
|
89838
|
+
if (obj.height)
|
89839
|
+
{
|
89840
|
+
sprite.height = obj.height;
|
89841
|
+
}
|
89076
89842
|
|
89077
|
-
if (
|
89843
|
+
if (obj.rotation)
|
89078
89844
|
{
|
89079
|
-
sprite.angle =
|
89845
|
+
sprite.angle = obj.rotation;
|
89080
89846
|
}
|
89081
89847
|
|
89082
89848
|
if (adjustY)
|
@@ -89086,9 +89852,9 @@ Phaser.Tilemap.prototype = {
|
|
89086
89852
|
|
89087
89853
|
group.add(sprite);
|
89088
89854
|
|
89089
|
-
for (var property in
|
89855
|
+
for (var property in obj.properties)
|
89090
89856
|
{
|
89091
|
-
group.set(sprite, property,
|
89857
|
+
group.set(sprite, property, obj.properties[property], false, false, 0, true);
|
89092
89858
|
}
|
89093
89859
|
}
|
89094
89860
|
}
|
@@ -90435,7 +91201,7 @@ Phaser.Tilemap.prototype = {
|
|
90435
91201
|
}
|
90436
91202
|
}
|
90437
91203
|
|
90438
|
-
Phaser.
|
91204
|
+
Phaser.ArrayUtils.shuffle(indexes);
|
90439
91205
|
|
90440
91206
|
for (var i = 1; i < this._results.length; i++)
|
90441
91207
|
{
|
@@ -90629,7 +91395,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
|
|
90629
91395
|
* @property {HTMLCanvasElement} canvas
|
90630
91396
|
* @protected
|
90631
91397
|
*/
|
90632
|
-
this.canvas =
|
91398
|
+
this.canvas = PIXI.CanvasPool.create(this, width, height);
|
90633
91399
|
|
90634
91400
|
/**
|
90635
91401
|
* The 2d context of the canvas.
|
@@ -90828,6 +91594,7 @@ Phaser.TilemapLayer.sharedCopyCanvas = null;
|
|
90828
91594
|
*
|
90829
91595
|
* Code that uses the canvas is responsible to ensure the dimensions and save/restore state as appropriate.
|
90830
91596
|
*
|
91597
|
+
* @method Phaser.TilemapLayer#ensureSharedCopyCanvas
|
90831
91598
|
* @protected
|
90832
91599
|
* @static
|
90833
91600
|
*/
|
@@ -90845,8 +91612,7 @@ Phaser.TilemapLayer.ensureSharedCopyCanvas = function () {
|
|
90845
91612
|
/**
|
90846
91613
|
* Automatically called by World.preUpdate.
|
90847
91614
|
*
|
90848
|
-
* @method Phaser.
|
90849
|
-
* @memberof Phaser.Image
|
91615
|
+
* @method Phaser.TilemapLayer#preUpdate
|
90850
91616
|
*/
|
90851
91617
|
Phaser.TilemapLayer.prototype.preUpdate = function() {
|
90852
91618
|
|
@@ -90874,6 +91640,19 @@ Phaser.TilemapLayer.prototype.postUpdate = function () {
|
|
90874
91640
|
|
90875
91641
|
};
|
90876
91642
|
|
91643
|
+
/**
|
91644
|
+
* Destroys this TilemapLayer.
|
91645
|
+
*
|
91646
|
+
* @method Phaser.TilemapLayer#destroy
|
91647
|
+
*/
|
91648
|
+
Phaser.TilemapLayer.prototype.destroy = function() {
|
91649
|
+
|
91650
|
+
PIXI.CanvasPool.remove(this);
|
91651
|
+
|
91652
|
+
Phaser.Component.Destroy.prototype.destroy.call(this);
|
91653
|
+
|
91654
|
+
};
|
91655
|
+
|
90877
91656
|
/**
|
90878
91657
|
* Resizes the internal canvas and texture frame used by this TilemapLayer.
|
90879
91658
|
*
|
@@ -91856,9 +92635,22 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
|
|
91856
92635
|
* Phaser.TilemapParser parses data objects from Phaser.Loader that need more preparation before they can be inserted into a Tilemap.
|
91857
92636
|
*
|
91858
92637
|
* @class Phaser.TilemapParser
|
92638
|
+
* @static
|
91859
92639
|
*/
|
91860
92640
|
Phaser.TilemapParser = {
|
91861
92641
|
|
92642
|
+
/**
|
92643
|
+
* When scanning the Tiled map data the TilemapParser can either insert a null value (true) or
|
92644
|
+
* a Phaser.Tile instance with an index of -1 (false, the default). Depending on your game type
|
92645
|
+
* depends how this should be configured. If you've a large sparsely populated map and the tile
|
92646
|
+
* data doesn't need to change then setting this value to `true` will help with memory consumption.
|
92647
|
+
* However if your map is small, or you need to update the tiles (perhaps the map dynamically changes
|
92648
|
+
* during the game) then leave the default value set.
|
92649
|
+
*
|
92650
|
+
* @type {boolean}
|
92651
|
+
*/
|
92652
|
+
INSERT_NULL: false,
|
92653
|
+
|
91862
92654
|
/**
|
91863
92655
|
* Parse tilemap data from the cache and creates a Tilemap object.
|
91864
92656
|
*
|
@@ -92065,17 +92857,19 @@ Phaser.TilemapParser = {
|
|
92065
92857
|
continue;
|
92066
92858
|
}
|
92067
92859
|
|
92860
|
+
var curl = json.layers[i];
|
92861
|
+
|
92068
92862
|
var layer = {
|
92069
92863
|
|
92070
|
-
name:
|
92071
|
-
x:
|
92072
|
-
y:
|
92073
|
-
width:
|
92074
|
-
height:
|
92075
|
-
widthInPixels:
|
92076
|
-
heightInPixels:
|
92077
|
-
alpha:
|
92078
|
-
visible:
|
92864
|
+
name: curl.name,
|
92865
|
+
x: curl.x,
|
92866
|
+
y: curl.y,
|
92867
|
+
width: curl.width,
|
92868
|
+
height: curl.height,
|
92869
|
+
widthInPixels: curl.width * json.tilewidth,
|
92870
|
+
heightInPixels: curl.height * json.tileheight,
|
92871
|
+
alpha: curl.opacity,
|
92872
|
+
visible: curl.visible,
|
92079
92873
|
properties: {},
|
92080
92874
|
indexes: [],
|
92081
92875
|
callbacks: [],
|
@@ -92083,9 +92877,9 @@ Phaser.TilemapParser = {
|
|
92083
92877
|
|
92084
92878
|
};
|
92085
92879
|
|
92086
|
-
if (
|
92880
|
+
if (curl.properties)
|
92087
92881
|
{
|
92088
|
-
layer.properties =
|
92882
|
+
layer.properties = curl.properties;
|
92089
92883
|
}
|
92090
92884
|
|
92091
92885
|
var x = 0;
|
@@ -92099,11 +92893,11 @@ Phaser.TilemapParser = {
|
|
92099
92893
|
// If the map contains multiple tilesets then the indexes are relative to that which the set starts from.
|
92100
92894
|
// Need to set which tileset in the cache = which tileset in the JSON, if you do this manually it means you can use the same map data but a new tileset.
|
92101
92895
|
|
92102
|
-
for (var t = 0, len =
|
92896
|
+
for (var t = 0, len = curl.data.length; t < len; t++)
|
92103
92897
|
{
|
92104
92898
|
rotation = 0;
|
92105
92899
|
flipped = false;
|
92106
|
-
gid =
|
92900
|
+
gid = curl.data[t];
|
92107
92901
|
|
92108
92902
|
// If true the current tile is flipped or rotated (Tiled TMX format)
|
92109
92903
|
if (gid > 0x20000000)
|
@@ -92170,12 +92964,19 @@ Phaser.TilemapParser = {
|
|
92170
92964
|
}
|
92171
92965
|
else
|
92172
92966
|
{
|
92173
|
-
|
92967
|
+
if (Phaser.TilemapParser.INSERT_NULL)
|
92968
|
+
{
|
92969
|
+
row.push(null);
|
92970
|
+
}
|
92971
|
+
else
|
92972
|
+
{
|
92973
|
+
row.push(new Phaser.Tile(layer, -1, x, output.length, json.tilewidth, json.tileheight));
|
92974
|
+
}
|
92174
92975
|
}
|
92175
92976
|
|
92176
92977
|
x++;
|
92177
92978
|
|
92178
|
-
if (x ===
|
92979
|
+
if (x === curl.width)
|
92179
92980
|
{
|
92180
92981
|
output.push(row);
|
92181
92982
|
x = 0;
|
@@ -92201,21 +93002,23 @@ Phaser.TilemapParser = {
|
|
92201
93002
|
continue;
|
92202
93003
|
}
|
92203
93004
|
|
93005
|
+
var curi = json.layers[i];
|
93006
|
+
|
92204
93007
|
var image = {
|
92205
93008
|
|
92206
|
-
name:
|
92207
|
-
image:
|
92208
|
-
x:
|
92209
|
-
y:
|
92210
|
-
alpha:
|
92211
|
-
visible:
|
93009
|
+
name: curi.name,
|
93010
|
+
image: curi.image,
|
93011
|
+
x: curi.x,
|
93012
|
+
y: curi.y,
|
93013
|
+
alpha: curi.opacity,
|
93014
|
+
visible: curi.visible,
|
92212
93015
|
properties: {}
|
92213
93016
|
|
92214
93017
|
};
|
92215
93018
|
|
92216
|
-
if (
|
93019
|
+
if (curi.properties)
|
92217
93020
|
{
|
92218
|
-
image.properties =
|
93021
|
+
image.properties = curi.properties;
|
92219
93022
|
}
|
92220
93023
|
|
92221
93024
|
images.push(image);
|
@@ -92294,95 +93097,97 @@ Phaser.TilemapParser = {
|
|
92294
93097
|
continue;
|
92295
93098
|
}
|
92296
93099
|
|
92297
|
-
|
92298
|
-
collision[json.layers[i].name] = [];
|
93100
|
+
var curo = json.layers[i];
|
92299
93101
|
|
92300
|
-
|
93102
|
+
objects[curo.name] = [];
|
93103
|
+
collision[curo.name] = [];
|
93104
|
+
|
93105
|
+
for (var v = 0, len = curo.objects.length; v < len; v++)
|
92301
93106
|
{
|
92302
93107
|
// Object Tiles
|
92303
|
-
if (
|
93108
|
+
if (curo.objects[v].gid)
|
92304
93109
|
{
|
92305
93110
|
var object = {
|
92306
93111
|
|
92307
|
-
gid:
|
92308
|
-
name:
|
92309
|
-
type:
|
92310
|
-
x:
|
92311
|
-
y:
|
92312
|
-
visible:
|
92313
|
-
properties:
|
93112
|
+
gid: curo.objects[v].gid,
|
93113
|
+
name: curo.objects[v].name,
|
93114
|
+
type: curo.objects[v].hasOwnProperty("type") ? curo.objects[v].type : "",
|
93115
|
+
x: curo.objects[v].x,
|
93116
|
+
y: curo.objects[v].y,
|
93117
|
+
visible: curo.objects[v].visible,
|
93118
|
+
properties: curo.objects[v].properties
|
92314
93119
|
|
92315
93120
|
};
|
92316
93121
|
|
92317
|
-
if (
|
93122
|
+
if (curo.objects[v].rotation)
|
92318
93123
|
{
|
92319
|
-
object.rotation =
|
93124
|
+
object.rotation = curo.objects[v].rotation;
|
92320
93125
|
}
|
92321
93126
|
|
92322
|
-
objects[
|
93127
|
+
objects[curo.name].push(object);
|
92323
93128
|
}
|
92324
|
-
else if (
|
93129
|
+
else if (curo.objects[v].polyline)
|
92325
93130
|
{
|
92326
93131
|
var object = {
|
92327
93132
|
|
92328
|
-
name:
|
92329
|
-
type:
|
92330
|
-
x:
|
92331
|
-
y:
|
92332
|
-
width:
|
92333
|
-
height:
|
92334
|
-
visible:
|
92335
|
-
properties:
|
93133
|
+
name: curo.objects[v].name,
|
93134
|
+
type: curo.objects[v].type,
|
93135
|
+
x: curo.objects[v].x,
|
93136
|
+
y: curo.objects[v].y,
|
93137
|
+
width: curo.objects[v].width,
|
93138
|
+
height: curo.objects[v].height,
|
93139
|
+
visible: curo.objects[v].visible,
|
93140
|
+
properties: curo.objects[v].properties
|
92336
93141
|
|
92337
93142
|
};
|
92338
93143
|
|
92339
|
-
if (
|
93144
|
+
if (curo.objects[v].rotation)
|
92340
93145
|
{
|
92341
|
-
object.rotation =
|
93146
|
+
object.rotation = curo.objects[v].rotation;
|
92342
93147
|
}
|
92343
93148
|
|
92344
93149
|
object.polyline = [];
|
92345
93150
|
|
92346
93151
|
// Parse the polyline into an array
|
92347
|
-
for (var p = 0; p <
|
93152
|
+
for (var p = 0; p < curo.objects[v].polyline.length; p++)
|
92348
93153
|
{
|
92349
|
-
object.polyline.push([
|
93154
|
+
object.polyline.push([ curo.objects[v].polyline[p].x, curo.objects[v].polyline[p].y ]);
|
92350
93155
|
}
|
92351
93156
|
|
92352
|
-
collision[
|
92353
|
-
objects[
|
93157
|
+
collision[curo.name].push(object);
|
93158
|
+
objects[curo.name].push(object);
|
92354
93159
|
}
|
92355
93160
|
// polygon
|
92356
|
-
else if (
|
93161
|
+
else if (curo.objects[v].polygon)
|
92357
93162
|
{
|
92358
|
-
var object = slice(
|
93163
|
+
var object = slice(curo.objects[v],
|
92359
93164
|
["name", "type", "x", "y", "visible", "rotation", "properties" ]);
|
92360
93165
|
|
92361
93166
|
// Parse the polygon into an array
|
92362
93167
|
object.polygon = [];
|
92363
93168
|
|
92364
|
-
for (var p = 0; p <
|
93169
|
+
for (var p = 0; p < curo.objects[v].polygon.length; p++)
|
92365
93170
|
{
|
92366
|
-
object.polygon.push([
|
93171
|
+
object.polygon.push([ curo.objects[v].polygon[p].x, curo.objects[v].polygon[p].y ]);
|
92367
93172
|
}
|
92368
93173
|
|
92369
|
-
objects[
|
93174
|
+
objects[curo.name].push(object);
|
92370
93175
|
|
92371
93176
|
}
|
92372
93177
|
// ellipse
|
92373
|
-
else if (
|
93178
|
+
else if (curo.objects[v].ellipse)
|
92374
93179
|
{
|
92375
|
-
var object = slice(
|
93180
|
+
var object = slice(curo.objects[v],
|
92376
93181
|
["name", "type", "ellipse", "x", "y", "width", "height", "visible", "rotation", "properties" ]);
|
92377
|
-
objects[
|
93182
|
+
objects[curo.name].push(object);
|
92378
93183
|
}
|
92379
93184
|
// otherwise it's a rectangle
|
92380
93185
|
else
|
92381
93186
|
{
|
92382
|
-
var object = slice(
|
93187
|
+
var object = slice(curo.objects[v],
|
92383
93188
|
["name", "type", "x", "y", "width", "height", "visible", "rotation", "properties" ]);
|
92384
93189
|
object.rectangle = true;
|
92385
|
-
objects[
|
93190
|
+
objects[curo.name].push(object);
|
92386
93191
|
}
|
92387
93192
|
}
|
92388
93193
|
}
|
@@ -92459,7 +93264,7 @@ Phaser.TilemapParser = {
|
|
92459
93264
|
{
|
92460
93265
|
tile = row[k];
|
92461
93266
|
|
92462
|
-
if (tile.index < 0)
|
93267
|
+
if (tile === null || tile.index < 0)
|
92463
93268
|
{
|
92464
93269
|
continue;
|
92465
93270
|
}
|
@@ -94121,7 +94926,14 @@ Phaser.Video.prototype = {
|
|
94121
94926
|
|
94122
94927
|
if (this.videoStream !== null)
|
94123
94928
|
{
|
94124
|
-
this.videoStream
|
94929
|
+
if (this.videoStream['active'])
|
94930
|
+
{
|
94931
|
+
this.videoStream.active = false;
|
94932
|
+
}
|
94933
|
+
else
|
94934
|
+
{
|
94935
|
+
this.videoStream.stop();
|
94936
|
+
}
|
94125
94937
|
}
|
94126
94938
|
|
94127
94939
|
this.removeVideoElement();
|
@@ -94500,7 +95312,15 @@ Phaser.Video.prototype = {
|
|
94500
95312
|
else
|
94501
95313
|
{
|
94502
95314
|
this.video.src = "";
|
94503
|
-
|
95315
|
+
|
95316
|
+
if (this.videoStream['active'])
|
95317
|
+
{
|
95318
|
+
this.videoStream.active = false;
|
95319
|
+
}
|
95320
|
+
else
|
95321
|
+
{
|
95322
|
+
this.videoStream.stop();
|
95323
|
+
}
|
94504
95324
|
}
|
94505
95325
|
|
94506
95326
|
this.videoStream = null;
|
@@ -94508,7 +95328,8 @@ Phaser.Video.prototype = {
|
|
94508
95328
|
}
|
94509
95329
|
else
|
94510
95330
|
{
|
94511
|
-
this.video.removeEventListener('ended', this.complete.bind(this));
|
95331
|
+
this.video.removeEventListener('ended', this.complete.bind(this), true);
|
95332
|
+
this.video.removeEventListener('playing', this.playHandler.bind(this), true);
|
94512
95333
|
|
94513
95334
|
if (this.touchLocked)
|
94514
95335
|
{
|