Skip to content

Commit 9f24c08

Browse files
committed
Updated readme and docs.
1 parent 1661cdd commit 9f24c08

File tree

238 files changed

+17869
-12301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+17869
-12301
lines changed

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
# Change Log
22

3+
## Version 2.1.2 - "Whitebridge" - 9th October 2014
4+
5+
### New Features
6+
7+
* StateManager.unlink will null all State-level Phaser properties, such as `game`, `add`, etc. Useful if you never need to return to the State again.
8+
* Cache.removeImage has a new parameter: `removeFromPixi` which is `true` by default. It will remove the image from the Pixi BaseTextureCache as well as from the Phaser Cache. Set to false if you don't want the Pixi cache touched.
9+
* Group.ignoreDestroy boolean will bail out early from any call to `Group.destroy`. Handy if you need to create a global Group that persists across States.
10+
* Loader can now natively load XML files via `load.xml`. Once the XML file has loaded it is parsed via either DOMParser or ActiveXObject and then added to the Cache, where it can be retrieved via `cache.getXML(key)`.
11+
* Cache now has support for XML files stored in their own container. You can add them with `cache.addXML` (typically this is done from the Loader automatically for you) and get them with `cache.getXML(key)`. There is also `cache.checkXMLKey(key)`, `cache.checkKeys` and `cache.removeXML(key)`.
12+
* Rectangle.aabb is a new method that will take an array of Points and return a Rectangle that matches the AABB (bounding area) of the Points (thanks @codevinsky #1199)
13+
* AudioSprite support is now built into the Loader and SoundManager. AudioSprites are like sprite sheets, only they consist of a selection of audio files and markers in a json configuration. You can find more details at https://github.com/tonistiigi/audiosprite (thanks @codevinsky #1205)
14+
* Point.parse will return a new Point object based on the x and y properties of the object given to Point.parse (thanks @codevinsky #1198)
15+
* Sound.fadeOut(duration) will fade the Sound to a volume of zero over the duration given. At the end of the fade the Sound will be stopped and Sound.onFadeComplete dispatched.
16+
* Sound.fadeIn(duration, loop) will start the Sound playing, or restart it if already playing, set its volume to zero and then increase the volume over the duration given until it reaches 1. At the end of the fade the Sound.onFadeComplete event is dispatched.
17+
* Text.addColor allows you to set specific colors within the Text. It works by taking a color value, which is a typical HTML string such as `#ff0000` or `rgb(255,0,0)` and a position. The position value is the index of the character in the Text string to start applying this color to. Once set the color remains in use until either another color or the end of the string is encountered. For example if the Text was `Photon Storm` and you did `Text.addColor('#ffff00', 6)` it would color in the word `Storm` in yellow.
18+
* Text.clearColors resets any previously set colors from `Text.addColor`.
19+
* If you pass a tinted Sprite to `BitmapData.draw` or `BitmapData.copy` it will now draw the tinted version of the Sprite to the BitmapData and not the original texture.
20+
* BitmapData.shadow(color, blur, x, y) provides a quick way to set all the relevant shadow settings, which are then be used in future draw calls.
21+
* Cache.addBitmapData has a new parameter: `frameData` allowing you to pass a `Phaser.FrameData` object along with the BitmapData.
22+
* Cache.getFrameData has a new parameter: `map` which allows you to specify which cache to get the FrameData from, i.e. `Phaser.Cache.IMAGE` or `Phaser.Cache.BITMAPDATA`.
23+
* Sprite.loadTexture if given a BitmapData as the texture will now query the cache to see if it has any associated FrameData, and if so it will load that into the AnimationManager.
24+
* BitmapData.textureLine takes a Phaser.Line object and an image in the image cache. It then accurately draws the image as a repeating texture for the full length of the line.
25+
* AnimationManager.name will now return the `name` property of the currently playing animation, if any.
26+
* Group.filter takes a predicate function and passes child, index, and the entire child array to it. It then returns an ArrayList containing all children that the predicate returns true for (thanks @codevinsky #1187)
27+
* Cache.checkUrl allows you to check if a resource is in the cache based on an absolute URL (thanks @englercj #1221)
28+
* Cache.getUrl gets a resource from the cache based on the absolute URL it was loaded from (thanks @englercj #1221)
29+
* Sound.allowMultiple allows you to have multiple instances of a single Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels. But it allows for one Sound object to play overlapping times, useful for gun effects and similar (#1220)
30+
31+
### Updates
32+
33+
* TypeScript definitions fixes and updates (thanks @clark-stevenson @englercj @benjamindulau)
34+
* Added the `sourceRect` and `maskRect` parameters back into `BitmapData.alphaMask` as they were accidentally removed in 2.1 (thanks seejay92)
35+
* jsdoc fixes (thanks @danxexe #1209)
36+
* AnimationParser is now using `value` instead of `nodeValue` when parsing atlas XML files, avoiding Chrome deprecation warnings (thanks @valtterip #1189)
37+
* Color.webToColor restored. Converts a CSS rgba color into a native color value.
38+
* Color.createColor now populates the `color` property of the returned object with the results of `Phaser.Color.getColor`.
39+
* Color.createColor now has a `color32` property with the results of `Phaser.Color.getColor32`.
40+
* Color.hexToColor has been optimised to inline the regex and has moved the createColor call so it now populates the color object fully, not just setting the r,g,b properties.
41+
* Keyboard.PLUS and Keyboard.MINUS have been added to the list of key codes (thanks @VictorBjelkholm #1281)
42+
43+
### Bug Fixes
44+
45+
* If Game Objects change their frame, such as with an animated Sprite, and the change goes from a previously trimmed frame to a non-trimmed (full size) one, then the previous trim values were still left active, causing it to glitch (thanks stupot)
46+
* If you called StateManager.start from within a states `init` method which also had a `preload` method it would fail to start the next State.
47+
* StateManager.boot would call start on a State twice if it was added to the game and started before the DOM load had completed. This didn't cause an error but was duplicating function calls needlessly.
48+
* Changing any of the Text properties such as font, lineSpacing and fontSize on a Text object that wasn't already on the display list would cause an updateTransform error. Parent is now checked first in all setters.
49+
* A Timer with a delay value that was a float and not an integer would not loop correctly. Timer delay values are now passed through Math.round to avoid this (thanks @osmanzeki #1196)
50+
* The Loader would incorrectly call `fileComplete` for legacy audio files instead of setting it as a callback, throwing up errors if the audio file failed to load (thanks @spayton #1212)
51+
* The Uint32Array check used in Utils was incorrectly replacing Uint32Array on Safari, causing errors like BitmapData.getPixel32 to fail and other related issues (fixes #1043 and #1197)
52+
* Camera.follow would break if the parent of the Sprite being followed was scaled in any way (thanks @englercj #1222)
53+
* Fixed the 4fv uniform in the Pixelate filter.
54+
55+
## Version 2.1.1 - "Eianrod" - 11th September 2014
56+
57+
Version 2.1.1. of Phaser is an emergency point release. It addresses a potential race condition that could happen in States that tried to change state from the create method but had an empty preloader or pre-cached assets.
58+
359
## Version 2.1.0 - "Cairhien" - 9th September 2014
460

561
### New Features

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering.
2727

28-
Version: 2.1.2 "Whitebridge" - Released: in development
28+
Version: 2.1.2 "Whitebridge" - Released: 9th October 2014
2929

3030
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
3131

@@ -45,6 +45,22 @@ By Richard Davey, [Photon Storm](http://www.photonstorm.com)
4545
<a name="whats-new"></a>
4646
## Welcome to Phaser and What's new in 2.1.2?
4747

48+
Phaser 2.1.2 carries on with our latest round of new features, updates and fixes, demonstrating our commitment to continuously improving our framework and responding to feedback.
49+
50+
This release adds in a number of new features including Audio Sprite json format support, native loading of XML files, Sound fades, per character Text colours, further updates to BitmapData, the ability to use BitmapData with frames as Sprite textures, Group filter, search the Cache by URL and plenty of updates and bug fixes too - including the death of the pesky getPixel issue on Safari / iOS.
51+
52+
Internally we are using Phaser in ever larger client based projects. Thousands of lines of code spread across many States and classes, and we're paying close attention to how best to adapt the API to make life easier for those building apps of the size we are. If there are any features you would like to see then now is the time to suggest them, either by email, the forum or github.
53+
54+
We're also pleased to announce that we have 3 new premium plugins gearing up for launch. They are:
55+
56+
Phaser Box2D - Adds complete Box2D support directly into Phaser, with lots of help methods, over 50 examples and 5 demo games.
57+
58+
Phaser Path Manager - Create complex motion paths for Sprites with a lovely visual editor and this new plugin. No longer rely on tweens for motion :) Instead draw a path, with full branch support, path orientation, segment speeds, path events and more.
59+
60+
Advanced Particle System - The particles included with Phaser are flexible and can create attractive effects. But Advanced Particles is a complete replacement offering professional level particle effects for your games. From multiple render targets, to bitmap caching to all kinds of events, emitters and properties.
61+
62+
Each plugin will come in a range of versions to suit all budgets and there are more on the way. Please visit the [launch page](http://phaserplugins.launchrock.com) to sign-up for notification as soon as they're ready.
63+
4864
Until then happy coding everyone! And we hope to see you on the forums.
4965

5066
![boogie](http://www.phaser.io/images/spacedancer.gif)
@@ -69,9 +85,7 @@ Finally the list of [community authored Phaser Tutorials](http://www.lessmilk.co
6985
<a name="change-log"></a>
7086
## Change Log
7187

72-
Version 2.1.2 - "Whitebridge" - in development
73-
74-
88+
Version 2.1.2 - "Whitebridge" - October 9th 2014
7589

7690
### New Features
7791

@@ -123,7 +137,6 @@ Version 2.1.2 - "Whitebridge" - in development
123137
* Camera.follow would break if the parent of the Sprite being followed was scaled in any way (thanks @englercj #1222)
124138
* Fixed the 4fv uniform in the Pixelate filter.
125139

126-
127140
For details about changes made in previous versions of Phaser see the full Change Log at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
128141

129142
![div](http://phaser.io/images/div3.png)

docs/AABB.js.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<a href="Phaser.ArrayList.html">ArrayList</a>
5959
</li>
6060

61+
<li class="class-depth-1">
62+
<a href="Phaser.AudioSprite.html">AudioSprite</a>
63+
</li>
64+
6165
<li class="class-depth-1">
6266
<a href="Phaser.BitmapData.html">BitmapData</a>
6367
</li>
@@ -258,6 +262,10 @@
258262
<a href="Phaser.Particles.html">Particles</a>
259263
</li>
260264

265+
<li class="class-depth-2">
266+
<a href="Phaser.Particles.Arcade.html">Arcade</a>
267+
</li>
268+
261269
<li class="class-depth-3">
262270
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
263271
</li>
@@ -518,7 +526,6 @@
518526
</ul>
519527
</li>
520528

521-
522529
</ul>
523530
</div>
524531
</div>
@@ -548,7 +555,6 @@ <h1 class="page-title">Source: physics/ninja/AABB.js</h1>
548555
* Note: This class could be massively optimised and reduced in size. I leave that challenge up to you.
549556
*
550557
* @class Phaser.Physics.Ninja.AABB
551-
* @classdesc Arcade Physics Constructor
552558
* @constructor
553559
* @param {Phaser.Physics.Ninja.Body} body - The body that owns this shape.
554560
* @param {number} x - The x coordinate to create this shape at.
@@ -1590,7 +1596,7 @@ <h1 class="page-title">Source: physics/ninja/AABB.js</h1>
15901596

15911597
<span class="jsdoc-message">
15921598
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
1593-
on Tue Sep 09 2014 15:29:17 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
1599+
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
15941600
</span>
15951601
</footer>
15961602
</div>

docs/Animation.js.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<a href="Phaser.ArrayList.html">ArrayList</a>
5959
</li>
6060

61+
<li class="class-depth-1">
62+
<a href="Phaser.AudioSprite.html">AudioSprite</a>
63+
</li>
64+
6165
<li class="class-depth-1">
6266
<a href="Phaser.BitmapData.html">BitmapData</a>
6367
</li>
@@ -258,6 +262,10 @@
258262
<a href="Phaser.Particles.html">Particles</a>
259263
</li>
260264

265+
<li class="class-depth-2">
266+
<a href="Phaser.Particles.Arcade.html">Arcade</a>
267+
</li>
268+
261269
<li class="class-depth-3">
262270
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
263271
</li>
@@ -552,7 +560,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
552560
* @param {Phaser.Sprite} parent - A reference to the owner of this Animation.
553561
* @param {string} name - The unique name for this animation, used in playback commands.
554562
* @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
555-
* @param {(Array.&lt;number>|Array.&lt;string>)} frames - An array of numbers or strings indicating which frames to play in which order.
563+
* @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order.
556564
* @param {number} delay - The time between each frame of the animation, given in ms.
557565
* @param {boolean} loop - Should this animation loop when it reaches the end or play through once.
558566
*/
@@ -1270,6 +1278,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
12701278
* You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
12711279
*
12721280
* @method Phaser.Animation.generateFrameNames
1281+
* @static
12731282
* @param {string} prefix - The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'.
12741283
* @param {number} start - The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the start is 1.
12751284
* @param {number} stop - The number to count to. If your frames are named 'explosion_0001' to 'explosion_0034' the stop value is 34.
@@ -1347,7 +1356,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
13471356

13481357
<span class="jsdoc-message">
13491358
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
1350-
on Tue Sep 09 2014 15:29:17 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
1359+
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
13511360
</span>
13521361
</footer>
13531362
</div>

docs/AnimationManager.js.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<a href="Phaser.ArrayList.html">ArrayList</a>
5959
</li>
6060

61+
<li class="class-depth-1">
62+
<a href="Phaser.AudioSprite.html">AudioSprite</a>
63+
</li>
64+
6165
<li class="class-depth-1">
6266
<a href="Phaser.BitmapData.html">BitmapData</a>
6367
</li>
@@ -258,6 +262,10 @@
258262
<a href="Phaser.Particles.html">Particles</a>
259263
</li>
260264

265+
<li class="class-depth-2">
266+
<a href="Phaser.Particles.Arcade.html">Arcade</a>
267+
</li>
268+
261269
<li class="class-depth-3">
262270
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
263271
</li>
@@ -621,6 +629,11 @@ <h1 class="page-title">Source: animation/AnimationManager.js</h1>
621629
*/
622630
loadFrameData: function (frameData, frame) {
623631

632+
if (typeof frameData === 'undefined')
633+
{
634+
return false;
635+
}
636+
624637
if (this.isLoaded)
625638
{
626639
// We need to update the frameData that the animations are using
@@ -1035,6 +1048,23 @@ <h1 class="page-title">Source: animation/AnimationManager.js</h1>
10351048

10361049
});
10371050

1051+
/**
1052+
* @name Phaser.AnimationManager#name
1053+
* @property {string} name - Gets the current animation name, if set.
1054+
*/
1055+
Object.defineProperty(Phaser.AnimationManager.prototype, 'name', {
1056+
1057+
get: function () {
1058+
1059+
if (this.currentAnim)
1060+
{
1061+
return this.currentAnim.name;
1062+
}
1063+
1064+
}
1065+
1066+
});
1067+
10381068
/**
10391069
* @name Phaser.AnimationManager#frame
10401070
* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.
@@ -1136,7 +1166,7 @@ <h1 class="page-title">Source: animation/AnimationManager.js</h1>
11361166

11371167
<span class="jsdoc-message">
11381168
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
1139-
on Tue Sep 09 2014 15:29:17 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
1169+
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
11401170
</span>
11411171
</footer>
11421172
</div>

docs/AnimationParser.js.html

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<a href="Phaser.ArrayList.html">ArrayList</a>
5959
</li>
6060

61+
<li class="class-depth-1">
62+
<a href="Phaser.AudioSprite.html">AudioSprite</a>
63+
</li>
64+
6165
<li class="class-depth-1">
6266
<a href="Phaser.BitmapData.html">BitmapData</a>
6367
</li>
@@ -258,6 +262,10 @@
258262
<a href="Phaser.Particles.html">Particles</a>
259263
</li>
260264

265+
<li class="class-depth-2">
266+
<a href="Phaser.Particles.Arcade.html">Arcade</a>
267+
</li>
268+
261269
<li class="class-depth-3">
262270
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
263271
</li>
@@ -806,22 +814,22 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
806814
uuid = game.rnd.uuid();
807815

808816
frame = frames[i].attributes;
809-
810-
name = frame.name.nodeValue;
811-
x = parseInt(frame.x.nodeValue, 10);
812-
y = parseInt(frame.y.nodeValue, 10);
813-
width = parseInt(frame.width.nodeValue, 10);
814-
height = parseInt(frame.height.nodeValue, 10);
817+
818+
name = frame.name.value;
819+
x = parseInt(frame.x.value, 10);
820+
y = parseInt(frame.y.value, 10);
821+
width = parseInt(frame.width.value, 10);
822+
height = parseInt(frame.height.value, 10);
815823

816824
frameX = null;
817825
frameY = null;
818826

819827
if (frame.frameX)
820828
{
821-
frameX = Math.abs(parseInt(frame.frameX.nodeValue, 10));
822-
frameY = Math.abs(parseInt(frame.frameY.nodeValue, 10));
823-
frameWidth = parseInt(frame.frameWidth.nodeValue, 10);
824-
frameHeight = parseInt(frame.frameHeight.nodeValue, 10);
829+
frameX = Math.abs(parseInt(frame.frameX.value, 10));
830+
frameY = Math.abs(parseInt(frame.frameY.value, 10));
831+
frameWidth = parseInt(frame.frameWidth.value, 10);
832+
frameHeight = parseInt(frame.frameHeight.value, 10);
825833
}
826834

827835
newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
@@ -865,7 +873,7 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
865873

866874
<span class="jsdoc-message">
867875
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
868-
on Tue Sep 09 2014 15:29:17 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
876+
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
869877
</span>
870878
</footer>
871879
</div>

0 commit comments

Comments
 (0)