phaser-rails 2.4.1.0 → 2.4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bad103d73f34b7f1c466951e4071ec6ac42f68f0
4
- data.tar.gz: 5a228a7ff5449c4fdfc5046e649f69f419ca7fc2
3
+ metadata.gz: ce2956d2d3560e2aee2e3063ac99ed1ba31ab122
4
+ data.tar.gz: a394622b8b7d9ed5bef6fa8db74b95a765f2b2eb
5
5
  SHA512:
6
- metadata.gz: 85e3995cba0c1a6b2a3b180e1be1a0cab9b42580b471a7110a8a186ddbeb653d37714e26e55dc35b52bdfe2a7b9260d9c86117af15ae033a040f6586c2e6dad1
7
- data.tar.gz: ab0c10c4b8117d9fb1485e1bba93492c0d2523a6afc51ed83a4edb4525c17a8b9bfa8fa843593580a57804090089c83aff5bfee4bc5012c2467b1f0e6646f59d
6
+ metadata.gz: 1f43760791a793dd235d92be40eda4405e937ea266a927eebbe36867cc65486ec9c7a4858534bfcf5354d830737b1bf734149fb44ca3f6ac1dad426434da0343
7
+ data.tar.gz: 5d38ae63d1f96b490dc7161bbaf5f625c2432b29b99fc952f3b4d71c8ace625342d1fee750b5d48a179553c461a0211be6b2ea8ecb3e8f18ec8f102d5269aeba
@@ -1,5 +1,5 @@
1
1
  module Phaser
2
2
  module Rails
3
- VERSION = "2.4.1.0"
3
+ VERSION = "2.4.2.0"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Phaser - http://phaser.io
9
9
  *
10
- * v2.4.1 "Ionin Spring" - Built: Fri Jul 24 2015 13:26:30
10
+ * v2.4.2 "Altara" - Built: Wed Jul 29 2015 14:59:16
11
11
  *
12
12
  * By Richard Davey http://www.photonstorm.com @photonstorm
13
13
  *
@@ -13690,7 +13690,7 @@ PIXI.CANVAS_RENDERER = 1;
13690
13690
  */
13691
13691
  PIXI.VERSION = "v2.2.8";
13692
13692
 
13693
- // used to create uids for various pixi objects..
13693
+ // used to create uids for various pixi objects.
13694
13694
  PIXI._UID = 0;
13695
13695
 
13696
13696
  if (typeof(Float32Array) != 'undefined')
