diff --git a/CHANGELOG.md b/CHANGELOG.md index c0c817f07c..f73cdca566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Change Log +## Version 2.4.1 - "Ionin Spring" - 24th July 2015 + +This is a small point release that updates the Creature runtimes and fixes a couple of small cache issues. + +It also modifies the Grunt build scripts so that all third party libs (such as Creature, P2, gl-matrix and PIXI) are now kept well and truly outside of Phaser. They are defined and placed first in the build files. So no more PIXI hiding within the Phaser namespace or UMD patching for Phaser required. + +### Updates + +* The Creature Runtimes have been updated to the latest versions and the `Phaser.Creature` class updated to use them. +* GameObjectFactory.creature is a new method to help with quick Creature animation object creation. +* Cache.getPixiTexture will now search the image cache if it couldn't find a texture in the PIXI.TextureCache global array, if it finds a matching image in the image cache then it returns a new PIXI.Texture based on it. +* Cache.getPixiBaseTexture will now search the image cache if it couldn't find a BaseTexture in the PIXI.BaseTextureCache global array. + +### Bug Fixes + +* Fixed Cache.getKeys to use the `_cacheMap` (thanks @jamesgroat #1929) +* Safari on OSX wouldn't recognise button presses on trackpads (thanks JakeCake) +* Cache.removeImage now calls destroy on the image BaseTexture, removing it from the PIXI global caches without throwing a warning. + ## Version 2.4 - "Katar" - 22nd July 2015 ### API Changes diff --git a/Gruntfile.js b/Gruntfile.js index 2e126bccf5..31ac16b2e8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -30,7 +30,6 @@ module.exports = function (grunt) { var modules = { - 'pixi': { 'description': 'Pixi.js (custom Phaser build)', 'optional': false, 'stub': false }, 'intro': { 'description': 'Phaser UMD wrapper', 'optional': true, 'stub': false }, 'phaser': { 'description': 'Phaser Globals', 'optional': false, 'stub': false }, 'geom': { 'description': 'Geometry Classes', 'optional': false, 'stub': false }, @@ -112,76 +111,151 @@ module.exports = function (grunt) { grunt.log.writeln("Excluding modules:\n"); - var excludes = grunt.option('exclude').split(','); + var excludedKeys = []; - // Check the given modules are all valid - for (var i = 0; i < excludes.length; i++) + // Nothing is excluded! + var excludes = false; + + if (grunt.option('exclude') !== 'null') { - var exclude = excludes[i]; + excludes = grunt.option('exclude').split(','); + + // Check the given modules are all valid + for (var i = 0; i < excludes.length; i++) + { + var exclude = excludes[i]; + + if (modules[exclude]) + { + grunt.log.writeln("* " + exclude + ' - ' + modules[exclude].description); + excludedKeys[exclude] = true; + } + else + { + grunt.fail.fatal("Unknown module '" + exclude + "'"); + } + } + + // Handle basic dependencies - if (modules[exclude]) + if (excludedKeys['arcade'] && !excludedKeys['particles']) { - grunt.log.writeln("* " + exclude + ' - ' + modules[exclude].description); + grunt.log.writeln("Warning: Particles rely on Arcade Physics which has been excluded. Removing Particles from build."); + excludes.push('particles'); } - else + + if (excludedKeys['rendertexture'] && !excludedKeys['retrofont']) { - grunt.fail.fatal("Unknown module '" + exclude + "'"); + grunt.log.writeln("Warning: RetroFonts rely on RenderTextures. Excluding from build."); + excludes.push('retrofont'); } } - // Handle basic dependencies + // Ok we know the excludes array is fine, let's get this show started + + grunt.log.writeln("\nPackaging Globals ...\n"); + + var filelist = []; + + // Clean the working folder + var tasks = [ 'clean:build' ]; + + // Prepare the globals first, the libs that live outside of Phaser + + // 1) Creature + + if (!excludedKeys['creature']) + { + grunt.log.writeln("-> Creature"); + tasks.push('concat:creatureGlobal'); + filelist.push('<%= modules_dir %>/creature-global.js'); + } + + // 2) P2 - if (excludes['arcade'] && !excludes['particles']) + if (!excludedKeys['p2']) { - grunt.log.writeln("Warning: Particles rely on Arcade Physics. Excluding from build."); - excludes.push('particles'); + grunt.log.writeln("-> P2.js"); + tasks.push('concat:p2Global'); + filelist.push('<%= modules_dir %>/p2-global.js'); } - if (excludes['rendertexture'] && !excludes['retrofont']) + // 3) PIXI + + grunt.log.writeln("-> PIXI"); + tasks.push('concat:pixiIntro'); + filelist.push('<%= modules_dir %>/pixi-intro.js'); + + // Optional Rope + if (!excludedKeys['rope']) { - grunt.log.writeln("Warning: RetroFonts rely on RenderTextures. Excluding from build."); - excludes.push('retrofont'); + grunt.log.writeln("-> PIXI.Rope"); + tasks.push('concat:pixiRope'); + filelist.push('<%= modules_dir %>/pixi-rope.js'); } - // Ok we know the excludes array is fine, let's get this show started + // Optional Tilesprite + if (!excludedKeys['tilesprite']) + { + grunt.log.writeln("-> PIXI.TileSprite"); + tasks.push('concat:pixiTileSprite'); + filelist.push('<%= modules_dir %>/pixi-tilesprite.js'); + } - grunt.log.writeln("\nBuilding ...\n"); + // PIXI Outro + tasks.push('concat:pixiOutro'); + filelist.push('<%= modules_dir %>/pixi-outro.js'); - var filelist = []; + // And now for Phaser - // Clean the working folder - var tasks = [ 'clean:build' ]; + grunt.log.writeln("\nBuilding ..."); - for (var key in modules) + if (excludes !== false) { - if (modules[key].stub && excludes.indexOf(key) !== -1) + for (var key in modules) { - // If the module IS excluded and has a stub, we need that - tasks.push('concat:' + key + 'Stub'); + if (modules[key].stub && excludes.indexOf(key) !== -1) + { + // If the module IS excluded and has a stub, we need that + tasks.push('concat:' + key + 'Stub'); - filelist.push('<%= modules_dir %>/' + key + '.js'); - } - else if (modules[key].optional === false || excludes.indexOf(key) === -1) - { - // If it's required or NOT excluded, add it to the tasks list - tasks.push('concat:' + key); + filelist.push('<%= modules_dir %>/' + key + '.js'); + } + else if (modules[key].optional === false || excludes.indexOf(key) === -1) + { + // If it's required or NOT excluded, add it to the tasks list + tasks.push('concat:' + key); - filelist.push('<%= modules_dir %>/' + key + '.js'); + filelist.push('<%= modules_dir %>/' + key + '.js'); - // Special case: If they have Arcade Physics AND Tilemaps we need to include the Tilemap Collision class - if (key === 'arcade' && !excludes['tilemaps']) - { - tasks.push('concat:arcadeTilemaps'); - filelist.push('<%= modules_dir %>/arcadeTilemaps.js'); + // Special case: If they have Arcade Physics AND Tilemaps we need to include the Tilemap Collision class + if (key === 'arcade' && !excludes['tilemaps']) + { + tasks.push('concat:arcadeTilemaps'); + filelist.push('<%= modules_dir %>/arcadeTilemaps.js'); + } } } } + else + { + // The full monty ... + + for (var mkey in modules) + { + tasks.push('concat:' + mkey); + filelist.push('<%= modules_dir %>/' + mkey + '.js'); + } + } grunt.config.set('filelist', filelist); tasks.push('concat:custom'); - tasks.push('uglify:custom'); + if (grunt.option('uglify')) + { + tasks.push('uglify:custom'); + } if (grunt.option('copy')) { @@ -215,17 +289,57 @@ module.exports = function (grunt) { grunt.option('filename', 'phaser'); grunt.option('sourcemap', true); grunt.option('copy', false); + grunt.option('uglify', true); grunt.task.run('custom'); }); - grunt.registerTask('full', 'Phaser complete', function() { + grunt.registerTask('full', 'Phaser (excluding Ninja and Creature)', function() { grunt.option('exclude', 'ninja,creature'); grunt.option('filename', 'phaser'); grunt.option('sourcemap', true); grunt.option('copy', true); + grunt.option('uglify', true); + + grunt.task.run('custom'); + + }); + + grunt.registerTask('complete', 'Phaser Build with all libs', function() { + + grunt.option('exclude', 'null'); + grunt.option('filename', 'phaser-complete'); + grunt.option('sourcemap', false); + grunt.option('copy', true); + grunt.option('copycustom', true); + grunt.option('uglify', true); + + grunt.task.run('custom'); + + }); + + grunt.registerTask('test', 'Phaser Test Build (all libs)', function() { + + grunt.option('exclude', 'ninja,creature'); + grunt.option('filename', 'phaser-test'); + grunt.option('sourcemap', false); + grunt.option('copy', false); + grunt.option('uglify', false); + + grunt.task.run('custom'); + + }); + + grunt.registerTask('creature', 'Phaser + Creature', function() { + + grunt.option('exclude', 'ninja'); + grunt.option('filename', 'phaser-creature'); + grunt.option('sourcemap', true); + grunt.option('copy', true); + grunt.option('copycustom', true); + grunt.option('uglify', true); grunt.task.run('custom'); @@ -238,6 +352,20 @@ module.exports = function (grunt) { grunt.option('sourcemap', true); grunt.option('copy', false); grunt.option('copycustom', true); + grunt.option('uglify', true); + + grunt.task.run('custom'); + + }); + + grunt.registerTask('ninjaphysics', 'Phaser with Ninja Physics and Tilemaps', function() { + + grunt.option('exclude', 'p2,particles,creature'); + grunt.option('filename', 'phaser-ninja-physics'); + grunt.option('sourcemap', true); + grunt.option('copy', false); + grunt.option('copycustom', true); + grunt.option('uglify', true); grunt.task.run('custom'); @@ -250,18 +378,20 @@ module.exports = function (grunt) { grunt.option('sourcemap', true); grunt.option('copy', false); grunt.option('copycustom', true); + grunt.option('uglify', true); grunt.task.run('custom'); }); - grunt.registerTask('minimum', 'Phaser without any optional modules except Pixi', function() { + grunt.registerTask('minimum', 'Phaser without any optional modules', function() { grunt.option('exclude', 'gamepad,keyboard,bitmapdata,graphics,rendertexture,text,bitmaptext,retrofont,net,tweens,sound,debug,arcade,ninja,p2,tilemaps,particles,creature,video,rope,tilesprite'); grunt.option('filename', 'phaser-minimum'); grunt.option('sourcemap', true); grunt.option('copy', false); grunt.option('copycustom', true); + grunt.option('uglify', true); grunt.task.run('custom'); diff --git a/README.md b/README.md index 69b43e3e23..0c8aad5ce2 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,11 @@ Thousands of developers worldwide use it. From indies and multi-national digital ![div](http://www.phaser.io/images/github/div.png) -## What's new in Phaser 2.4.0 +## What's new in Phaser 2.4.1
-> 22nd July 2015 +> 24th July 2015 Phaser 2.4 is another huge update. We had to bump the version number from 2.3 directly to 2.4 because of some API adjustments, all of which are fully detailed in the [Change Log](#change-log). While it's true we could have released it over a few smaller point releases, that just isn't how the cookie crumbled this time. _Be sure to pay attention to the previous deprecated API calls that have been removed in 2.4._ @@ -55,6 +55,8 @@ Make sure you check out the Phaser web site. We are going to be adding in stacks But that's all for now. I hope you enjoy Phaser 2.4. Happy coding everyone! See you on the forums. +Happy coding everyone! See you on the forums. + Cheers, Rich - [@photonstorm](https://twitter.com/photonstorm) @@ -87,15 +89,15 @@ Install via [npm](https://www.npmjs.com) [jsDelivr](http://www.jsdelivr.com/#!phaser) is a "super-fast CDN for developers". Include the following in your html: -`` +`` or the minified version: -`` +`` [cdnjs.com](https://cdnjs.com/libraries/phaser) also offers a free CDN service. They have all versions of Phaser and even the custom builds: -`` +`` ### Phaser Sandbox @@ -175,8 +177,17 @@ Run `grunt` to perform a default build to the `dist` folder. ## Games made with Phaser -Thousands of games have been made in Phaser. From game jam entries to titles for some of the largest entertainment brands in the world. This is just a tiny sample. - +Thousands of games have been made in Phaser. From game jam entries to titles by some of the largest entertainment brands in the world. This is just a tiny sample: + +[![Game](http://phaser.io/images/github/241/bubble-academy.png)][game10] +[![Game](http://phaser.io/images/github/241/woodventure.png)][game11] +[![Game](http://phaser.io/images/github/241/hopsop.png)][game12] +[![Game](http://phaser.io/images/github/241/banana-mania.png)][game13] +[![Game](http://phaser.io/images/github/241/salazar.png)][game14] +[![Game](http://phaser.io/images/github/241/phaser-shmup.png)][game15] +[![Game](http://phaser.io/images/github/241/trappy-trap.png)][game16] +[![Game](http://phaser.io/images/github/241/runaway-ruins.png)][game17] +[![Game](http://phaser.io/images/github/241/ananias.png)][game18] [![Game](http://phaser.io/images/github/shot1a.jpg)][game1] [![Game](http://phaser.io/images/github/shot2a.jpg)][game2] [![Game](http://phaser.io/images/github/shot3a.jpg)][game3] @@ -186,11 +197,6 @@ Thousands of games have been made in Phaser. From game jam entries to titles for [![Game](http://phaser.io/images/github/shot7b.jpg)][game7] [![Game](http://phaser.io/images/github/shot8.jpg)][game8] [![Game](http://phaser.io/images/github/shot9.jpg)][game9] -[![Game](http://phaser.io/images/github/shot10.jpg)][game10] -[![Game](http://phaser.io/images/github/shot11.jpg)][game11] -[![Game](http://phaser.io/images/github/shot12.jpg)][game12] -[![Game](http://phaser.io/images/github/shot13.jpg)][game13] -[![Game](http://phaser.io/images/github/shot14.jpg)][game14] Artwork copyright their respective owners. @@ -236,9 +242,26 @@ If you are an exceptional JavaScript developer and would like to join the Phaser ## Change Log -Version 2.4.0a - "Katar" - 22nd July 2015 +## Version 2.4.1 - "Ionin Spring" - 24th July 2015 + +This is a small point release that updates the Creature runtimes and fixes a couple of small cache issues. + +It also modifies the Grunt build scripts so that all third party libs (such as Creature, P2, gl-matrix and PIXI) are now kept well and truly outside of Phaser. They are defined and placed first in the build files. So no more PIXI hiding within the Phaser namespace or UMD patching for Phaser required. + +### Updates + +* The Creature Runtimes have been updated to the latest versions and the `Phaser.Creature` class updated to use them. +* GameObjectFactory.creature is a new method to help with quick Creature animation object creation. +* Cache.getPixiTexture will now search the image cache if it couldn't find a texture in the PIXI.TextureCache global array, if it finds a matching image in the image cache then it returns a new PIXI.Texture based on it. +* Cache.getPixiBaseTexture will now search the image cache if it couldn't find a BaseTexture in the PIXI.BaseTextureCache global array. + +### Bug Fixes + +* Fixed Cache.getKeys to use the `_cacheMap` (thanks @jamesgroat #1929) +* Safari on OSX wouldn't recognise button presses on trackpads (thanks JakeCake) +* Cache.removeImage now calls destroy on the image BaseTexture, removing it from the PIXI global caches without throwing a warning. -Note: Revision `a` of Phaser 2.4.0 includes a fix to the build files that stopped some PIXI classes being undefined (such as TilingSprite). Nothing in the framework itself changed. +## Version 2.4.0 - "Katar" - 22nd July 2015 ### API Changes @@ -605,8 +628,12 @@ All rights reserved. [game7]: http://www.html5gamedevs.com/topic/11179-phaser-cocoonjs-tap-tap-submarine/ [game8]: http://www.gamepix.com/project/footchinko/ [game9]: http://orcattack.thehobbit.com -[game10]: http://runsheldon.com/ -[game11]: http://www.tempalabs.com/works/moon-rocket/ -[game12]: http://www.tempalabs.com/works/master-of-arms-sword-staff-spear/ -[game13]: http://m.silvergames.com/en/pocahontas-slots -[game14]: http://www.tempalabs.com/works/gattai/ +[game10]: http://phaser.io/news/2015/06/bubble-academy +[game11]: http://phaser.io/news/2015/07/woodventure +[game12]: http://phaser.io/news/2015/04/hopsop-journey-to-the-top +[game13]: http://phaser.io/news/2015/05/banana-mania +[game14]: http://phaser.io/news/2015/06/salazar-the-alchemist +[game15]: http://phaser.io/news/2015/05/phaser-shmup +[game16]: http://phaser.io/news/2015/05/trappy-trap +[game17]: http://phaser.io/news/2015/04/runaway-ruins +[game18]: http://phaser.io/news/2015/04/ananias diff --git a/build/config.php b/build/config.php index 75ec61216c..54a384e080 100644 --- a/build/config.php +++ b/build/config.php @@ -23,17 +23,20 @@ 'box2d' => false, 'creature' => false, 'video' => true, + 'rope' => true, + 'tilesprite' => true ); } - if ($modules['p2']) + if ($modules['creature']) { - echo " "; + echo " "; + echo " "; } - if ($modules['creature']) + if ($modules['p2']) { - echo " "; + echo " "; } if ($modules['box2d'] && isset($box2dpath)) @@ -41,6 +44,7 @@ echo " "; } + // PIXI Intro echo <<