phaser-rails 2.0.6.0 → 2.0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f77d2a740f25a0d70b526899a741d2ba2d53b7ec
4
- data.tar.gz: 90ebac5406064d959e60f788195332b85009d97f
3
+ metadata.gz: ad20d979c521a22e4dd9090ea75497f1f07fc428
4
+ data.tar.gz: 92ded2e214c681dd57a07a124c017f575f03d701
5
5
  SHA512:
6
- metadata.gz: 446c8559a88f45f32fd32261963102c5f8ecfdc261c2403c10f1368b333a684488c275172cd520f1cde3e96c56f7d32cb5c0476e65d78dc35aba1454a01aae66
7
- data.tar.gz: 85a17f6ee61e6ada1cc1ea06ceb03dffe470a95e7068b070581695a9b4c0925e489b53a70b1a3bb2085e87d4b8d66f40e14478178a0da2cbd72f2a86103259b3
6
+ metadata.gz: 751b22b398feec497c2c3c6454c6a3f62be43c938e90fc6640750bed9d10feaa29e76e16d083b7cc81d31c0265c71d2fde2039b3d8220e33a29937fb6e42c02a
7
+ data.tar.gz: ff32fdf557b5bc60d18b7adfa36116f34b1d1b0d219bc479322953eb159be783e58846dbfa2aa6b15bc40eb327583a98e14cb5f506e55411f9becbe3cd6f84c2
@@ -1,5 +1,5 @@
1
1
  module Phaser
2
2
  module Rails
3
- VERSION = "2.0.6.0"
3
+ VERSION = "2.0.7.0"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Phaser - http://phaser.io
9
9
  *
10
- * v2.0.6 "Jornhill" - Built: Thu Jul 10 2014 20:17:38
10
+ * v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 12:35:30
11
11
  *
12
12
  * By Richard Davey http://www.photonstorm.com @photonstorm
13
13
  *
@@ -54,7 +54,7 @@ PIXI.WEBGL_RENDERER = 0;
54
54
  PIXI.CANVAS_RENDERER = 1;
55
55
 
56
56
  // useful for testing against if your lib is using pixi.
57
- PIXI.VERSION = "v1.6";
57
+ PIXI.VERSION = "v1.6.1";
58
58
 
59
59
 
60
60
  // the various blend modes supported by pixi
@@ -88,8 +88,16 @@ PIXI.scaleModes = {
88
88
  // used to create uids for various pixi objects..
89
89
  PIXI._UID = 0;
90
90
 
91
- PIXI.Float32Array = Float32Array || Array;
92
- PIXI.Uint16Array = Uint16Array || Array;
91
+ if(typeof(Float32Array) != 'undefined')
92
+ {
93
+ PIXI.Float32Array = Float32Array;
94
+ PIXI.Uint16Array = Uint16Array;
95
+ }
96
+ else
97
+ {
98
+ PIXI.Float32Array = Array;
99
+ PIXI.Uint16Array = Array;
100
+ }
93
101
 
94
102
  // interaction frequency
95
103
  PIXI.INTERACTION_FREQUENCY = 30;
@@ -108,7 +116,7 @@ PIXI.sayHello = function (type)
108
116
  if ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 )
109
117
  {
110
118
  var args = [
111
- '%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://pixijs.com %c %c ♥%c♥%c♥ ',
119
+ '%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ ',
112
120
  'background: #ff66a5',
113
121
  'background: #ff66a5',
114
122
  'color: #ff66a5; background: #030307;',
@@ -126,7 +134,7 @@ PIXI.sayHello = function (type)
126
134
  }
127
135
  else if (window['console'])
128
136
  {
129
- console.log('Pixi.js ' + PIXI.VERSION + ' - http://pixjs.com');
137
+ console.log('Pixi.js ' + PIXI.VERSION + ' - http://www.pixijs.com/');
130
138
  }
131
139
 
132
140
  PIXI.dontSayHello = true;
@@ -1298,7 +1306,19 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
1298
1306
  return this.scale.x * this.getLocalBounds().width;
1299
1307
  },
1300
1308
  set: function(value) {
1301
- this.scale.x = value / (this.getLocalBounds().width/this.scale.x);
1309
+
1310
+ var width = this.getLocalBounds().width;
1311
+
1312
+ if(width !== 0)
1313
+ {
1314
+ this.scale.x = value / ( width/this.scale.x );
1315
+ }
1316
+ else
1317
+ {
1318
+ this.scale.x = 1;
1319
+ }
1320
+
1321
+
1302
1322
  this._width = value;
1303
1323
  }
1304
1324
  });
@@ -1316,7 +1336,18 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
1316
1336
  return this.scale.y * this.getLocalBounds().height;
1317
1337
  },
1318
1338
  set: function(value) {
1319
- this.scale.y = value / (this.getLocalBounds().height/this.scale.y);
1339
+
1340
+ var height = this.getLocalBounds().height;
1341
+
1342
+ if(height !== 0)
1343
+ {
1344
+ this.scale.y = value / ( height/this.scale.y );
1345
+ }
1346
+ else
1347
+ {
1348
+ this.scale.y = 1;
1349
+ }
1350
+
1320
1351
  this._height = value;
1321
1352
  }
1322
1353
  });