@@ -23996,7 +23996,7 @@ var Phaser = Phaser || {
23996
23996
  * @constant
23997
23997
  * @type {string}
23998
23998
  */
23999
- VERSION: '2.4.1',
23999
+ VERSION: '2.4.2',
24000
24000
 
24001
24001
  /**
24002
24002
  * An array of Phaser game instances.
@@ -41261,9 +41261,12 @@ Phaser.DeviceButton.prototype = {
41261
41261
  this.event = event;
41262
41262
  this.value = value;
41263
41263
 
41264
- this.altKey = event.altKey;
41265
- this.shiftKey = event.shiftKey;
41266
- this.ctrlKey = event.ctrlKey;
41264
+ if (event)
41265
+ {
41266
+ this.altKey = event.altKey;
41267
+ this.shiftKey = event.shiftKey;
41268
+ this.ctrlKey = event.ctrlKey;
41269
+ }
41267
41270
 
41268
41271
  this.onDown.dispatch(this, value);
41269
41272
 
@@ -41292,9 +41295,12 @@ Phaser.DeviceButton.prototype = {
41292
41295
  this.event = event;
41293
41296
  this.value = value;
41294
41297
 
41295
- this.altKey = event.altKey;
41296
- this.shiftKey = event.shiftKey;
41297
- this.ctrlKey = event.ctrlKey;
41298
+ if (event)
41299
+ {
41300
+ this.altKey = event.altKey;
41301
+ this.shiftKey = event.shiftKey;
41302
+ this.ctrlKey = event.ctrlKey;
41303
+ }
41298
41304
 
41299
41305
  this.onUp.dispatch(this, value);
41300
41306
 
@@ -41832,6 +41838,94 @@ Phaser.Pointer.prototype = {
41832
41838
 
41833
41839
  },
41834
41840
 
41841
+ /**
41842
+ * Called by updateButtons.
41843
+ *
41844
+ * @method Phaser.Pointer#processButtonsDown
41845
+ * @private
41846
+ * @param {integer} buttons - The DOM event.buttons property.
41847
+ * @param {MouseEvent} event - The DOM event.
41848
+ */
41849
+ processButtonsDown: function (buttons, event) {
41850
+
41851
+ // Note: These are bitwise checks, not booleans
41852
+
41853
+ if (Phaser.Pointer.LEFT_BUTTON & buttons)
41854
+ {
41855
+ this.leftButton.start(event);
41856
+ }
41857
+
41858
+ if (Phaser.Pointer.RIGHT_BUTTON & buttons)
41859
+ {
41860
+ this.rightButton.start(event);
41861
+ }
41862
+
41863
+ if (Phaser.Pointer.MIDDLE_BUTTON & buttons)
41864
+ {
41865
+ this.middleButton.start(event);
41866
+ }
41867
+
41868
+ if (Phaser.Pointer.BACK_BUTTON & buttons)
41869
+ {
41870
+ this.backButton.start(event);
41871
+ }
41872
+
41873
+ if (Phaser.Pointer.FORWARD_BUTTON & buttons)
41874
+ {
41875
+ this.forwardButton.start(event);
41876
+ }
41877
+
41878
+ if (Phaser.Pointer.ERASER_BUTTON & buttons)
41879
+ {
41880
+ this.eraserButton.start(event);
41881
+ }
41882
+
41883
+ },
41884
+
41885
+ /**
41886
+ * Called by updateButtons.
41887
+ *
41888
+ * @method Phaser.Pointer#processButtonsUp
41889
+ * @private
41890
+ * @param {integer} buttons - The DOM event.buttons property.
41891
+ * @param {MouseEvent} event - The DOM event.
41892
+ */
41893
+ processButtonsUp: function (button, event) {
41894
+
41895
+ // Note: These are bitwise checks, not booleans
41896
+
41897
+ if (button === Phaser.Mouse.LEFT_BUTTON)
41898
+ {
41899
+ this.leftButton.stop(event);
41900
+ }
41901
+
41902
+ if (button === Phaser.Mouse.RIGHT_BUTTON)
41903
+ {
41904
+ this.rightButton.stop(event);
41905
+ }
41906
+
41907
+ if (button === Phaser.Mouse.MIDDLE_BUTTON)
41908
+ {
41909
+ this.middleButton.stop(event);
41910
+ }
41911
+
41912
+ if (button === Phaser.Mouse.BACK_BUTTON)
41913
+ {
41914
+ this.backButton.stop(event);
41915
+ }
41916
+
41917
+ if (button === Phaser.Mouse.FORWARD_BUTTON)
41918
+ {
41919
+ this.forwardButton.stop(event);
41920
+ }
41921
+
41922
+ if (button === 5)
41923
+ {
41924
+ this.eraserButton.stop(event);
41925
+ }
41926
+
41927
+ },
41928
+
41835
41929
  /**
41836
41930
  * Called when the event.buttons property changes from zero.
41837
41931
  * Contains a button bitmask.
@@ -41844,73 +41938,23 @@ Phaser.Pointer.prototype = {
41844
41938
 
41845
41939
  this.button = event.button;
41846
41940
 
41847
- // This is tested back to IE9, but possibly some browsers may report this differently.
41848
- // If you find one, please tell us!
41849
- var buttons = event.buttons;
41941
+ var down = (event.type.toLowerCase().substr(-4) === 'down');
41850
41942
 
41851
- if (buttons !== undefined)
41943
+ if (event.buttons !== undefined)
41852
41944
  {
41853
- // Note: These are bitwise checks, not booleans
41854
-
41855
- if (Phaser.Pointer.LEFT_BUTTON & buttons)
41856
- {
41857
- this.leftButton.start(event);
41858
- }
41859
- else
41860
- {
41861
- this.leftButton.stop(event);
41862
- }
41863
-
41864
- if (Phaser.Pointer.RIGHT_BUTTON & buttons)
41865
- {
41866
- this.rightButton.start(event);
41867
- }
41868
- else
41869
- {
41870
- this.rightButton.stop(event);
41871
- }
41872
-
41873
- if (Phaser.Pointer.MIDDLE_BUTTON & buttons)
41874
- {
41875
- this.middleButton.start(event);
41876
- }
41877
- else
41878
- {
41879
- this.middleButton.stop(event);
41880
- }
41881
-
41882
- if (Phaser.Pointer.BACK_BUTTON & buttons)
41883
- {
41884
- this.backButton.start(event);
41885
- }
41886
- else
41887
- {
41888
- this.backButton.stop(event);
41889
- }
41890
-
41891
- if (Phaser.Pointer.FORWARD_BUTTON & buttons)
41945
+ if (down)
41892
41946
  {
41893
- this.forwardButton.start(event);
41947
+ this.processButtonsDown(event.buttons, event);
41894
41948
  }
41895
41949
  else
41896
41950
  {
41897
- this.forwardButton.stop(event);
41898
- }
41899
-
41900
- if (Phaser.Pointer.ERASER_BUTTON & buttons)
41901
- {
41902
- this.eraserButton.start(event);
41903
- }
41904
- else
41905
- {
41906
- this.eraserButton.stop(event);
41951
+ this.processButtonsUp(event.button, event);
41907
41952
  }
41908
41953
  }
41909
41954
  else
41910
41955
  {
41911
41956
  // No buttons property (like Safari on OSX when using a trackpad)
41912
-
41913
- if (event.type === 'mousedown')
41957
+ if (down)
41914
41958
  {
41915
41959
  this.leftButton.start(event);
41916
41960
  }
@@ -41923,6 +41967,7 @@ Phaser.Pointer.prototype = {
41923
41967
 
41924
41968
  // On OS X (and other devices with trackpads) you have to press CTRL + the pad
41925
41969
  // to initiate a right-click event, so we'll check for that here
41970
+
41926
41971
  if (event.ctrlKey && this.leftButton.isDown)
41927
41972
  {
41928
41973
  this.rightButton.start(event);
@@ -41946,6 +41991,8 @@ Phaser.Pointer.prototype = {
41946
41991
  */
41947
41992
  start: function (event) {
41948
41993
 
41994
+ // console.log(event);
41995
+
41949
41996
  if (event['pointerId'])
41950
41997
  {
41951
41998
  this.pointerId = event.pointerId;
@@ -42076,7 +42123,7 @@ Phaser.Pointer.prototype = {
42076
42123
  this.button = event.button;
42077
42124
  }
42078
42125
 
42079
- if (fromClick)
42126
+ if (fromClick && this.isMouse)
42080
42127
  {
42081
42128
  this.updateButtons(event);
42082
42129
  }
@@ -57442,6 +57489,8 @@ Phaser.Text.fontPropertiesContext = Phaser.Text.fontPropertiesCanvas.getContext(
57442
57489
  * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
57443
57490
  * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
57444
57491
  *
57492
+ * If you were using an older version of Phaser (< 2.4) and using the DOMish parser hack, please remove this. It isn't required any longer.
57493
+ *
57445
57494
  * @class Phaser.BitmapText
57446
57495
  * @constructor
57447
57496
  * @extends PIXI.DisplayObjectContainer
@@ -60324,7 +60373,7 @@ Phaser.Device.canPlayVideo = function (type) {
60324
60373
  {
60325
60374
  return true;
60326
60375
  }
60327
- else if (type === 'ogg' && this.oggVideo)
60376
+ else if ((type === 'ogg' || type === 'ogv') && this.oggVideo)
60328
60377
  {
60329
60378
  return true;
60330
60379
  }
@@ -70522,11 +70571,14 @@ Phaser.Cache.prototype = {
70522
70571
  *
70523
70572
  * @method Phaser.Cache#getFrame
70524
70573
  * @param {string} key - Asset key of the frame data to retrieve from the Cache.
70574
+ * @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
70525
70575
  * @return {Phaser.Frame} The frame data.
70526
70576
  */
70527
- getFrame: function (key) {
70577
+ getFrame: function (key, cache) {
70578
+
70579
+ if (cache === undefined) { cache = Phaser.Cache.IMAGE; }
70528
70580
 
70529
- return this.getItem(key, Phaser.Cache.IMAGE, 'getFrame', 'frame');
70581
+ return this.getItem(key, cache, 'getFrame', 'frame');
70530
70582
 
70531
70583
  },
70532
70584
 
@@ -70535,11 +70587,12 @@ Phaser.Cache.prototype = {
70535
70587
  *
70536
70588
  * @method Phaser.Cache#getFrameCount
70537
70589
  * @param {string} key - Asset key of the FrameData you want.
70590
+ * @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
70538
70591
  * @return {number} Then number of frames. 0 if the image is not found.
70539
70592
  */
70540
- getFrameCount: function (key) {
70593
+ getFrameCount: function (key, cache) {
70541
70594
 
70542
- var data = this.getFrameData(key);
70595
+ var data = this.getFrameData(key, cache);
70543
70596
 
70544
70597
  if (data)
70545
70598
  {
@@ -70561,11 +70614,14 @@ Phaser.Cache.prototype = {
70561
70614
  *
70562
70615
  * @method Phaser.Cache#getFrameData
70563
70616
  * @param {string} key - Asset key of the frame data to retrieve from the Cache.
70617
+ * @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
70564
70618
  * @return {Phaser.FrameData} The frame data.
70565
70619
  */
70566
- getFrameData: function (key) {
70620
+ getFrameData: function (key, cache) {
70567
70621
 
70568
- return this.getItem(key, Phaser.Cache.IMAGE, 'getFrameData', 'frameData');
70622
+ if (cache === undefined) { cache = Phaser.Cache.IMAGE; }
70623
+
70624
+ return this.getItem(key, cache, 'getFrameData', 'frameData');
70569
70625
 
70570
70626
  },
70571
70627
 
@@ -70574,11 +70630,14 @@ Phaser.Cache.prototype = {
70574
70630
  *
70575
70631
  * @method Phaser.Cache#hasFrameData
70576
70632
  * @param {string} key - Asset key of the frame data to retrieve from the Cache.
70633
+ * @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search for the item in.
70577
70634
  * @return {boolean} True if the given key has frameData in the cache, otherwise false.
70578
70635
  */
70579
- hasFrameData: function (key) {
70636
+ hasFrameData: function (key, cache) {
70637
+
70638
+ if (cache === undefined) { cache = Phaser.Cache.IMAGE; }
70580
70639
 
70581
- return (this.getItem(key, Phaser.Cache.IMAGE, '', 'frameData') !== null);
70640
+ return (this.getItem(key, cache, '', 'frameData') !== null);
70582
70641
 
70583
70642
  },
70584
70643
 
@@ -70607,11 +70666,12 @@ Phaser.Cache.prototype = {
70607
70666
  * @method Phaser.Cache#getFrameByIndex
70608
70667
  * @param {string} key - Asset key of the frame data to retrieve from the Cache.
70609
70668
  * @param {number} index - The index of the frame you want to get.
70669
+ * @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search. One of the Cache consts such as `Phaser.Cache.IMAGE` or `Phaser.Cache.SOUND`.
70610
70670
  * @return {Phaser.Frame} The frame object.
70611
70671
  */
70612
- getFrameByIndex: function (key, index) {
70672
+ getFrameByIndex: function (key, index, cache) {
70613
70673
 
70614
- var data = this.getFrameData(key);
70674
+ var data = this.getFrameData(key, cache);
70615
70675
 
70616
70676
  if (data)
70617
70677
  {
@@ -70630,11 +70690,12 @@ Phaser.Cache.prototype = {
70630
70690
  * @method Phaser.Cache#getFrameByName
70631
70691
  * @param {string} key - Asset key of the frame data to retrieve from the Cache.
70632
70692
  * @param {string} name - The name of the frame you want to get.
70693
+ * @param {integer} [cache=Phaser.Cache.IMAGE] - The cache to search. One of the Cache consts such as `Phaser.Cache.IMAGE` or `Phaser.Cache.SOUND`.
70633
70694
  * @return {Phaser.Frame} The frame object.
70634
70695
  */
70635
- getFrameByName: function (key, name) {
70696
+ getFrameByName: function (key, name, cache) {
70636
70697
 
70637
- var data = this.getFrameData(key);
70698
+ var data = this.getFrameData(key, cache);
70638
70699
 
70639
70700
  if (data)
70640
70701
  {
@@ -70814,6 +70875,10 @@ Phaser.Cache.prototype = {
70814
70875
  /**
70815
70876
  * Removes a sound from the cache.
70816
70877
  *
70878
+ * If any `Phaser.Sound` objects use the audio file in the cache that you remove with this method, they will
70879
+ * _automatically_ destroy themselves. If you wish to have full control over when Sounds are destroyed then
70880
+ * you must finish your house-keeping and destroy them all yourself first, before calling this method.
70881
+ *
70817
70882
  * Note that this only removes it from the Phaser.Cache. If you still have references to the data elsewhere
70818
70883
  * then it will persist in memory.
70819
70884
  *
@@ -74753,6 +74818,12 @@ Phaser.Sound.prototype = {
74753
74818
  */
74754
74819
  update: function () {
74755
74820
 
74821
+ if (!this.game.cache.checkSoundKey(this.key))
74822
+ {
74823
+ this.destroy();
74824
+ return;
74825
+ }
74826
+
74756
74827
  if (this.isDecoded && !this._onDecodedEventDispatched)
74757
74828
  {
74758
74829
  this.onDecoded.dispatch(this);
@@ -91499,8 +91570,6 @@ Phaser.TilemapLayer.prototype.render = function () {
91499
91570
  return;
91500
91571
  }
91501
91572
 
91502
- this.context.save();
91503
-
91504
91573
  if (this.dirty || this.layer.dirty)
91505
91574
  {
91506
91575
  this.layer.dirty = false;
@@ -91526,6 +91595,8 @@ Phaser.TilemapLayer.prototype.render = function () {
91526
91595
  return;
91527
91596
  }
91528
91597
 
91598
+ this.context.save();
91599
+
91529
91600
  mc.scrollX = scrollX;
91530
91601
  mc.scrollY = scrollY;
91531
91602