Skip to content

Commit d53cf52

Browse files
Merge branch 'dev' of https://github.com/photonstorm/phaser into dev
2 parents c2c3306 + 214e8ab commit d53cf52

56 files changed

Lines changed: 11217 additions & 1621 deletions

Some content is hidden

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

Gruntfile.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ module.exports = function (grunt) {
6262
'p2': { 'description': 'P2 Physics', 'optional': true, 'stub': false },
6363
'tilemaps': { 'description': 'Tilemap Support', 'optional': true, 'stub': false },
6464
'particles': { 'description': 'Arcade Physics Particle System', 'optional': true, 'stub': true },
65+
'creature': { 'description': 'Creature Animation Tool Support', 'optional': true, 'stub': false },
6566
'outro': { 'description': 'Phaser UMD closure', 'optional': true, 'stub': false }
6667

6768
};
@@ -207,7 +208,7 @@ module.exports = function (grunt) {
207208

208209
grunt.registerTask('build', 'Compile all Phaser versions just to the dist folder', function() {
209210

210-
grunt.option('exclude', 'ninja');
211+
grunt.option('exclude', 'ninja,creature');
211212
grunt.option('filename', 'phaser');
212213
grunt.option('sourcemap', true);
213214
grunt.option('copy', false);
@@ -218,7 +219,7 @@ module.exports = function (grunt) {
218219

219220
grunt.registerTask('full', 'Phaser complete', function() {
220221

221-
grunt.option('exclude', 'ninja');
222+
grunt.option('exclude', 'ninja,creature');
222223
grunt.option('filename', 'phaser');
223224
grunt.option('sourcemap', true);
224225
grunt.option('copy', true);
@@ -229,7 +230,7 @@ module.exports = function (grunt) {
229230

230231
grunt.registerTask('arcadephysics', 'Phaser with Arcade Physics, Tilemaps and Particles', function() {
231232

232-
grunt.option('exclude', 'ninja,p2');
233+
grunt.option('exclude', 'ninja,p2,creature');
233234
grunt.option('filename', 'phaser-arcade-physics');
234235
grunt.option('sourcemap', true);
235236
grunt.option('copy', false);
@@ -241,7 +242,7 @@ module.exports = function (grunt) {
241242

242243
grunt.registerTask('nophysics', 'Phaser without physics, tilemaps or particles', function() {
243244

244-
grunt.option('exclude', 'arcade,ninja,p2,tilemaps,particles');
245+
grunt.option('exclude', 'arcade,ninja,p2,tilemaps,particles,creature');
245246
grunt.option('filename', 'phaser-no-physics');
246247
grunt.option('sourcemap', true);
247248
grunt.option('copy', false);
@@ -253,7 +254,7 @@ module.exports = function (grunt) {
253254

254255
grunt.registerTask('minimum', 'Phaser without any optional modules except Pixi', function() {
255256

256-
grunt.option('exclude', 'gamepad,keyboard,bitmapdata,graphics,rendertexture,text,bitmaptext,retrofont,net,tweens,sound,debug,arcade,ninja,p2,tilemaps,particles');
257+
grunt.option('exclude', 'gamepad,keyboard,bitmapdata,graphics,rendertexture,text,bitmaptext,retrofont,net,tweens,sound,debug,arcade,ninja,p2,tilemaps,particles,creature');
257258
grunt.option('filename', 'phaser-minimum');
258259
grunt.option('sourcemap', true);
259260
grunt.option('copy', false);

README.md

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Thousands of developers worldwide use it. From indies and multi-national digital
3535
![div](http://www.phaser.io/images/github/div.png)
3636

3737
<a name="whats-new"></a>
38-
## What's new in Phaser 2.3.0
38+
## What's new in Phaser 2.4.0
3939

4040
<div align="center"><img src="http://phaser.io/images/github/news.jpg"></div>
4141

@@ -242,22 +242,79 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
242242
<a name="change-log"></a>
243243
## Change Log
244244

245-
Version 2.3.1 - "Katar" - in dev
245+
Version 2.4 - "Katar" - in dev
246+
247+
### API Changes
248+
249+
* RenderTexture.render now takes a Matrix as its second parameter, not a Point object. This brings it in line with Pixi and allows you to perform much more complex transformations on the object being rendered. If you need to replicate the old behavior please use RenderTexture.renderXY(sprite, point.x, point.y) instead.
250+
* PIXI.DisplayObject.updateTransform has a new optional parameter `parent`. If the DisplayObject doesn't have a parent (i.e. it isn't on the display list yet) then in the past `updateTransform` would fail. This meant you couldn't do things like scale or rotate a Sprite and then draw it to a RenderTexture or BitmapData, as calls to updateTransform would be ignored. The new checks now look to see if the `parent` parameter is set. If so this takes priority over the actual parent and is used to modify the transform (note that it **doesn't** reparent the DisplayObject, it merely uses it for the transform.) If there is no parent (explicitly or via the parameter) then it falls back to use Phaser.World as the parent. If it can't reach that then no transform takes place.
251+
* If Phaser.Sound.noAudio has been set then Phaser.Loader will not load any audio files. No errors are thrown, but all calls to Loader.audio and Loader.audiosprite are silently ignored. `noAudio` can be set either via the `PhaserGlobal` global var or is set if the device your game is running on has no audio playback support.
252+
* Files can now be added to the Loader with an absolute URL even if you have a Loader.baseURL set. In previous versions the baseURL would still be prepended to the file URL, but the Loader now checks if the a file URL begins with `http` or `//` and skips prepending the baseURL to it.
253+
* Phaser.StateManager would incorrectly call `loadUpdate` and `loadRender` while the game was paused or if the State didn't have an `update` or `render` method defined, even after the loader was completed. Although this is a bug fix it's still an API change should you have been using the `loadUpdate/Render` calls in the old way. Also the StateManager no longer calls `preRender` unless the State `create` method has *finished*. If the State doesn't have a `create` method then `preRender` runs immediately.
254+
* Frame.uuid has been removed (was flagged as deprecated for several releases). This has a two-fold effect: First it means that the property no longer exists and secondly it means that the AnimationParser (the class responsible for loading sprite sheets and texture atlases) no longer has to call either RandomDataGenerator.uuid OR populates the PIXI.TextureCache. The first saves some CPU time and the second saves memory by not creating references to textures it doesn't ever use. The PIXI.TextureCache is now ignored by Phaser other than for the `__missing` and `__default` textures.
255+
* Phaser.AnimationParser methods `JSONData`, `JSONDataHash` and `XMLData` have all had their `cacheKey` parameter removed as it's no longer used.
246256

247257
### New Features
248258

259+
* All calls to Loader methods that add files to the queue, such as `Loader.image` or `Loader.atlas`, now have the URL as an optional parameter. If not set Loader will assume the URL to be based on the key given. For example the following: `game.load.image("boom", "boom.png")` can now be expressed as just `game.load.image("boom")`, or `game.load.atlas("player", "player.png", "player.json")` can now be shortened to `game.load.atlas("player")`. Please see the freshly updated jsdocs for full details.
260+
* Loader.atlas and `Cache.addTextureAtlas` will now automatically determine the format of the JSON data (array or hash) when added to the Cache. You no longer need to specify it explicitly if JSON, only if XML.
261+
* Added support for the [Creature Automated Animation Tool](http://www.kestrelmoon.com/creature/). You can now create a Phaser.Creature object which uses json data and a texture atlas for the animations. Creature is a powerful animation tool, similar to Spriter or Spine. It is currently limited to WebGL games only, but the new libs should prove a solid starting point for anyone wanting to incorporate Creature animations into their games.
262+
* Tilemap.getTileWorldXY has a new optional parameter: `nonNull` which if set makes it behave in the same way as `getTile` does (thanks @GGAlanSmithee #1722)
263+
* Group.hash is an array (previously available as `Group._hash`, but protected) into which you can add any of its children via `Group.addToHash` and `Group.removeFromHash`. Only children of the Group can be added to and removed from the hash. The hash is used automatically by Arcade Physics in order to perform non z-index based destructive sorting. However if you don't use Arcade Physics, or it isn't a physics enabled Group, then you can use the hash to perform your own sorting and filtering of Group children without touching their z-index (and therefore display draw order).
264+
* Group.physicsSortDirection is a new property allowing you to set a custom sort direction for Arcade Physics Sprites within the Group hash. Previously Arcade Physics used one single sort direction (defined on `Phaser.Physics.Arcade.sortDirection`) but this change allows you to specifically control how each and every Group is sorted, so you can now combine tall and wide Groups with narrow and thin in a single system.
265+
* Cache.getPixiTexture will return a PIXI.Texture from the cache based on the given key. A PIXI Texture is created automatically for all images loaded and added to the cache.
266+
* Cache.getPixiBaseTexture will return a PIXI.BaseTexture from the cache based on the given key. A PIXI BaseTexture is created automatically for all images loaded and added to the cache.
267+
* Phaser.Matrix.clone allows you to clone the Matrix to a new object, or copy its values into the given Matrix.
268+
* Phaser.Matrix.copyFrom and copyTo allow you to copy Matrix values from and to other Matrix objects.
269+
* Phaser.Matrix.setTo allows you to set all properties of a Matrix in a single call.
270+
* The Phaser.Matrix constructor now allows you to optionally set all Matrix properties on instantiation.
271+
249272
### Updates
250273

251-
* TypeScript definitions fixes and updates (thanks @clark-stevenson @isuda)
274+
* TypeScript definitions fixes and updates (thanks @clark-stevenson @isuda @ggarek)
275+
* JSDoc typo fixes (thanks @robertpenner)
252276
* Added missing `resumed` method to Phaser.State class template.
277+
* Color.webToColor and Color.updateColor now updates the `out.color` and `out.color32` properties (thanks @cuixiping #1728)
278+
* Tilemap.createFromObjects has been updated for Tiled 0.11 and can now look-up object layers based on id, uid or name. It will also now copy over Sprite scaling properties if set (thanks @mandarinx #1738)
279+
* Graphics.drawPolygon can now accept a Phaser.Polygon or PIXI.Polygon object, as well as a points array (#1712)
280+
* Phaser.Physics hooks added in for MatterJS support (coming soon)
281+
* Body.destroy now automatically calls `Group.removeFromHash`.
282+
* Physics.Arcade.sort has a new property 'sortDirection'. If not specified it will use World.sortDirection. If the Group given as the first parameter has its `physicsSortDirection` property set that will override any other setting.
283+
* Physics.Arcade.sort now calls one of four functions: sortLeftRight, sortRightLeft, sortTopBottom and sortBottomTop. Each of which takes 2 Sprites as arguments.
284+
* Physics.Arcade.sort now doesn't bail out if the Group contains a mixture of physics and non-physics enabled objects, as the Group hash is now only ever populated with physics enabled objects. Also the sort comparison functions no longer return -1 if the bodies are invalid, but zero instead (#1721)
285+
* Phaser.Group would automatically add a child into the _hash array as soon as the child was created (or moved into the Group). This no longer happens. Instead the child is only added to `Group.hash` if it is enabled for Arcade Physics. However `Group.addToHash` and the hash array have been exposed as public in case you were taking advantage of the _hash even though it was a previously marked as private.
286+
* Cache.getTexture has now been removed (it was deprecated several versions ago). Use Cache.getRenderTexture instead.
287+
* Removed duplicate methods from PIXI.Text such as wordWrap and updateText as Phaser overrides them, so it was wasting bytes.
288+
* Phaser.StateManager no longer calls `preRender` unless the State `create` method has finished. If the State doesn't have a `create` method then `preRender` runs immediately.
289+
* Phaser.StateManager.created is a new read-only boolean that tells you if the State has finished running its `create` method. If it doesn't have one it's always true.
290+
* RenderTexture.render and `renderXY` would ignore the Sprites rotation or scale. The full Sprite transform is now used correctly when the Sprite is drawn to the texture. If you wish to replicate the old behavior please use `RenderTexture.renderRawXY` instead.
291+
* Pixi.Sprite.renderCanvas and renderWebGL now has a new optional matrix parameter. You can use this to render the Sprite with an alternative transform matrix without actually adjusting the Sprite matrix at all.
292+
* RenderTexture.matrix has been removed as it's no longer used.
293+
* SoundManager.pauseAll, resumeAll and stopAll now checks if the SoundManager.noAudio is set and ignores the calls.
294+
* SoundManager.usingWebAudio is set to `false` by default (used to be `true`) and is only explicitly set if Web Audio is available and hasn't been disabled in the PhaserGlobal object.
295+
* SoundManager.touchLocked is now set to `false` should the device be using legacy Audio, avoiding the unlock call running without need.
253296

254297
### Bug Fixes
255298

256-
* The LoadTexture component has had a redundant `dirty` call removed from it.
299+
* The LoadTexture component has had a redundant `dirty` call removed from it that was causing textures to be re-uploaded to the GPU even though they may already have been on it.
257300
* TileSprites were missing a `physicsType` property, causing them to not collide with anything (thanks @numbofathma #1702)
258301
* Sprite was missing the Health and InCamera components.
259302
* A Tween could be incorrectly set to never end if it was given a duration of zero (thanks @hardalias #1710)
260303
* Added guards around `context.getImageData` calls in BitmapData, Text and Canvas Tinting classes to avoid crashing restricted browsers like Epic Browser. Please understand that several Phaser features won't work correctly with this browser (thanks @Erik3000 #1714)
304+
* P2 Body.destroy now checks for the existence of a `sprite` property on the body before nulling it (thanks @englercj #1736)
305+
* The version of p2.js being used in 2.3.0 wasn't correctly declaring itself as a global for browserify / requireJS. This update resolves that (thanks @dgoemans #1723)
306+
* AnimationManager.frameName setter wasn't checking if `_frameData` existed before accessing it (thanks @nesukun #1727)
307+
* P2.getConstraints would return an array of null objects. It now returns the raw p2 constraint objects (thanks @valueerrorx #1726)
308+
* TilemapLayer docs incorrectly reported it as extending Phaser.Image, but it doesn't share the same components so has been updated.
309+
* TilemapLayer was missing the Input component (thanks @uhe1231 #1700)
310+
* PIXI.Graphics in Canvas mode wouldn't respect the objects visible or alpha zero properties, rendering it regardless (thanks @TimvdEijnden #1720)
311+
* Enabling Arcade Physics would add the deltaCap property onto Phaser.Time, even though the property doesn't exist any more, changing the class shape in the process.
312+
* Phaser.StateManager would incorrectly call `loadUpdate` while the game was paused or if the State didn't have an `update` method defined even after the loader was completed.
313+
* Phaser.StateManager would incorrectly call `loadRender` while the game was paused or if the State didn't have an `render` method defined even after the loader was completed.
314+
* Added the missing `preRender` function to the Phaser.State class template.
315+
* Fixed bug in Pixi where RenderTexture.render would ignore the given matrix.
316+
* Fixed a bug in Pixi where drawing a Sprite to a RenderTexture would reset the Sprites transform to an identity Matrix.
317+
* The SoundManager didn't accurately detect devices or browser environments with no sound card present and would try to carry on using a null Web Audio context (thanks @englercj #1746)
261318

262319
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
263320

@@ -292,6 +349,8 @@ The Phaser logo and characters are &copy; 2015 Photon Storm Limited.
292349

293350
All rights reserved.
294351

352+
"The art challenges the technology, and the technology inspires the art." - John Lasseter
353+
295354
[![Analytics](https://ga-beacon.appspot.com/UA-44006568-2/phaser/index)](https://github.com/igrigorik/ga-beacon)
296355

297356
[get-js]: https://github.com/photonstorm/phaser/releases/download/v2.3.0/phaser.js
@@ -310,7 +369,7 @@ All rights reserved.
310369
[forum]: http://www.html5gamedevs.com/forum/14-phaser/
311370

312371
[game1]: https://www.prodigygame.com/Fun-Math-Games/
313-
[game2]: http://www.bbc.co.uk/cbbc/games/deadly-defenders
372+
[game2]: http://www.bbc.co.uk/cbbc/games/deadly-defenders-game
314373
[game3]: http://www.defiantfew.com/
315374
[game4]: http://www.pawpatrol.com/fun.php
316375
[game5]: http://www.fyretale.com/

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phaser",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"homepage": "http://phaser.io",
55
"authors": [
66
"photonstorm <rich@photonstorm.com>"

build/config.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
'arcade' => true,
2121
'p2' => true,
2222
'ninja' => false,
23-
'box2d' => false
23+
'box2d' => false,
24+
'creature' => false,
2425
);
2526
}
2627

@@ -29,6 +30,11 @@
2930
echo " <script src=\"$path/src/physics/p2/p2.js\"></script>";
3031
}
3132

33+
if ($modules['creature'])
34+
{
35+
echo " <script src=\"$path/src/animation/creature/gl-matrix.js\"></script>";
36+
}
37+
3238
if ($modules['box2d'] && isset($box2dpath))
3339
{
3440
echo " <script src=\"$box2dpath/box2d-html5.js\"></script>";
@@ -45,6 +51,7 @@
4551
<script src="$path/src/pixi/text/BitmapText.js"></script>
4652
<script src="$path/src/pixi/display/Stage.js"></script>
4753
54+
<script src="$path/src/pixi/utils/EventTarget.js"></script>
4855
<script src="$path/src/pixi/utils/Utils.js"></script>
4956
<script src="$path/src/pixi/utils/Polyk.js"></script>
5057
@@ -80,6 +87,7 @@
8087
<script src="$path/src/pixi/textures/BaseTexture.js"></script>
8188
<script src="$path/src/pixi/textures/Texture.js"></script>
8289
<script src="$path/src/pixi/textures/RenderTexture.js"></script>
90+
<script src="$path/src/pixi/textures/VideoTexture.js"></script>
8391
8492
<script src="$path/src/pixi/filters/AbstractFilter.js"></script>
8593
@@ -288,6 +296,17 @@
288296
289297
EOL;
290298

299+
if ($modules['creature'])
300+
{
301+
echo <<<EOL
302+
<script src="$path/src/animation/creature/CreatureMeshBone.js"></script>
303+
<script src="$path/src/animation/creature/CreaturePixiJSRenderer.js"></script>
304+
<script src="$path/src/gameobjects/Creature.js"></script>
305+
306+
307+
EOL;
308+
}
309+
291310
if ($modules['sound'])
292311
{
293312
echo <<<EOL

filters/pixi/AlphaMaskFilter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ PIXI.AlphaMaskFilter = function(texture)
2828

2929
if (texture.baseTexture.hasLoaded)
3030
{
31-
this.uniforms.mask.value.x = texture.width;
32-
this.uniforms.mask.value.y = texture.height;
31+
this.uniforms.mapDimensions.value.x = texture.width;
32+
this.uniforms.mapDimensions.value.y = texture.height;
3333
}
3434
else
3535
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phaser",
3-
"version": "2.3.1",
3+
"version": "2.4.0",
44
"release": "Katar",
55
"description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.",
66
"author": "Richard Davey <rdavey@gmail.com> (http://www.photonstorm.com)",

src/Phaser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
var Phaser = Phaser || {
1212

13-
VERSION: '2.3.1-dev',
13+
VERSION: '2.4.0-dev',
1414
GAMES: [],
1515

1616
AUTO: 0,
@@ -51,6 +51,7 @@ var Phaser = Phaser || {
5151
MATRIX: 24,
5252
POINT: 25,
5353
ROUNDEDRECTANGLE: 26,
54+
CREATURE: 27,
5455

5556
/**
5657
* Various blend modes supported by pixi. IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.

0 commit comments

Comments
 (0)