@@ -1837,17 +1868,7 @@ Object.defineProperty(PIXI.Sprite.prototype, 'height', {
1837
1868
  */
1838
1869
  PIXI.Sprite.prototype.setTexture = function(texture)
1839
1870
  {
1840
- // stop current texture;
1841
- if(this.texture.baseTexture !== texture.baseTexture)
1842
- {
1843
- this.textureChange = true;
1844
- this.texture = texture;
1845
- }
1846
- else
1847
- {
1848
- this.texture = texture;
1849
- }
1850
-
1871
+ this.texture = texture;
1851
1872
  this.cachedTint = 0xFFFFFF;
1852
1873
  };
1853
1874
 
@@ -2438,15 +2459,62 @@ PIXI.Text = function(text, style)
2438
2459
 
2439
2460
  this.setText(text);
2440
2461
  this.setStyle(style);
2441
-
2442
- this.updateText();
2443
- this.dirty = false;
2444
2462
  };
2445
2463
 
2446
2464
  // constructor
2447
2465
  PIXI.Text.prototype = Object.create(PIXI.Sprite.prototype);
2448
2466
  PIXI.Text.prototype.constructor = PIXI.Text;
2449
2467
 
2468
+
2469
+ /**
2470
+ * The width of the sprite, setting this will actually modify the scale to achieve the value set
2471
+ *
2472
+ * @property width
2473
+ * @type Number
2474
+ */
2475
+ Object.defineProperty(PIXI.Text.prototype, 'width', {
2476
+ get: function() {
2477
+
2478
+ if(this.dirty)
2479
+ {
2480
+ this.updateText();
2481
+ this.dirty = false;
2482
+ }
2483
+
2484
+
2485
+ return this.scale.x * this.texture.frame.width;
2486
+ },
2487
+ set: function(value) {
2488
+ this.scale.x = value / this.texture.frame.width;
2489
+ this._width = value;
2490
+ }
2491
+ });
2492
+
2493
+ /**
2494
+ * The height of the Text, setting this will actually modify the scale to achieve the value set
2495
+ *
2496
+ * @property height
2497
+ * @type Number
2498
+ */
2499
+ Object.defineProperty(PIXI.Text.prototype, 'height', {
2500
+ get: function() {
2501
+
2502
+ if(this.dirty)
2503
+ {
2504
+ this.updateText();
2505
+ this.dirty = false;
2506
+ }
2507
+
2508
+
2509
+ return this.scale.y * this.texture.frame.height;
2510
+ },
2511
+ set: function(value) {
2512
+ this.scale.y = value / this.texture.frame.height;
2513
+ this._height = value;
2514
+ }
2515
+ });
2516
+
2517
+
2450
2518
  /**
2451
2519
  * Set the style of the text
2452
2520
  *
@@ -4614,7 +4682,7 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
4614
4682
  }
4615
4683
  else if(data.type === PIXI.Graphics.RREC)
4616
4684
  {
4617
- PIXI.WebGLGraphics.buildRoundedRectangle(data, webGL);
4685
+ PIXI.WebGLGraphics.buildRoundedRectangle(data, webGLData);
4618
4686
  }
4619
4687
  }
4620
4688
 
@@ -4738,53 +4806,6 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
4738
4806
  */
4739
4807
  PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
4740
4808
  {
4741
- /**
4742
- * Calcul the points for a quadratic bezier curve.
4743
- * Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
4744
- *
4745
- * @param {number} fromX Origin point x
4746
- * @param {number} fromY Origin point x
4747
- * @param {number} cpX Control point x
4748
- * @param {number} cpY Control point y
4749
- * @param {number} toX Destination point x
4750
- * @param {number} toY Destination point y
4751
- * @return {number[]}
4752
- */
4753
- function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
4754
- var xa,
4755
- ya,
4756
- xb,
4757
- yb,
4758
- x,
4759
- y,
4760
- n = 20,
4761
- points = [];
4762
-
4763
- function getPt(n1 , n2, perc) {
4764
- var diff = n2 - n1;
4765
-
4766
- return n1 + ( diff * perc );
4767
- }
4768
-
4769
- var j = 0;
4770
- for (var i = 0; i <= n; i++ )
4771
- {
4772
- j = i / n;
4773
-
4774
- // The Green Line
4775
- xa = getPt( fromX , cpX , j );
4776
- ya = getPt( fromY , cpY , j );
4777
- xb = getPt( cpX , toX , j );
4778
- yb = getPt( cpY , toY , j );
4779
-
4780
- // The Black Dot
4781
- x = getPt( xa , xb , j );
4782
- y = getPt( ya , yb , j );
4783
-
4784
- points.push(x, y);
4785
- }
4786
- return points;
4787
- }
4788
4809
 
4789
4810
  var points = graphicsData.points;
4790
4811
  var x = points[0];
@@ -4796,10 +4817,10 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
4796
4817
 
4797
4818
  var recPoints = [];
4798
4819
  recPoints.push(x, y + radius);
4799
- recPoints = recPoints.concat(quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
4800
- recPoints = recPoints.concat(quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
4801
- recPoints = recPoints.concat(quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
4802
- recPoints = recPoints.concat(quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
4820
+ recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
4821
+ recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
4822
+ recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
4823
+ recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
4803
4824
 
4804
4825
 
4805
4826
  if (graphicsData.fill) {
@@ -4844,6 +4865,53 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
4844
4865
  }
4845
4866
  };
4846
4867
 
4868
+ /**
4869
+ * Calcul the points for a quadratic bezier curve. (helper function..)
4870
+ * Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
4871
+ *
4872
+ * @param {number} fromX Origin point x
4873
+ * @param {number} fromY Origin point x
4874
+ * @param {number} cpX Control point x
4875
+ * @param {number} cpY Control point y
4876
+ * @param {number} toX Destination point x
4877
+ * @param {number} toY Destination point y
4878
+ * @return {number[]}
4879
+ */
4880
+ PIXI.WebGLGraphics.quadraticBezierCurve = function(fromX, fromY, cpX, cpY, toX, toY) {
4881
+ var xa,
4882
+ ya,
4883
+ xb,
4884
+ yb,
4885
+ x,
4886
+ y,
4887
+ n = 20,
4888
+ points = [];
4889
+
4890
+ function getPt(n1 , n2, perc) {
4891
+ var diff = n2 - n1;
4892
+
4893
+ return n1 + ( diff * perc );
4894
+ }
4895
+
4896
+ var j = 0;
4897
+ for (var i = 0; i <= n; i++ )
4898
+ {
4899
+ j = i / n;
4900
+
4901
+ // The Green Line
4902
+ xa = getPt( fromX , cpX , j );
4903
+ ya = getPt( fromY , cpY , j );
4904
+ xb = getPt( cpX , toX , j );
4905
+ yb = getPt( cpY , toY , j );
4906
+
4907
+ // The Black Dot
4908
+ x = getPt( xa , xb , j );
4909
+ y = getPt( ya , yb , j );
4910
+
4911
+ points.push(x, y);
4912
+ }
4913
+ return points;
4914
+ };
4847
4915
 
4848
4916
  /**
4849
4917
  * Builds a circle to draw
@@ -6487,6 +6555,9 @@ PIXI.WebGLSpriteBatch = function(gl)
6487
6555
  this.setContext(gl);
6488
6556
 
6489
6557
  this.dirty = true;
6558
+
6559
+ this.textures = [];
6560
+ this.blendModes = [];
6490
6561
  };
6491
6562
 
6492
6563
  /**
@@ -6549,15 +6620,14 @@ PIXI.WebGLSpriteBatch.prototype.end = function()
6549
6620
  PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
6550
6621
  {
6551
6622
  var texture = sprite.texture;
6552
-
6553
- var blendChange = this.renderSession.blendModeManager.currentBlendMode !== sprite.blendMode;
6554
-
6623
+
6624
+ //TODO set blend modes..
6555
6625
  // check texture..
6556
- if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size || blendChange)
6626
+ if(this.currentBatchSize >= this.size)
6557
6627
  {
6628
+ //return;
6558
6629
  this.flush();
6559
6630
  this.currentBaseTexture = texture.baseTexture;
6560
- this.renderSession.blendModeManager.setBlendMode(sprite.blendMode);
6561
6631
  }
6562
6632
 
6563
6633
  // get the uvs for the texture
@@ -6601,7 +6671,7 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
6601
6671
 
6602
6672
  var index = this.currentBatchSize * 4 * this.vertSize;
6603
6673
 
6604
- var worldTransform = sprite.worldTransform;//.toArray();
6674
+ var worldTransform = sprite.worldTransform;
6605
6675
 
6606
6676
  var a = worldTransform.a;//[0];
6607
6677
  var b = worldTransform.c;//[3];
@@ -6651,8 +6721,10 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
6651
6721
  verticies[index++] = tint;
6652
6722
 
6653
6723
  // increment the batchsize
6654
- this.currentBatchSize++;
6724
+ this.textures[this.currentBatchSize] = sprite.texture.baseTexture;
6725
+ this.blendModes[this.currentBatchSize] = sprite.blendMode;
6655
6726
 
6727
+ this.currentBatchSize++;
6656
6728
 
6657
6729
  };
6658
6730
 
@@ -6666,14 +6738,13 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
6666
6738
  {
6667
6739
  var texture = tilingSprite.tilingTexture;
6668
6740
 
6669
- var blendChange = this.renderSession.blendModeManager.currentBlendMode !== tilingSprite.blendMode;
6670
-
6741
+
6671
6742
  // check texture..
6672
- if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size || blendChange)
6743
+ if(this.currentBatchSize >= this.size)
6673
6744
  {
6745
+ //return;
6674
6746
  this.flush();
6675
6747
  this.currentBaseTexture = texture.baseTexture;
6676
- this.renderSession.blendModeManager.setBlendMode(tilingSprite.blendMode);
6677
6748
  }
6678
6749
 
6679
6750
  // set the textures uvs temporarily
@@ -6714,8 +6785,8 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
6714
6785
  var height = tilingSprite.height;
6715
6786
 
6716
6787
  // TODO trim??
6717
- var aX = tilingSprite.anchor.x; // - tilingSprite.texture.trim.x
6718
- var aY = tilingSprite.anchor.y; //- tilingSprite.texture.trim.y
6788
+ var aX = tilingSprite.anchor.x;
6789
+ var aY = tilingSprite.anchor.y;
6719
6790
  var w0 = width * (1-aX);
6720
6791
  var w1 = width * -aX;
6721
6792
 
@@ -6744,7 +6815,7 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
6744
6815
  verticies[index++] = tint;
6745
6816
 
6746
6817
  // xy
6747
- verticies[index++] = a * w0 + c * h1 + tx;
6818
+ verticies[index++] = (a * w0 + c * h1 + tx);
6748
6819
  verticies[index++] = d * h1 + b * w0 + ty;
6749
6820
  // uv
6750
6821
  verticies[index++] = uvs.x1;
@@ -6774,6 +6845,8 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
6774
6845
  verticies[index++] = tint;
6775
6846
 
6776
6847
  // increment the batchs
6848
+ this.textures[this.currentBatchSize] = texture.baseTexture;
6849
+ this.blendModes[this.currentBatchSize] = tilingSprite.blendMode;
6777
6850
  this.currentBatchSize++;
6778
6851
  };
6779
6852
 
@@ -6790,10 +6863,9 @@ PIXI.WebGLSpriteBatch.prototype.flush = function()
6790
6863
  if (this.currentBatchSize===0)return;
6791
6864
 
6792
6865
  var gl = this.gl;
6793
-
6866
+
6794
6867
  this.renderSession.shaderManager.setShader(this.renderSession.shaderManager.defaultShader);
6795
6868
 
6796
- //TODO - im usre this can be done better - will look to tweak this for 1.7..
6797
6869
  if(this.dirty)
6798
6870
  {
6799
6871
  this.dirty = false;
@@ -6816,15 +6888,6 @@ PIXI.WebGLSpriteBatch.prototype.flush = function()
6816
6888
 
6817
6889
  }
6818
6890
 
6819
- // bind the current texture
6820
- gl.bindTexture(gl.TEXTURE_2D, this.currentBaseTexture._glTextures[gl.id] || PIXI.createWebGLTexture(this.currentBaseTexture, gl));
6821
-
6822
- // check if a texture is dirty..
6823
- if(this.currentBaseTexture._dirty[gl.id])
6824
- {
6825
- PIXI.updateWebGLTexture(this.currentBaseTexture, gl);
6826
- }
6827
-
6828
6891
  // upload the verts to the buffer
6829
6892
  if(this.currentBatchSize > ( this.size * 0.5 ) )
6830
6893
  {
@@ -6833,19 +6896,59 @@ PIXI.WebGLSpriteBatch.prototype.flush = function()
6833
6896
  else
6834
6897
  {
6835
6898
  var view = this.vertices.subarray(0, this.currentBatchSize * 4 * this.vertSize);
6836
-
6837
6899
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, view);
6838
6900
  }
6839
6901
 
6840
- // var view = this.vertices.subarray(0, this.currentBatchSize * 4 * this.vertSize);
6841
- //gl.bufferSubData(gl.ARRAY_BUFFER, 0, view);
6842
-
6843
- // now draw those suckas!
6844
- gl.drawElements(gl.TRIANGLES, this.currentBatchSize * 6, gl.UNSIGNED_SHORT, 0);
6845
-
6902
+ var nextTexture, nextBlendMode;
6903
+ var batchSize = 0;
6904
+ var start = 0;
6905
+
6906
+ var currentBaseTexture = null;
6907
+ var currentBlendMode = this.renderSession.blendModeManager.currentBlendMode;
6908
+
6909
+ for (var i = 0, j = this.currentBatchSize; i < j; i++) {
6910
+
6911
+ nextTexture = this.textures[i];
6912
+ nextBlendMode = this.blendModes[i];
6913
+
6914
+ if(currentBaseTexture !== nextTexture || currentBlendMode !== nextBlendMode)
6915
+ {
6916
+ this.renderBatch(currentBaseTexture, batchSize, start);
6917
+
6918
+ start = i;
6919
+ batchSize = 0;
6920
+ currentBaseTexture = nextTexture;
6921
+ currentBlendMode = nextBlendMode;
6922
+
6923
+ this.renderSession.blendModeManager.setBlendMode( currentBlendMode );
6924
+ }
6925
+
6926
+ batchSize++;
6927
+ }
6928
+
6929
+ this.renderBatch(currentBaseTexture, batchSize, start);
6930
+
6846
6931
  // then reset the batch!
6847
6932
  this.currentBatchSize = 0;
6933
+ };
6934
+
6935
+ PIXI.WebGLSpriteBatch.prototype.renderBatch = function(texture, size, startIndex)
6936
+ {
6937
+ if(size === 0)return;
6848
6938
 
6939
+ var gl = this.gl;
6940
+ // bind the current texture
6941
+ gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id] || PIXI.createWebGLTexture(texture, gl));
6942
+
6943
+ // check if a texture is dirty..
6944
+ if(texture._dirty[gl.id])
6945
+ {
6946
+ PIXI.updateWebGLTexture(this.currentBaseTexture, gl);
6947
+ }
6948
+
6949
+ // now draw those suckas!
6950
+ gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2);
6951
+
6849
6952
  // increment the draw count
6850
6953
  this.renderSession.drawCount++;
6851
6954
  };
@@ -7160,7 +7263,7 @@ PIXI.WebGLFastSpriteBatch.prototype.flush = function()
7160
7263
 
7161
7264
  if(!this.currentBaseTexture._glTextures[gl.id])PIXI.createWebGLTexture(this.currentBaseTexture, gl);
7162
7265
 
7163
- gl.bindTexture(gl.TEXTURE_2D, this.currentBaseTexture._glTextures[gl.id]);// || PIXI.createWebGLTexture(this.currentBaseTexture, gl));
7266
+ gl.bindTexture(gl.TEXTURE_2D, this.currentBaseTexture._glTextures[gl.id]);
7164
7267
 
7165
7268
  // upload the verts to the buffer
7166
7269
 
@@ -8991,6 +9094,7 @@ PIXI.Graphics.prototype.lineTo = function(x, y)
8991
9094
  * Calculate the points for a quadratic bezier curve.
8992
9095
  * Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
8993
9096
  *
9097
+ * @method quadraticCurveTo
8994
9098
  * @param {number} cpX Control point x
8995
9099
  * @param {number} cpY Control point y
8996
9100
  * @param {number} toX Destination point x
@@ -8999,13 +9103,15 @@ PIXI.Graphics.prototype.lineTo = function(x, y)
8999
9103
  */
9000
9104
  PIXI.Graphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY)
9001
9105
  {
9002
- // this.currentPath.points.push(toX, toY)
9003
- //return;
9106
+ if( this.currentPath.points.length === 0)this.moveTo(0,0);
9107
+
9004
9108
  var xa,
9005
9109
  ya,
9006
9110
  n = 20,
9007
9111
  points = this.currentPath.points;
9112
+ if(points.length === 0)this.moveTo(0, 0);
9008
9113
 
9114
+
9009
9115
  var fromX = points[points.length-2];
9010
9116
  var fromY = points[points.length-1];
9011
9117
 
@@ -9030,6 +9136,7 @@ PIXI.Graphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY)
9030
9136
  /**
9031
9137
  * Calculate the points for a bezier curve.
9032
9138
  *
9139
+ * @method bezierCurveTo
9033
9140
  * @param {number} cpX Control point x
9034
9141
  * @param {number} cpY Control point y
9035
9142
  * @param {number} cpX2 Second Control point x
@@ -9040,6 +9147,8 @@ PIXI.Graphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY)
9040
9147
  */
9041
9148
  PIXI.Graphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY)
9042
9149
  {
9150
+ if( this.currentPath.points.length === 0)this.moveTo(0,0);
9151
+
9043
9152
  var n = 20,
9044
9153
  dt,
9045
9154
  dt2,
@@ -9075,17 +9184,24 @@ PIXI.Graphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY)
9075
9184
  };
9076
9185
 
9077
9186
  /*
9078
- * arcTo()
9079
- *
9187
+ * the arcTo() method creates an arc/curve between two tangents on the canvas.
9188
+ *
9080
9189
  * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
9190
+ *
9191
+ * @method arcTo
9192
+ * @param {number} x1 The x-coordinate of the beginning of the arc
9193
+ * @param {number} y1 The y-coordinate of the beginning of the arc
9194
+ * @param {number} x2 The x-coordinate of the end of the arc
9195
+ * @param {number} y2 The y-coordinate of the end of the arc
9196
+ * @param {number} radius The radius of the arc
9197
+ * @return {PIXI.Graphics}
9081
9198
  */
9082
9199
  PIXI.Graphics.prototype.arcTo = function(x1, y1, x2, y2, radius)
9083
9200
  {
9084
9201
  // check that path contains subpaths
9085
- //if (path.commands.length == 0)
9086
- // moveTo(x1, y1);
9202
+ if( this.currentPath.points.length === 0)this.moveTo(x1, y1);
9203
+
9087
9204
  var points = this.currentPath.points;
9088
-
9089
9205
  var fromX = points[points.length-2];
9090
9206
  var fromY = points[points.length-1];
9091
9207
 
@@ -9128,24 +9244,30 @@ PIXI.Graphics.prototype.arcTo = function(x1, y1, x2, y2, radius)
9128
9244
  return this;
9129
9245
  };
9130
9246
 
9131
- /*
9132
- * Arc init! TODO add docs
9247
+ /**
9248
+ * The arc() method creates an arc/curve (used to create circles, or parts of circles).
9249
+ *
9250
+ * @method arc
9251
+ * @param {number} cx The x-coordinate of the center of the circle
9252
+ * @param {number} cy The y-coordinate of the center of the circle
9253
+ * @param {number} radius The radius of the circle
9254
+ * @param {number} startAngle The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)
9255
+ * @param {number} endAngle The ending angle, in radians
9256
+ * @param {number} anticlockwise Optional. Specifies whether the drawing should be counterclockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.
9257
+ * @return {PIXI.Graphics}
9133
9258
  */
9134
9259
  PIXI.Graphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise)
9135
9260
  {
9136
9261
  var startX = cx + Math.cos(startAngle) * radius;
9137
9262
  var startY = cy + Math.sin(startAngle) * radius;
9138
-
9139
- // check that path contains subpaths
9140
- // if (path.commands.length == 0)
9141
- // this.moveTo(startX, startY);
9142
- // else
9143
- var points = this.currentPath.points;
9144
9263
 
9145
- var fromX = points[points.length-2];
9146
- var fromY = points[points.length-1];
9264
+ var points = this.currentPath.points;
9147
9265
 
9148
- if(fromX !== startX || fromY !== startY) points.push(startX, startY);
9266
+ if(points.length !== 0 && points[points.length-2] !== startX || points[points.length-1] !== startY)
9267
+ {
9268
+ this.moveTo(startX, startY);
9269
+ points = this.currentPath.points;
9270
+ }
9149
9271
 
9150
9272
  if (startAngle === endAngle)return this;
9151
9273
 
@@ -9169,12 +9291,15 @@ PIXI.Graphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, ant
9169
9291
  var cTheta = Math.cos(theta);
9170
9292
  var sTheta = Math.sin(theta);
9171
9293
 
9172
- var remainder = ( segs % 1 ) / segs;
9294
+ var segMinus = segs - 1;
9295
+
9296
+ var remainder = ( segMinus % 1 ) / segMinus;
9173
9297
 
9174
- for(var i=0; i<=segs; i++)
9298
+ for(var i=0; i<=segMinus; i++)
9175
9299
  {
9176
9300
  var real = i + remainder * i;
9177
9301
 
9302
+
9178
9303
  var angle = ((theta) + startAngle + (theta2 * real));
9179
9304
 
9180
9305
  var c = Math.cos(angle);
@@ -10171,7 +10296,7 @@ PIXI.TilingSprite = function(texture, width, height)
10171
10296
  * @property width
10172
10297
  * @type Number
10173
10298
  */
10174
- this.width = width || 100;
10299
+ this._width = width || 100;
10175
10300
 
10176
10301
  /**
10177
10302
  * The height of the tiling sprite
@@ -10179,7 +10304,7 @@ PIXI.TilingSprite = function(texture, width, height)
10179
10304
  * @property height
10180
10305
  * @type Number
10181
10306
  */
10182
- this.height = height || 100;
10307
+ this._height = height || 100;
10183
10308
 
10184
10309
  /**
10185
10310
  * The scaling of the image that is being tiled
@@ -10231,6 +10356,9 @@ PIXI.TilingSprite = function(texture, width, height)
10231
10356
  * @default PIXI.blendModes.NORMAL;
10232
10357
  */
10233
10358
  this.blendMode = PIXI.blendModes.NORMAL;
10359
+
10360
+
10361
+
10234
10362
  };
10235
10363
 
10236
10364
  // constructor
@@ -10290,22 +10418,23 @@ PIXI.TilingSprite.prototype.setTexture = function(texture)
10290
10418
  PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
10291
10419
  {
10292
10420
  if (this.visible === false || this.alpha === 0) return;
10293
-
10294
10421
  var i,j;
10295
10422
 
10296
- if (this.mask)
10423
+ if (this._mask)
10297
10424
  {
10298
10425
  renderSession.spriteBatch.stop();
10299
10426
  renderSession.maskManager.pushMask(this.mask, renderSession);
10300
10427
  renderSession.spriteBatch.start();
10301
10428
  }
10302
10429
 
10303
- if (this.filters)
10430
+ if (this._filters)
10304
10431
  {
10305
10432
  renderSession.spriteBatch.flush();
10306
10433
  renderSession.filterManager.pushFilter(this._filterBlock);
10307
10434
  }
10308
10435
 
10436
+
10437
+
10309
10438
  if (!this.tilingTexture || this.refreshTexture)
10310
10439
  {
10311
10440
  this.generateTilingTexture(true);
@@ -10322,7 +10451,6 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
10322
10451
  {
10323
10452
  renderSession.spriteBatch.renderTilingSprite(this);
10324
10453
  }
10325
-
10326
10454
  // simple render children!
10327
10455
  for (i=0,j=this.children.length; i<j; i++)
10328
10456
  {
@@ -10331,8 +10459,8 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
10331
10459
 
10332
10460
  renderSession.spriteBatch.stop();
10333
10461
 
10334
- if (this.filters) renderSession.filterManager.popFilter();
10335
- if (this.mask) renderSession.maskManager.popMask(renderSession);
10462
+ if (this._filters) renderSession.filterManager.popFilter();
10463
+ if (this._mask) renderSession.maskManager.popMask(renderSession);
10336
10464
 
10337
10465
  renderSession.spriteBatch.start();
10338
10466
  };
@@ -10495,6 +10623,21 @@ PIXI.TilingSprite.prototype.getBounds = function()
10495
10623
  return bounds;
10496
10624
  };
10497
10625
 
10626
+
10627
+
10628
+ /**
10629
+ * When the texture is updated, this event will fire to update the scale and frame
10630
+ *
10631
+ * @method onTextureUpdate
10632
+ * @param event
10633
+ * @private
10634
+ */
10635
+ PIXI.TilingSprite.prototype.onTextureUpdate = function()
10636
+ {
10637
+ // overriding the sprite version of this!
10638
+ };
10639
+
10640
+
10498
10641
  /**
10499
10642
  *
10500
10643
  * @method generateTilingTexture
@@ -11213,7 +11356,7 @@ PIXI.RenderTexture = function(width, height, renderer, scaleMode)
11213
11356
  * @property crop
11214
11357
  * @type Rectangle
11215
11358
  */
11216
- this.crop = new PIXI.Rectangle(0, 0, 1, 1);
11359
+ this.crop = new PIXI.Rectangle(0, 0, this.width, this.height);
11217
11360
 
11218
11361
  /**
11219
11362
  * The base texture object that this texture uses
@@ -11250,6 +11393,7 @@ PIXI.RenderTexture = function(width, height, renderer, scaleMode)
11250
11393
  this.baseTexture.source = this.textureBuffer.canvas;
11251
11394
  }
11252
11395
 
11396
+ this.valid = true;
11253
11397
  PIXI.Texture.frameUpdates.push(this);
11254
11398
 
11255
11399
 
@@ -11273,11 +11417,8 @@ PIXI.RenderTexture.prototype.resize = function(width, height, updateBase)
11273
11417
  return;
11274
11418
  }
11275
11419
 
11276
- this.width = width;
11277
- this.height = height;
11278
-
11279
- this.frame.width = this.width;
11280
- this.frame.height = this.height;
11420
+ this.width = this.frame.width = this.crop.width = width;
11421
+ this.height = this.frame.height = this.crop.height = height;
11281
11422
 
11282
11423
  if (updateBase)
11283
11424
  {
@@ -11421,7 +11562,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
11421
11562
  }
11422
11563
  exports.PIXI = PIXI;
11423
11564
  } else if (typeof define !== 'undefined' && define.amd) {
11424
- define(PIXI);
11565
+ define('PIXI', (function() { return root.PIXI = PIXI; })() );
11425
11566
  } else {
11426
11567
  root.PIXI = PIXI;
11427
11568
  }
@@ -11435,7 +11576,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
11435
11576
  *
11436
11577
  * Phaser - http://phaser.io
11437
11578
  *
11438
- * v2.0.6 "Jornhill" - Built: Thu Jul 10 2014 20:17:38
11579
+ * v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 12:35:30
11439
11580
  *
11440
11581
  * By Richard Davey http://www.photonstorm.com @photonstorm
11441
11582
  *
@@ -11478,7 +11619,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
11478
11619
  */
11479
11620
  var Phaser = Phaser || {
11480
11621
 
11481
- VERSION: '2.0.6',
11622
+ VERSION: '2.0.7',
11482
11623
  GAMES: [],
11483
11624
 
11484
11625
  AUTO: 0,
@@ -11564,6 +11705,70 @@ PIXI.dontSayHello = true;
11564
11705
  */
11565
11706
  Phaser.Utils = {
11566
11707
 
11708
+ /**
11709
+ * Gets an objects property by string.
11710
+ *
11711
+ * @method Phaser.Utils.getProperty
11712
+ * @param {object} obj - The object to traverse.
11713
+ * @param {string} prop - The property whose value will be returned.
11714
+ * @return {*} the value of the property or null if property isn't found .
11715
+ */
11716
+ getProperty: function(obj, prop) {
11717
+
11718
+ var parts = prop.split('.'),
11719
+ last = parts.pop(),
11720
+ l = parts.length,
11721
+ i = 1,
11722
+ current = parts[0];
11723
+
11724
+ while (i < l && (obj = obj[current]))
11725
+ {
11726
+ current = parts[i];
11727
+ i++;
11728
+ }
11729
+
11730
+ if (obj)
11731
+ {
11732
+ return obj[last];
11733
+ }
11734
+ else
11735
+ {
11736
+ return null;
11737
+ }
11738
+
11739
+ },
11740
+
11741
+ /**
11742
+ * Sets an objects property by string.
11743
+ *
11744
+ * @method Phaser.Utils.setProperty
11745
+ * @param {object} obj - The object to traverse
11746
+ * @param {string} prop - The property whose value will be changed
11747
+ * @return {object} The object on which the property was set.
11748
+ */
11749
+ setProperty: function(obj, prop, value) {
11750
+
11751
+ var parts = prop.split('.'),
11752
+ last = parts.pop(),
11753
+ l = parts.length,
11754
+ i = 1,
11755
+ current = parts[0];
11756
+
11757
+ while (i < l && (obj = obj[current]))
11758
+ {
11759
+ current = parts[i];
11760
+ i++;
11761
+ }
11762
+
11763
+ if (obj)
11764
+ {
11765
+ obj[last] = value;
11766
+ }
11767
+
11768
+ return obj;
11769
+
11770
+ },
11771
+
11567
11772
  /**
11568
11773
  * Transposes the elements of the given Array.
11569
11774
  *
@@ -16114,7 +16319,10 @@ Phaser.StateManager.prototype = {
16114
16319
  // Already got a state running?
16115
16320
  if (this.current)
16116
16321
  {
16117
- this.onShutDownCallback.call(this.callbackContext, this.game);
16322
+ if (this.onShutDownCallback)
16323
+ {
16324
+ this.onShutDownCallback.call(this.callbackContext, this.game);
16325
+ }
16118
16326
 
16119
16327
  this.game.tweens.removeAll();
16120
16328
 
@@ -16734,6 +16942,27 @@ Phaser.ArrayList.prototype = {
16734
16942
 
16735
16943
  },
16736
16944
 
16945
+ /**
16946
+ * Sets the property `key` to the given value on all members of this list.
16947
+ *
16948
+ * @method Phaser.ArrayList#setAll
16949
+ * @param {object} key - The object on the child to set.
16950
+ * @param {*} value - The value to set the property to.
16951
+ */
16952
+ setAll: function (key, value) {
16953
+
16954
+ var i = this.list.length;
16955
+
16956
+ while (i--)
16957
+ {
16958
+ if (this.list[i] && this.list[i][key])
16959
+ {
16960
+ this.list[i][key] = value;
16961
+ }
16962
+ }
16963
+
16964
+ },
16965
+
16737
16966
  /**
16738
16967
  * Calls a function on all members of this list, using the member as the context for the callback.
16739
16968
  * The function must exist on the member.
@@ -18334,7 +18563,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
18334
18563
  * @classdesc A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms.
18335
18564
  * @constructor
18336
18565
  * @param {Phaser.Game} game - A reference to the currently running game.
18337
- * @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined it will use game.world. If null it won't be added to anything.
18566
+ * @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If `undefined` it will use game.world. If null it won't be added to anything.
18338
18567
  * @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
18339
18568
  * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
18340
18569
  * @param {boolean} [enableBody=false] - If true all Sprites created with `Group.create` or `Group.createMulitple` will have a physics body created on them. Change the body type with physicsBodyType.
@@ -18627,7 +18856,7 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
18627
18856
 
18628
18857
  if (this.enableBody)
18629
18858
  {
18630
- this.game.physics.enable(child, this.physicsBodyType);
18859
+ this.game.physics.enable(child, this.physicsBodyType, this.enableBodyDebug);
18631
18860
  }
18632
18861
 
18633
18862
  child.exists = exists;
@@ -19070,6 +19299,35 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation, for
19070
19299
 
19071
19300
  };
19072
19301
 
19302
+ /**
19303
+ * Checks a property for the given value on the child.
19304
+ *
19305
+ * @method Phaser.Group#checkProperty
19306
+ * @param {*} child - The child to check the property value on.
19307
+ * @param {array} key - An array of strings that make up the property that will be set.
19308
+ * @param {*} value - The value that will be checked.
19309
+ * @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
19310
+ * @return {boolean} True if the property was was equal to value, false if not.
19311
+ */
19312
+ Phaser.Group.prototype.checkProperty = function (child, key, value, force) {
19313
+
19314
+ if (typeof force === 'undefined') { force = false; }
19315
+
19316
+ // We can't force a property in and the child doesn't have it, so abort.
19317
+ if (!Phaser.Utils.getProperty(child, key) && force)
19318
+ {
19319
+ return false;
19320
+ }
19321
+
19322
+ if (Phaser.Utils.getProperty(child, key) !== value)
19323
+ {
19324
+ return false;
19325
+ }
19326
+
19327
+ return true;
19328
+
19329
+ };
19330
+
19073
19331
  /**
19074
19332
  * This function allows you to quickly set a property on a single child of this Group to a new value.
19075
19333
  * The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
@@ -19175,6 +19433,38 @@ Phaser.Group.prototype.setAllChildren = function (key, value, checkAlive, checkV
19175
19433
 
19176
19434
  };
19177
19435
 
19436
+ /**
19437
+ * This function allows you to quickly check that the same property across all children of this Group is equal to the given value.
19438
+ * This call doesn't descend down children, so if you have a Group inside of this Group, the property will be checked on the Group but not its children.
19439
+ *
19440
+ * @method Phaser.Group#checkAll
19441
+ * @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x'
19442
+ * @param {*} value - The value that will be checked.
19443
+ * @param {boolean} [checkAlive=false] - If set then only children with alive=true will be checked. This includes any Groups that are children.
19444
+ * @param {boolean} [checkVisible=false] - If set then only children with visible=true will be checked. This includes any Groups that are children.
19445
+ * @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
19446
+ */
19447
+ Phaser.Group.prototype.checkAll = function (key, value, checkAlive, checkVisible, force) {
19448
+
19449
+ if (typeof checkAlive === 'undefined') { checkAlive = false; }
19450
+ if (typeof checkVisible === 'undefined') { checkVisible = false; }
19451
+ if (typeof force === 'undefined') { force = false; }
19452
+
19453
+ for (var i = 0, len = this.children.length; i < len; i++)
19454
+ {
19455
+ if ((!checkAlive || (checkAlive && this.children[i].alive)) && (!checkVisible || (checkVisible && this.children[i].visible)))
19456
+ {
19457
+ if (!this.checkProperty(this.children[i], key, value, force))
19458
+ {
19459
+ return false;
19460
+ }
19461
+ }
19462
+ }
19463
+
19464
+ return true;
19465
+
19466
+ };
19467
+
19178
19468
  /**
19179
19469
  * Adds the amount to the given property on all children in this Group.
19180
19470
  * Group.addAll('x', 10) will add 10 to the child.x value.
@@ -20235,22 +20525,28 @@ Phaser.World.prototype.wrap = function (sprite, padding, useBounds, horizontal,
20235
20525
  {
20236
20526
  sprite.getBounds();
20237
20527
 
20238
- if (horizontal && sprite._currentBounds.right < this.bounds.x)
20239
- {
20240
- sprite.x = this.bounds.right;
20241
- }
20242
- else if (horizontal && sprite._currentBounds.x > this.bounds.right)
20528
+ if (horizontal)
20243
20529
  {
20244
- sprite.x = this.bounds.left;
20530
+ if ((sprite.x + sprite._currentBounds.width) < this.bounds.x)
20531
+ {
20532
+ sprite.x = this.bounds.right;
20533
+ }
20534
+ else if (sprite.x > this.bounds.right)
20535
+ {
20536
+ sprite.x = this.bounds.left;
20537
+ }
20245
20538
  }
20246
20539
 
20247
- if (vertical && sprite._currentBounds.bottom < this.bounds.top)
20248
- {
20249
- sprite.y = this.bounds.bottom;
20250
- }
20251
- else if (vertical && sprite._currentBounds.top > this.bounds.bottom)
20540
+ if (vertical)
20252
20541
  {
20253
- sprite.y = this.bounds.top;
20542
+ if ((sprite.y + sprite._currentBounds.height) < this.bounds.top)
20543
+ {
20544
+ sprite.y = this.bounds.bottom;
20545
+ }
20546
+ else if (sprite.y > this.bounds.bottom)
20547
+ {
20548
+ sprite.y = this.bounds.top;
20549
+ }
20254
20550
  }
20255
20551
  }
20256
20552
 
@@ -20756,7 +21052,7 @@ Phaser.ScaleManager.prototype = {
20756
21052
  orientationImage = '__default';
20757
21053
  }
20758
21054
 
20759
- this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, PIXI.TextureCache[orientationImage]);
21055
+ this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, orientationImage);
20760
21056
  this.orientationSprite.anchor.set(0.5);
20761
21057
 
20762
21058
  this.checkOrientationState();
@@ -21813,7 +22109,11 @@ Phaser.Game.prototype = {
21813
22109
  this.pendingStep = true;
21814
22110
  }
21815
22111
 
21816
- this.debug.preUpdate();
22112
+ if (this.config['enableDebug'])
22113
+ {
22114
+ this.debug.preUpdate();
22115
+ }
22116
+
21817
22117
  this.physics.preUpdate();
21818
22118
  this.state.preUpdate();
21819
22119
  this.plugins.preUpdate();
@@ -21834,8 +22134,11 @@ Phaser.Game.prototype = {
21834
22134
  else
21835
22135
  {
21836
22136
  this.state.pauseUpdate();
21837
- // this.input.update();
21838
- this.debug.preUpdate();
22137
+
22138
+ if (this.config['enableDebug'])
22139
+ {
22140
+ this.debug.preUpdate();
22141
+ }
21839
22142
  }
21840
22143
 
21841
22144
  if (this.renderType != Phaser.HEADLESS)
@@ -22020,23 +22323,23 @@ Object.defineProperty(Phaser.Game.prototype, "paused", {
22020
22323
  if (this._paused === false)
22021
22324
  {
22022
22325
  this._paused = true;
22023
- this._codePaused = true;
22024
22326
  this.sound.setMute();
22025
22327
  this.time.gamePaused();
22026
22328
  this.onPause.dispatch(this);
22027
22329
  }
22330
+ this._codePaused = true;
22028
22331
  }
22029
22332
  else
22030
22333
  {
22031
22334
  if (this._paused)
22032
22335
  {
22033
22336
  this._paused = false;
22034
- this._codePaused = false;
22035
22337
  this.input.reset();
22036
22338
  this.sound.unsetMute();
22037
22339
  this.time.gameResumed();
22038
22340
  this.onResume.dispatch(this);
22039
22341
  }
22342
+ this._codePaused = false;
22040
22343
  }
22041
22344
 
22042
22345
  }
@@ -22328,7 +22631,7 @@ Phaser.Input = function (game) {
22328
22631
  this.minPriorityID = 0;
22329
22632
 
22330
22633
  /**
22331
- * A list of interactive objects. Te InputHandler components add and remove themselves from this.
22634
+ * A list of interactive objects. The InputHandler components add and remove themselves from this list.
22332
22635
  * @property {Phaser.ArrayList} interactiveItems
22333
22636
  */
22334
22637
  this.interactiveItems = new Phaser.ArrayList();
@@ -22533,6 +22836,7 @@ Phaser.Input.prototype = {
22533
22836
 
22534
22837
  /**
22535
22838
  * Updates the Input Manager. Called by the core Game loop.
22839
+ *
22536
22840
  * @method Phaser.Input#update
22537
22841
  * @protected
22538
22842
  */
@@ -23679,6 +23983,11 @@ Phaser.Keyboard.prototype = {
23679
23983
 
23680
23984
  this.pressEvent = event;
23681
23985
 
23986
+ if (this.game.input.disabled || this.disabled)
23987
+ {
23988
+ return;
23989
+ }
23990
+
23682
23991
  if (this.onPressCallback)
23683
23992
  {
23684
23993
  this.onPressCallback.call(this.callbackContext, String.fromCharCode(event.charCode), event);
@@ -24988,6 +25297,7 @@ Phaser.Pointer.prototype = {
24988
25297
 
24989
25298
  /**
24990
25299
  * Called when the Pointer is moved.
25300
+ *
24991
25301
  * @method Phaser.Pointer#move
24992
25302
  * @param {MouseEvent|PointerEvent|TouchEvent} event - The event passed up from the input handler.
24993
25303
  * @param {boolean} [fromClick=false] - Was this called from the click event?
@@ -25072,33 +25382,75 @@ Phaser.Pointer.prototype = {
25072
25382
 
25073
25383
  return this;
25074
25384
  }
25385
+ else if (this.game.input.interactiveItems.total > 0)
25386
+ {
25387
+ this.processInteractiveObjects(fromClick);
25388
+ }
25389
+
25390
+ return this;
25391
+
25392
+ },
25393
+
25394
+ /**
25395
+ * Process all interactive objects to find out which ones were updated in the recent Pointer move.
25396
+ *
25397
+ * @method Phaser.Pointer#processInteractiveObjects
25398
+ * @protected
25399
+ * @param {boolean} [fromClick=false] - Was this called from the click event?
25400
+ */
25401
+ processInteractiveObjects: function (fromClick) {
25402
+
25403
+ this.game.input.interactiveItems.setAll('checked', false);
25075
25404
 
25076
25405
  // Work out which object is on the top
25077
25406
  this._highestRenderOrderID = Number.MAX_SAFE_INTEGER;
25078
25407
  this._highestRenderObject = null;
25079
25408
  this._highestInputPriorityID = -1;
25080
25409
 
25081
- // Run through the list
25082
- if (this.game.input.interactiveItems.total > 0)
25410
+ // First pass gets all objects that the pointer is over that DON'T use pixelPerfect checks and get the highest ID
25411
+ // We know they'll be valid for input detection but not which is the top just yet
25412
+
25413
+ var currentNode = this.game.input.interactiveItems.first;
25414
+
25415
+ do
25083
25416
  {
25084
- var currentNode = this.game.input.interactiveItems.first;
25417
+ if (currentNode && currentNode.validForInput(this._highestInputPriorityID, this._highestRenderOrderID, false))
25418
+ {
25419
+ // Flag it as checked so we don't re-scan it on the next phase
25420
+ currentNode.checked = true;
25085
25421
 
25086
- do
25422
+ if ((fromClick && currentNode.checkPointerDown(this, true)) || (!fromClick && currentNode.checkPointerOver(this, true)))
25423
+ {
25424
+ this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
25425
+ this._highestInputPriorityID = currentNode.priorityID;
25426
+ this._highestRenderObject = currentNode;
25427
+ }
25428
+ }
25429
+ currentNode = this.game.input.interactiveItems.next;
25430
+ }
25431
+ while (currentNode !== null);
25432
+
25433
+ // Then in the second sweep we process ONLY the pixel perfect ones that are checked and who have a higher ID
25434
+ // because if their ID is lower anyway then we can just automatically discount them
25435
+
25436
+ var currentNode = this.game.input.interactiveItems.first;
25437
+
25438
+ do
25439
+ {
25440
+ if (currentNode && !currentNode.checked && currentNode.validForInput(this._highestInputPriorityID, this._highestRenderOrderID, true))
25087
25441
  {
25088
- // If the object is using pixelPerfect checks, or has a higher InputManager.PriorityID OR if the priority ID is the same as the current highest AND it has a higher renderOrderID, then set it to the top
25089
- if (currentNode && currentNode.validForInput(this._highestInputPriorityID, this._highestRenderOrderID))
25442
+ if ((fromClick && currentNode.checkPointerDown(this, false)) || (!fromClick && currentNode.checkPointerOver(this, false)))
25090
25443
  {
25091
- if ((!fromClick && currentNode.checkPointerOver(this)) || (fromClick && currentNode.checkPointerDown(this)))
25092
- {
25093
- this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
25094
- this._highestInputPriorityID = currentNode.priorityID;
25095
- this._highestRenderObject = currentNode;
25096
- }
25444
+ this._highestRenderOrderID = currentNode.sprite._cache[3]; // renderOrderID
25445
+ this._highestInputPriorityID = currentNode.priorityID;
25446
+ this._highestRenderObject = currentNode;
25097
25447
  }
25098
- currentNode = this.game.input.interactiveItems.next;
25099
25448
  }
25100
- while (currentNode !== null);
25449
+ currentNode = this.game.input.interactiveItems.next;
25101
25450
  }
25451
+ while (currentNode !== null);
25452
+
25453
+ // Now we know the top-most item (if any) we can process it
25102
25454
 
25103
25455
  if (this._highestRenderObject === null)
25104
25456
  {
@@ -25140,8 +25492,6 @@ Phaser.Pointer.prototype = {
25140
25492
  }
25141
25493
  }
25142
25494
 
25143
- return this;
25144
-
25145
25495
  },
25146
25496
 
25147
25497
  /**
@@ -27140,6 +27490,12 @@ Phaser.InputHandler = function (sprite) {
27140
27490
  */
27141
27491
  this.enabled = false;
27142
27492
 
27493
+ /**
27494
+ * @property {boolean} checked - A disposable flag used by the Pointer class when performing priority checks.
27495
+ * @protected
27496
+ */
27497
+ this.checked = false;
27498
+
27143
27499
  /**
27144
27500
  * The priorityID is used to determine which game objects should get priority when input events occur. For example if you have
27145
27501
  * several Sprites that overlap, by default the one at the top of the display list is given priority for input events. You can
@@ -27379,6 +27735,8 @@ Phaser.InputHandler.prototype = {
27379
27735
  this.sprite.events.onAddedToGroup.add(this.addedToGroup, this);
27380
27736
  this.sprite.events.onRemovedFromGroup.add(this.removedFromGroup, this);
27381
27737
 
27738
+ this.flagged = false;
27739
+
27382
27740
  return this.sprite;
27383
27741
 
27384
27742
  },
@@ -27435,6 +27793,7 @@ Phaser.InputHandler.prototype = {
27435
27793
  reset: function () {
27436
27794
 
27437
27795
  this.enabled = false;
27796
+ this.flagged = false;
27438
27797
 
27439
27798
  for (var i = 0; i < 10; i++)
27440
27799
  {
@@ -27510,18 +27869,22 @@ Phaser.InputHandler.prototype = {
27510
27869
  * @protected
27511
27870
  * @param {number} highestID - The highest ID currently processed by the Pointer.
27512
27871
  * @param {number} highestRenderID - The highest Render Order ID currently processed by the Pointer.
27872
+ * @param {boolean} [includePixelPerfect=true] - If this object has `pixelPerfectClick` or `pixelPerfectOver` set should it be considered as valid?
27513
27873
  * @return {boolean} True if the object this InputHandler is bound to should be considered as valid for input detection.
27514
27874
  */
27515
- validForInput: function (highestID, highestRenderID) {
27875
+ validForInput: function (highestID, highestRenderID, includePixelPerfect) {
27876
+
27877
+ if (typeof includePixelPerfect === 'undefined') { includePixelPerfect = true; }
27516
27878
 
27517
27879
  if (this.sprite.scale.x === 0 || this.sprite.scale.y === 0 || this.priorityID < this.game.input.minPriorityID)
27518
27880
  {
27519
27881
  return false;
27520
27882
  }
27521
27883
 
27522
- if (this.pixelPerfectClick || this.pixelPerfectOver)
27884
+ // If we're trying to specifically IGNORE pixel perfect objects, then set includePixelPerfect to false and skip it
27885
+ if (!includePixelPerfect && (this.pixelPerfectClick || this.pixelPerfectOver))
27523
27886
  {
27524
- return true;
27887
+ return false;
27525
27888
  }
27526
27889
 
27527
27890
  if (this.priorityID > highestID || (this.priorityID === highestID && this.sprite._cache[3] < highestRenderID))
@@ -27533,6 +27896,18 @@ Phaser.InputHandler.prototype = {
27533
27896
 
27534
27897
  },
27535
27898
 
27899
+ /**
27900
+ * Is this object using pixel perfect checking?
27901
+ *
27902
+ * @method Phaser.InputHandler#isPixelPerfect
27903
+ * @return {boolean} True if the this InputHandler has either `pixelPerfectClick` or `pixelPerfectOver` set to `true`.
27904
+ */
27905
+ isPixelPerfect: function () {
27906
+
27907
+ return (this.pixelPerfectClick || this.pixelPerfectOver);
27908
+
27909
+ },
27910
+
27536
27911
  /**
27537
27912
  * The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
27538
27913
  * This value is only set when the pointer is over this Sprite.
@@ -27722,12 +28097,15 @@ Phaser.InputHandler.prototype = {
27722
28097
  },
27723
28098
 
27724
28099
  /**
27725
- * Checks if the given pointer is both down and over this Sprite.
28100
+ * Checks if the given pointer is both down and over the Sprite this InputHandler belongs to.
28101
+ * Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
28102
+ *
27726
28103
  * @method Phaser.InputHandler#checkPointerDown
27727
28104
  * @param {Phaser.Pointer} pointer
28105
+ * @param {boolean} [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
27728
28106
  * @return {boolean} True if the pointer is down, otherwise false.
27729
28107
  */
27730
- checkPointerDown: function (pointer) {
28108
+ checkPointerDown: function (pointer, fastTest) {
27731
28109
 
27732
28110
  if (!pointer.isDown || !this.enabled || !this.sprite || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible)
27733
28111
  {
@@ -27737,7 +28115,9 @@ Phaser.InputHandler.prototype = {
27737
28115
  // Need to pass it a temp point, in case we need it again for the pixel check
27738
28116
  if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
27739
28117
  {
27740
- if (this.pixelPerfectClick)
28118
+ if (typeof fastTest === 'undefined') { fastTest = false; }
28119
+
28120
+ if (!fastTest && this.pixelPerfectClick)
27741
28121
  {
27742
28122
  return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
27743
28123
  }
@@ -27752,12 +28132,15 @@ Phaser.InputHandler.prototype = {
27752
28132
  },
27753
28133
 
27754
28134
  /**
27755
- * Checks if the given pointer is over this Sprite.
28135
+ * Checks if the given pointer is over the Sprite this InputHandler belongs to.
28136
+ * Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
28137
+ *
27756
28138
  * @method Phaser.InputHandler#checkPointerOver
27757
28139
  * @param {Phaser.Pointer} pointer
28140
+ * @param {boolean} [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
27758
28141
  * @return {boolean}
27759
28142
  */
27760
- checkPointerOver: function (pointer) {
28143
+ checkPointerOver: function (pointer, fastTest) {
27761
28144
 
27762
28145
  if (!this.enabled || !this.sprite || !this.sprite.parent || !this.sprite.visible || !this.sprite.parent.visible)
27763
28146
  {
@@ -27767,7 +28150,9 @@ Phaser.InputHandler.prototype = {
27767
28150
  // Need to pass it a temp point, in case we need it again for the pixel check
27768
28151
  if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
27769
28152
  {
27770
- if (this.pixelPerfectOver)
28153
+ if (typeof fastTest === 'undefined') { fastTest = false; }
28154
+
28155
+ if (!fastTest && this.pixelPerfectOver)
27771
28156
  {
27772
28157
  return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
27773
28158
  }
@@ -28245,7 +28630,7 @@ Phaser.InputHandler.prototype = {
28245
28630
  this.dragOffset = new Phaser.Point();
28246
28631
  this.dragFromCenter = lockCenter;
28247
28632
 
28248
- this.pixelPerfect = pixelPerfect;
28633
+ this.pixelPerfectClick = pixelPerfect;
28249
28634
  this.pixelPerfectAlpha = alphaThreshold;
28250
28635
 
28251
28636
  if (boundsRect)
@@ -28717,7 +29102,7 @@ Phaser.GameObjectFactory.prototype = {
28717
29102
  * A Physics Group is the same as an ordinary Group except that is has enableBody turned on by default, so any Sprites it creates
28718
29103
  * are automatically given a physics body.
28719
29104
  *
28720
- * @method Phaser.GameObjectFactory#group
29105
+ * @method Phaser.GameObjectFactory#physicsGroup
28721
29106
  * @param {number} [physicsBodyType=Phaser.Physics.ARCADE] - If enableBody is true this is the type of physics body that is created on new Sprites. Phaser.Physics.ARCADE, Phaser.Physics.P2, Phaser.Physics.NINJA, etc.
28722
29107
  * @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
28723
29108
  * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
@@ -28731,16 +29116,19 @@ Phaser.GameObjectFactory.prototype = {
28731
29116
  },
28732
29117
 
28733
29118
  /**
28734
- * A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
29119
+ * A SpriteBatch is a really fast version of a Phaser Group built solely for speed.
29120
+ * Use when you need a lot of sprites or particles all sharing the same texture.
29121
+ * The speed gains are specifically for WebGL. In Canvas mode you won't see any real difference.
28735
29122
  *
28736
29123
  * @method Phaser.GameObjectFactory#spriteBatch
28737
- * @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
28738
- * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
28739
- * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
29124
+ * @param {Phaser.Group|null} parent - The parent Group that will hold this Sprite Batch. Set to `undefined` or `null` to add directly to game.world.
29125
+ * @param {string} [name='group'] - A name for this Sprite Batch. Not used internally but useful for debugging.
29126
+ * @param {boolean} [addToStage=false] - If set to true this Sprite Batch will be added directly to the Game.Stage instead of the parent.
28740
29127
  * @return {Phaser.Group} The newly created group.
28741
29128
  */
28742
29129
  spriteBatch: function (parent, name, addToStage) {
28743
29130
 
29131
+ if (typeof parent === 'undefined') { parent = null; }
28744
29132
  if (typeof name === 'undefined') { name = 'group'; }
28745
29133
  if (typeof addToStage === 'undefined') { addToStage = false; }
28746
29134
 
@@ -29685,6 +30073,9 @@ Phaser.BitmapData.prototype = {
29685
30073
  this.texture.width = width;
29686
30074
  this.texture.height = height;
29687
30075
 
30076
+ this.texture.crop.width = width;
30077
+ this.texture.crop.height = height;
30078
+
29688
30079
  this.refreshBuffer();
29689
30080
  this.dirty = true;
29690
30081
  }
@@ -30810,14 +31201,21 @@ Phaser.Sprite.prototype.postUpdate = function() {
30810
31201
  * @memberof Phaser.Sprite
30811
31202
  * @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture.
30812
31203
  * @param {string|number} [frame] - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
31204
+ * @param {boolean} [stopAnimation=true] - If an animation is already playing on this Sprite you can choose to stop it or let it carry on playing.
30813
31205
  */
30814
- Phaser.Sprite.prototype.loadTexture = function (key, frame) {
31206
+ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) {
30815
31207
 
30816
31208
  frame = frame || 0;
30817
31209
 
31210
+ if (stopAnimation || typeof stopAnimation === 'undefined')
31211
+ {
31212
+ this.animations.stop();
31213
+ }
31214
+
30818
31215
  this.key = key;
30819
31216
 
30820
31217
  var setFrame = true;
31218
+ var smoothed = this.smoothed;
30821
31219
 
30822
31220
  if (key instanceof Phaser.RenderTexture)
30823
31221
  {
@@ -30841,6 +31239,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
30841
31239
  }
30842
31240
  else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
30843
31241
  {
31242
+ console.warn("Texture with key '" + key + "' not found.");
30844
31243
  this.key = '__missing';
30845
31244
  this.setTexture(PIXI.TextureCache[this.key]);
30846
31245
  }
@@ -30848,10 +31247,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
30848
31247
  {
30849
31248
  this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key]));
30850
31249
 
30851
- if (this.animations)
30852
- {
30853
- setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame);
30854
- }
31250
+ setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key), frame);
30855
31251
  }
30856
31252
  }
30857
31253
 
@@ -30860,6 +31256,11 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
30860
31256
  this._frame = Phaser.Rectangle.clone(this.texture.frame);
30861
31257
  }
30862
31258
 
31259
+ if (!smoothed)
31260
+ {
31261
+ this.smoothed = false;
31262
+ }
31263
+
30863
31264
  };
30864
31265
 
30865
31266
  /**
@@ -31720,8 +32121,22 @@ Phaser.Image = function (game, x, y, key, frame) {
31720
32121
  */
31721
32122
  this.key = key;
31722
32123
 
32124
+ /**
32125
+ * @property {number} _frame - Internal cache var.
32126
+ * @private
32127
+ */
32128
+ this._frame = 0;
32129
+
32130
+ /**
32131
+ * @property {string} _frameName - Internal cache var.
32132
+ * @private
32133
+ */
32134
+ this._frameName = '';
32135
+
31723
32136
  PIXI.Sprite.call(this, PIXI.TextureCache['__default']);
31724
32137
 
32138
+ this.loadTexture(key, frame);
32139
+
31725
32140
  this.position.set(x, y);
31726
32141
 
31727
32142
  /**
@@ -31749,15 +32164,8 @@ Phaser.Image = function (game, x, y, key, frame) {
31749
32164
  */
31750
32165
  this.cameraOffset = new Phaser.Point();
31751
32166
 
31752
- /**
31753
- * @property {Phaser.Rectangle} cropRect - The Rectangle used to crop the texture. Set this via Sprite.crop. Any time you modify this property directly you must call Sprite.updateCrop.
31754
- * @default
31755
- */
31756
- this.cropRect = null;
31757
-
31758
32167
  /**
31759
32168
  * A small internal cache:
31760
- *
31761
32169
  * 0 = previous position.x
31762
32170
  * 1 = previous position.y
31763
32171
  * 2 = previous rotation
@@ -31767,38 +32175,11 @@ Phaser.Image = function (game, x, y, key, frame) {
31767
32175
  * 6 = exists (0 = no, 1 = yes)
31768
32176
  * 7 = fixed to camera (0 = no, 1 = yes)
31769
32177
  * 8 = destroy phase? (0 = no, 1 = yes)
31770
- * 9 = frame index
31771
32178
  * @property {Array} _cache
31772
32179
  * @private
31773
32180
  */
31774
32181
  this._cache = [ 0, 0, 0, 0, 1, 0, 1, 0, 0 ];
31775
32182
 
31776
- /**
31777
- * @property {Phaser.Rectangle} _crop - Internal cache var.
31778
- * @private
31779
- */
31780
- this._crop = null;
31781
-
31782
- /**
31783
- * @property {Phaser.Rectangle} _frame - Internal cache var.
31784
- * @private
31785
- */
31786
- this._frame = null;
31787
-
31788
- /**
31789
- * @property {Phaser.Rectangle} _bounds - Internal cache var.
31790
- * @private
31791
- */
31792
- this._bounds = new Phaser.Rectangle();
31793
-
31794
- /**
31795
- * @property {string} _frameName - Internal cache var.
31796
- * @private
31797
- */
31798
- this._frameName = '';
31799
-
31800
- this.loadTexture(key, frame);
31801
-
31802
32183
  };
31803
32184
 
31804
32185
  Phaser.Image.prototype = Object.create(PIXI.Sprite.prototype);
@@ -31828,7 +32209,7 @@ Phaser.Image.prototype.preUpdate = function() {
31828
32209
  this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
31829
32210
  }
31830
32211
 
31831
- this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
32212
+ this.world.setTo(this.game.camera.x + this.worldTransform.tx, this.game.camera.y + this.worldTransform.ty);
31832
32213
 
31833
32214
  if (this.visible)
31834
32215
  {
@@ -31896,20 +32277,23 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
31896
32277
 
31897
32278
  frame = frame || 0;
31898
32279
 
31899
- this.key = key;
31900
-
31901
32280
  if (key instanceof Phaser.RenderTexture)
31902
32281
  {
31903
32282
  this.key = key.key;
31904
32283
  this.setTexture(key);
32284
+ return;
31905
32285
  }
31906
32286
  else if (key instanceof Phaser.BitmapData)
31907
32287
  {
32288
+ this.key = key;
31908
32289
  this.setTexture(key.texture);
32290
+ return;
31909
32291
  }
31910
32292
  else if (key instanceof PIXI.Texture)
31911
32293
  {
32294
+ this.key = key;
31912
32295
  this.setTexture(key);
32296
+ return;
31913
32297
  }
31914
32298
  else
31915
32299
  {
@@ -31917,81 +32301,95 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
31917
32301
  {
31918
32302
  this.key = '__default';
31919
32303
  this.setTexture(PIXI.TextureCache[this.key]);
32304
+ return;
31920
32305
  }
31921
32306
  else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
31922
32307
  {
31923
32308
  this.key = '__missing';
31924
32309
  this.setTexture(PIXI.TextureCache[this.key]);
32310
+ return;
31925
32311
  }
31926
- else
32312
+
32313
+ if (this.game.cache.isSpriteSheet(key))
31927
32314
  {
31928
- if (this.game.cache.isSpriteSheet(key))
31929
- {
31930
- var frameData = this.game.cache.getFrameData(key);
32315
+ this.key = key;
31931
32316
 
31932
- if (typeof frame === 'string')
31933
- {
31934
- this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key], frameData.getFrameByName(frame)));
31935
- }
31936
- else
31937
- {
31938
- this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key], frameData.getFrame(frame)));
31939
- }
32317
+ var frameData = this.game.cache.getFrameData(key);
32318
+
32319
+ if (typeof frame === 'string')
32320
+ {
32321
+ this._frame = 0;
32322
+ this._frameName = frame;
32323
+ this.setTexture(PIXI.TextureCache[frameData.getFrameByName(frame).uuid]);
32324
+ return;
31940
32325
  }
31941
32326
  else
31942
32327
  {
31943
- this.setTexture(new PIXI.Texture(PIXI.BaseTextureCache[key]));
32328
+ this._frame = frame;
32329
+ this._frameName = '';
32330
+ this.setTexture(PIXI.TextureCache[frameData.getFrame(frame).uuid]);
32331
+ return;
31944
32332
  }
31945
32333
  }
32334
+ else
32335
+ {
32336
+ this.key = key;
32337
+ this.setTexture(PIXI.TextureCache[key]);
32338
+ return;
32339
+ }
31946
32340
  }
31947
32341
 
31948
- this._frame = Phaser.Rectangle.clone(this.texture.frame);
31949
-
31950
32342
  };
31951
32343
 
31952
- /**
31953
- * Resets the Texture frame dimensions that the Image uses for rendering.
31954
- *
31955
- * @method Phaser.Image#resetFrame
31956
- * @memberof Phaser.Image
31957
- */
31958
- Phaser.Image.prototype.resetFrame = Phaser.Sprite.prototype.resetFrame;
31959
-
31960
- /**
31961
- * Sets the Texture frame the Image uses for rendering.
31962
- * This is primarily an internal method used by Image.loadTexture, although you may call it directly.
31963
- *
31964
- * @method Phaser.Image#setFrame
31965
- * @memberof Phaser.Image
31966
- * @param {Phaser.Frame} frame - The Frame to be used by the Image texture.
31967
- */
31968
- Phaser.Image.prototype.setFrame = Phaser.Sprite.prototype.setFrame;
31969
-
31970
- /**
31971
- * If you have set a crop rectangle on this Image via Image.crop and since modified the Image.cropRect property (or the rectangle it references)
31972
- * then you need to update the crop frame by calling this method.
31973
- *
31974
- * @method Phaser.Image#updateCrop
31975
- * @memberof Phaser.Image
31976
- */
31977
- Phaser.Image.prototype.updateCrop = Phaser.Sprite.prototype.updateCrop;
31978
-
31979
32344
  /**
31980
32345
  * Crop allows you to crop the texture used to display this Image.
31981
- * This modifies the core Image texture frame, so the Image width/height properties will adjust accordingly.
31982
- *
31983
- * Cropping takes place from the top-left of the Image and can be modified in real-time by either providing an updated rectangle object to Image.crop,
31984
- * or by modifying Image.cropRect (or a reference to it) and then calling Image.updateCrop.
31985
- *
32346
+ * Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.
31986
32347
  * The rectangle object given to this method can be either a Phaser.Rectangle or any object so long as it has public x, y, width and height properties.
31987
- * A reference to the rectangle is stored in Image.cropRect unless the `copy` parameter is `true` in which case the values are duplicated to a local object.
32348
+ * Please note that the rectangle object given is not duplicated by this method, but rather the Image uses a reference to the rectangle.
32349
+ * Keep this in mind if assigning a rectangle in a for-loop, or when cleaning up for garbage collection.
31988
32350
  *
31989
32351
  * @method Phaser.Image#crop
31990
32352
  * @memberof Phaser.Image
31991
- * @param {Phaser.Rectangle} rect - The Rectangle used during cropping. Pass null or no parameters to clear a previously set crop rectangle.
31992
- * @param {boolean} [copy=false] - If false Image.cropRect will be a reference to the given rect. If true it will copy the rect values into a local Image.cropRect object.
32353
+ * @param {Phaser.Rectangle|object} rect - The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.
31993
32354
  */
31994
- Phaser.Image.prototype.crop = Phaser.Sprite.prototype.crop;
32355
+ Phaser.Image.prototype.crop = function(rect) {
32356
+
32357
+ if (typeof rect === 'undefined' || rect === null)
32358
+ {
32359
+ // Clear any crop that may be set
32360
+ if (this.texture.hasOwnProperty('sourceWidth'))
32361
+ {
32362
+ this.texture.setFrame(new Phaser.Rectangle(0, 0, this.texture.sourceWidth, this.texture.sourceHeight));
32363
+ }
32364
+ }
32365
+ else
32366
+ {
32367
+ // Do we need to clone the PIXI.Texture object?
32368
+ if (this.texture instanceof PIXI.Texture)
32369
+ {
32370
+ // Yup, let's rock it ...
32371
+ var local = {};
32372
+
32373
+ Phaser.Utils.extend(true, local, this.texture);
32374
+
32375
+ local.sourceWidth = local.width;
32376
+ local.sourceHeight = local.height;
32377
+ local.frame = rect;
32378
+ local.width = rect.width;
32379
+ local.height = rect.height;
32380
+
32381
+ this.texture = local;
32382
+
32383
+ this.texture.updateFrame = true;
32384
+ PIXI.Texture.frameUpdates.push(this.texture);
32385
+ }
32386
+ else
32387
+ {
32388
+ this.texture.setFrame(rect);
32389
+ }
32390
+ }
32391
+
32392
+ };
31995
32393
 
31996
32394
  /**
31997
32395
  * Brings a 'dead' Image back to life, optionally giving it the health value specified.
@@ -32027,7 +32425,20 @@ Phaser.Image.prototype.revive = function() {
32027
32425
  * @memberof Phaser.Image
32028
32426
  * @return {Phaser.Image} This instance.
32029
32427
  */
32030
- Phaser.Image.prototype.kill = Phaser.Sprite.prototype.kill;
32428
+ Phaser.Image.prototype.kill = function() {
32429
+
32430
+ this.alive = false;
32431
+ this.exists = false;
32432
+ this.visible = false;
32433
+
32434
+ if (this.events)
32435
+ {
32436
+ this.events.onKilled.dispatch(this);
32437
+ }
32438
+
32439
+ return this;
32440
+
32441
+ };
32031
32442
 
32032
32443
  /**
32033
32444
  * Destroys the Image. This removes it from its parent group, destroys the input, event and animation handlers if present
@@ -32037,7 +32448,64 @@ Phaser.Image.prototype.kill = Phaser.Sprite.prototype.kill;
32037
32448
  * @memberof Phaser.Image
32038
32449
  * @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
32039
32450
  */
32040
- Phaser.Image.prototype.destroy = Phaser.Sprite.prototype.destroy;
32451
+ Phaser.Image.prototype.destroy = function(destroyChildren) {
32452
+
32453
+ if (this.game === null || this.destroyPhase) { return; }
32454
+
32455
+ if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
32456
+
32457
+ this._cache[8] = 1;
32458
+
32459
+ if (this.parent)
32460
+ {
32461
+ if (this.parent instanceof Phaser.Group)
32462
+ {
32463
+ this.parent.remove(this);
32464
+ }
32465
+ else
32466
+ {
32467
+ this.parent.removeChild(this);
32468
+ }
32469
+ }
32470
+
32471
+ if (this.events)
32472
+ {
32473
+ this.events.destroy();
32474
+ }
32475
+
32476
+ if (this.input)
32477
+ {
32478
+ this.input.destroy();
32479
+ }
32480
+
32481
+ var i = this.children.length;
32482
+
32483
+ if (destroyChildren)
32484
+ {
32485
+ while (i--)
32486
+ {
32487
+ this.children[i].destroy(destroyChildren);
32488
+ }
32489
+ }
32490
+ else
32491
+ {
32492
+ while (i--)
32493
+ {
32494
+ this.removeChild(this.children[i]);
32495
+ }
32496
+ }
32497
+
32498
+ this.alive = false;
32499
+ this.exists = false;
32500
+ this.visible = false;
32501
+
32502
+ this.filters = null;
32503
+ this.mask = null;
32504
+ this.game = null;
32505
+
32506
+ this._cache[8] = 0;
32507
+
32508
+ };
32041
32509
 
32042
32510
  /**
32043
32511
  * Resets the Image. This places the Image at the given x/y world coordinates and then sets alive, exists, visible and renderable all to true.
@@ -32070,7 +32538,16 @@ Phaser.Image.prototype.reset = function(x, y) {
32070
32538
  * @memberof Phaser.Image
32071
32539
  * @return {Phaser.Image} This instance.
32072
32540
  */
32073
- Phaser.Image.prototype.bringToTop = Phaser.Sprite.prototype.bringToTop;
32541
+ Phaser.Image.prototype.bringToTop = function() {
32542
+
32543
+ if (this.parent)
32544
+ {
32545
+ this.parent.bringToTop(this);
32546
+ }
32547
+
32548
+ return this;
32549
+
32550
+ };
32074
32551
 
32075
32552
  /**
32076
32553
  * Indicates the rotation of the Image, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
@@ -32189,7 +32666,7 @@ Object.defineProperty(Phaser.Image.prototype, "frame", {
32189
32666
 
32190
32667
  get: function() {
32191
32668
 
32192
- return this._cache[9];
32669
+ return this._frame;
32193
32670
 
32194
32671
  },
32195
32672
 
@@ -32201,8 +32678,8 @@ Object.defineProperty(Phaser.Image.prototype, "frame", {
32201
32678
 
32202
32679
  if (frameData && value < frameData.total && frameData.getFrame(value))
32203
32680
  {
32204
- this._cache[9] = value;
32205
- this.setFrame(frameData.getFrame(value));
32681
+ this.setTexture(PIXI.TextureCache[frameData.getFrame(value).uuid]);
32682
+ this._frame = value;
32206
32683
  }
32207
32684
  }
32208
32685
 
@@ -32230,8 +32707,8 @@ Object.defineProperty(Phaser.Image.prototype, "frameName", {
32230
32707
 
32231
32708
  if (frameData && frameData.getFrameByName(value))
32232
32709
  {
32710
+ this.setTexture(PIXI.TextureCache[frameData.getFrameByName(value).uuid]);
32233
32711
  this._frameName = value;
32234
- this.setFrame(frameData.getFrameByName(value));
32235
32712
  }
32236
32713
  }
32237
32714
 
@@ -32733,6 +33210,7 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
32733
33210
  }
32734
33211
  else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
32735
33212
  {
33213
+ console.warn("Texture with key '" + key + "' not found.");
32736
33214
  this.key = '__missing';
32737
33215
  this.setTexture(PIXI.TextureCache[this.key]);
32738
33216
  }
@@ -33327,7 +33805,7 @@ Phaser.Text.prototype.preUpdate = function () {
33327
33805
  this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
33328
33806
  }
33329
33807
 
33330
- this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
33808
+ this.world.setTo(this.game.camera.x + this.worldTransform.tx, this.game.camera.y + this.worldTransform.ty);
33331
33809
 
33332
33810
  if (this.visible)
33333
33811
  {
@@ -34244,7 +34722,7 @@ Phaser.BitmapText.prototype.preUpdate = function () {
34244
34722
  this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
34245
34723
  }
34246
34724
 
34247
- this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
34725
+ this.world.setTo(this.game.camera.x + this.worldTransform.tx, this.game.camera.y + this.worldTransform.ty);
34248
34726
 
34249
34727
  if (this.visible)
34250
34728
  {
@@ -35315,7 +35793,7 @@ Phaser.Graphics.prototype.preUpdate = function () {
35315
35793
  this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
35316
35794
  }
35317
35795
 
35318
- this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
35796
+ this.world.setTo(this.game.camera.x + this.worldTransform.tx, this.game.camera.y + this.worldTransform.ty);
35319
35797
 
35320
35798
  if (this.visible)
35321
35799
  {
@@ -35696,12 +36174,14 @@ Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear)
35696
36174
  * @extends Phaser.Group
35697
36175
  * @constructor
35698
36176
  * @param {Phaser.Game} game - A reference to the currently running game.
35699
- * @param {Phaser.Group|Phaser.Sprite} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
36177
+ * @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If `undefined` or `null` it will use game.world.
35700
36178
  * @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
35701
36179
  * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
35702
36180
  */
35703
36181
  Phaser.SpriteBatch = function (game, parent, name, addToStage) {
35704
36182
 
36183
+ if (typeof parent === 'undefined' || parent === null) { parent = game.world; }
36184
+
35705
36185
  PIXI.SpriteBatch.call(this);
35706
36186
 
35707
36187
  Phaser.Group.call(this, game, parent, name, addToStage);
@@ -39711,19 +40191,17 @@ Phaser.QuadTree.prototype = {
39711
40191
  */
39712
40192
  split: function () {
39713
40193
 
39714
- this.level++;
39715
-
39716
40194
  // top right node
39717
- this.nodes[0] = new Phaser.QuadTree(this.bounds.right, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
40195
+ this.nodes[0] = new Phaser.QuadTree(this.bounds.right, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, (this.level + 1));
39718
40196
 
39719
40197
  // top left node
39720
- this.nodes[1] = new Phaser.QuadTree(this.bounds.x, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
40198
+ this.nodes[1] = new Phaser.QuadTree(this.bounds.x, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, (this.level + 1));
39721
40199
 
39722
40200
  // bottom left node
39723
- this.nodes[2] = new Phaser.QuadTree(this.bounds.x, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
40201
+ this.nodes[2] = new Phaser.QuadTree(this.bounds.x, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, (this.level + 1));
39724
40202
 
39725
40203
  // bottom right node
39726
- this.nodes[3] = new Phaser.QuadTree(this.bounds.right, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
40204
+ this.nodes[3] = new Phaser.QuadTree(this.bounds.right, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, (this.level + 1));
39727
40205
 
39728
40206
  },
39729
40207
 
@@ -40176,6 +40654,15 @@ Phaser.TweenManager.prototype = {
40176
40654
  {
40177
40655
  this._tweens[i].pendingDelete = true;
40178
40656
  }
40657
+ else
40658
+ {
40659
+ i = this._add.indexOf(tween);
40660
+
40661
+ if (i !== -1)
40662
+ {
40663
+ this._add[i].pendingDelete = true;
40664
+ }
40665
+ }
40179
40666
 
40180
40667
  },
40181
40668
 
@@ -40187,13 +40674,15 @@ Phaser.TweenManager.prototype = {
40187
40674
  */
40188
40675
  update: function () {
40189
40676
 
40190
- if (this._tweens.length === 0 && this._add.length === 0)
40677
+ var addTweens = this._add.length;
40678
+ var numTweens = this._tweens.length;
40679
+
40680
+ if (numTweens === 0 && addTweens === 0)
40191
40681
  {
40192
40682
  return false;
40193
40683
  }
40194
40684
 
40195
40685
  var i = 0;
40196
- var numTweens = this._tweens.length;
40197
40686
 
40198
40687
  while (i < numTweens)
40199
40688
  {
@@ -40210,7 +40699,7 @@ Phaser.TweenManager.prototype = {
40210
40699
  }
40211
40700
 
40212
40701
  // If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
40213
- if (this._add.length > 0)
40702
+ if (addTweens > 0)
40214
40703
  {
40215
40704
  this._tweens = this._tweens.concat(this._add);
40216
40705
  this._add.length = 0;
@@ -42938,6 +43427,15 @@ Phaser.AnimationManager.prototype = {
42938
43427
  */
42939
43428
  loadFrameData: function (frameData, frame) {
42940
43429
 
43430
+ if (this.isLoaded)
43431
+ {
43432
+ // We need to update the frameData that the animations are using
43433
+ for (var anim in this._anims)
43434
+ {
43435
+ this._anims[anim].updateFrameData(frameData);
43436
+ }
43437
+ }
43438
+
42941
43439
  this._frameData = frameData;
42942
43440
 
42943
43441
  if (typeof frame === 'undefined' || frame === null)
@@ -43105,6 +43603,7 @@ Phaser.AnimationManager.prototype = {
43105
43603
 
43106
43604
  this.currentAnim = this._anims[name];
43107
43605
  this.currentAnim.paused = false;
43606
+ this.currentFrame = this.currentAnim.currentFrame;
43108
43607
  return this.currentAnim.play(frameRate, loop, killOnComplete);
43109
43608
  }
43110
43609
  }
@@ -43903,6 +44402,19 @@ Phaser.Animation.prototype = {
43903
44402
 
43904
44403
  },
43905
44404
 
44405
+ /**
44406
+ * Changes the FrameData object this Animation is using.
44407
+ *
44408
+ * @method Phaser.Animation#updateFrameData
44409
+ * @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
44410
+ */
44411
+ updateFrameData: function (frameData) {
44412
+
44413
+ this._frameData = frameData;
44414
+ this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null;
44415
+
44416
+ },
44417
+
43906
44418
  /**
43907
44419
  * Cleans up this animation ready for deletion. Nulls all values and references.
43908
44420
  *
@@ -44613,7 +45125,7 @@ Phaser.AnimationParser = {
44613
45125
  // Zero or smaller than frame sizes?
44614
45126
  if (width === 0 || height === 0 || width < frameWidth || height < frameHeight || total === 0)
44615
45127
  {
44616
- console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight");
45128
+ console.warn("Phaser.AnimationParser.spriteSheet: '" + key + "'s width/height zero or width/height < given frameWidth/frameHeight");
44617
45129
  return null;
44618
45130
  }
44619
45131
 
@@ -44629,6 +45141,13 @@ Phaser.AnimationParser = {
44629
45141
  // uuid needed?
44630
45142
  data.addFrame(new Phaser.Frame(i, x, y, frameWidth, frameHeight, '', uuid));
44631
45143
 
45144
+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[key], {
45145
+ x: x,
45146
+ y: y,
45147
+ width: frameWidth,
45148
+ height: frameHeight
45149
+ });
45150
+
44632
45151
  x += frameWidth + spacing;
44633
45152
 
44634
45153
  if (x + frameWidth > width)
@@ -44648,9 +45167,10 @@ Phaser.AnimationParser = {
44648
45167
  * @method Phaser.AnimationParser.JSONData
44649
45168
  * @param {Phaser.Game} game - A reference to the currently running game.
44650
45169
  * @param {Object} json - The JSON data from the Texture Atlas. Must be in Array format.
45170
+ * @param {string} cacheKey - The Game.Cache asset key of the texture image.
44651
45171
  * @return {Phaser.FrameData} A FrameData object containing the parsed frames.
44652
45172
  */
44653
- JSONData: function (game, json) {
45173
+ JSONData: function (game, json, cacheKey) {
44654
45174
 
44655
45175
  // Malformed?
44656
45176
  if (!json['frames'])
@@ -44681,6 +45201,13 @@ Phaser.AnimationParser = {
44681
45201
  uuid
44682
45202
  ));
44683
45203
 
45204
+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
45205
+ x: frames[i].frame.x,
45206
+ y: frames[i].frame.y,
45207
+ width: frames[i].frame.w,
45208
+ height: frames[i].frame.h
45209
+ });
45210
+
44684
45211
  if (frames[i].trimmed)
44685
45212
  {
44686
45213
  newFrame.setTrim(
@@ -44705,9 +45232,10 @@ Phaser.AnimationParser = {
44705
45232
  * @method Phaser.AnimationParser.JSONDataHash
44706
45233
  * @param {Phaser.Game} game - A reference to the currently running game.
44707
45234
  * @param {Object} json - The JSON data from the Texture Atlas. Must be in JSON Hash format.
45235
+ * @param {string} cacheKey - The Game.Cache asset key of the texture image.
44708
45236
  * @return {Phaser.FrameData} A FrameData object containing the parsed frames.
44709
45237
  */
44710
- JSONDataHash: function (game, json) {
45238
+ JSONDataHash: function (game, json, cacheKey) {
44711
45239
 
44712
45240
  // Malformed?
44713
45241
  if (!json['frames'])
@@ -44739,6 +45267,13 @@ Phaser.AnimationParser = {
44739
45267
  uuid
44740
45268
  ));
44741
45269
 
45270
+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
45271
+ x: frames[key].frame.x,
45272
+ y: frames[key].frame.y,
45273
+ width: frames[key].frame.w,
45274
+ height: frames[key].frame.h
45275
+ });
45276
+
44742
45277
  if (frames[key].trimmed)
44743
45278
  {
44744
45279
  newFrame.setTrim(
@@ -44765,9 +45300,10 @@ Phaser.AnimationParser = {
44765
45300
  * @method Phaser.AnimationParser.XMLData
44766
45301
  * @param {Phaser.Game} game - A reference to the currently running game.
44767
45302
  * @param {Object} xml - The XML data from the Texture Atlas. Must be in Starling XML format.
45303
+ * @param {string} cacheKey - The Game.Cache asset key of the texture image.
44768
45304
  * @return {Phaser.FrameData} A FrameData object containing the parsed frames.
44769
45305
  */
44770
- XMLData: function (game, xml) {
45306
+ XMLData: function (game, xml, cacheKey) {
44771
45307
 
44772
45308
  // Malformed?
44773
45309
  if (!xml.getElementsByTagName('TextureAtlas'))
@@ -44818,7 +45354,13 @@ Phaser.AnimationParser = {
44818
45354
 
44819
45355
  newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
44820
45356
 
44821
- // Trimmed?
45357
+ PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
45358
+ x: x,
45359
+ y: y,
45360
+ width: width,
45361
+ height: height
45362
+ });
45363
+ // Trimmed?
44822
45364
  if (frameX !== null || frameY !== null)
44823
45365
  {
44824
45366
  newFrame.setTrim(true, width, height, frameX, frameY, frameWidth, frameHeight);
@@ -45089,6 +45631,7 @@ Phaser.Cache.prototype = {
45089
45631
  this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight, margin: margin, spacing: spacing };
45090
45632
 
45091
45633
  PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
45634
+ PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
45092
45635
 
45093
45636
  this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax, margin, spacing);
45094
45637
 
@@ -45124,6 +45667,7 @@ Phaser.Cache.prototype = {
45124
45667
  this._images[key] = { url: url, data: data, spriteSheet: true };
45125
45668
 
45126
45669
  PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
45670
+ PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
45127
45671
 
45128
45672
  if (format == Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY)
45129
45673
  {
@@ -45156,6 +45700,7 @@ Phaser.Cache.prototype = {
45156
45700
  this._images[key] = { url: url, data: data, spriteSheet: true };
45157
45701
 
45158
45702
  PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
45703
+ PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
45159
45704
 
45160
45705
  Phaser.LoaderParser.bitmapFont(this.game, xmlData, key, xSpacing, ySpacing);
45161
45706
 
@@ -45257,6 +45802,7 @@ Phaser.Cache.prototype = {
45257
45802
  this._images[key].frame = new Phaser.Frame(0, 0, 0, data.width, data.height, key, this.game.rnd.uuid());
45258
45803
 
45259
45804
  PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
45805
+ PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
45260
45806
 
45261
45807
  },
45262
45808
 
@@ -46292,6 +46838,11 @@ Phaser.Loader = function (game) {
46292
46838
  */
46293
46839
  this.onLoadComplete = new Phaser.Signal();
46294
46840
 
46841
+ /**
46842
+ * @property {Phaser.Signal} onPackComplete - This event is dispatched when an asset pack has either loaded or failed.
46843
+ */
46844
+ this.onPackComplete = new Phaser.Signal();
46845
+
46295
46846
  /**
46296
46847
  * @property {array} _packList - Contains all the assets packs.
46297
46848
  * @private
@@ -47299,7 +47850,7 @@ Phaser.Loader.prototype = {
47299
47850
 
47300
47851
  console.warn("Phaser.Loader error loading pack file: " + this._packList[index].key + ' from URL ' + this._packList[index].url);
47301
47852
 
47302
- this.nextPack(index, true);
47853
+ this.nextPack(index, false);
47303
47854
 
47304
47855
  },
47305
47856
 
@@ -51416,6 +51967,8 @@ Phaser.Physics.prototype = {
51416
51967
  throw new Error('The Chipmunk physics system has not been implemented yet.');
51417
51968
  }
51418
51969
 
51970
+ this.setBoundsToWorld();
51971
+
51419
51972
  },
51420
51973
 
51421
51974
  /**
@@ -56933,17 +57486,18 @@ Phaser.Tilemap.prototype = {
56933
57486
  * @method Phaser.Tilemap#swapHandler
56934
57487
  * @private
56935
57488
  * @param {number} value
56936
- * @param {number} index
56937
57489
  */
56938
- swapHandler: function (value, index) {
57490
+ swapHandler: function (value) {
56939
57491
 
56940
57492
  if (value.index === this._tempA)
56941
57493
  {
56942
- this._results[index].index = this._tempB;
57494
+ // Swap A with B
57495
+ value.index = this._tempB;
56943
57496
  }
56944
- if (value.index === this._tempB)
57497
+ else if (value.index === this._tempB)
56945
57498
  {
56946
- this._results[index].index = this._tempA;
57499
+ // Swap B with A
57500
+ value.index = this._tempA;
56947
57501
  }
56948
57502
 
56949
57503
  },
@@ -79047,7 +79601,9 @@ Phaser.Physics.P2.Body.prototype = {
79047
79601
 
79048
79602
  options = options || {};
79049
79603
 
79050
- points = Array.prototype.slice.call(arguments, 1);
79604
+ if (!Array.isArray(points)) {
79605
+ points = Array.prototype.slice.call(arguments, 1);
79606
+ }
79051
79607
 
79052
79608
  var path = [];
79053
79609