Skip to content

Commit a9a46bf

Browse files
committed
Lots of documentation updates and new Loader examples.
1 parent 4926fac commit a9a46bf

27 files changed

Lines changed: 1047 additions & 203 deletions

README.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ Version 1.1.3 - in build
4444
* New: Added a .jshintrc so contributions can be run through JSHint to help retain formatting across the library (thanks kevinthompson)
4545
* New: The entire Phaser library has been updated to match the new JSHint configuration.
4646
* New: Added a new in-built texture. Sprites now use __default if no texture was provided (a 32x32 transparent PNG) or __missing if one was given but not found (a 32x32 black box with a green cross through it)
47-
* New: Added Phaser.Filter. A new way to use the new WebGL shaders/filters that the new version of Pixi supports.
48-
* New: The object returned by Math.sinCosGenerator now contains a length property.
47+
* New: Phaser.Filter. A new way to use the new WebGL shaders/filters that the new version of Pixi supports.
4948
* New: Phaser.BitmapData object. A Canvas you can freely draw to with lots of functions. Can be used as a texture for Sprites. See the new examples and docs for details.
5049
* New: RenderTexture.render now takes a Phaser.Group. Also added renderXY for when you don't want to make a new Point object.
50+
* New: Physics.overlap now supports Sprites, Groups or Emitters and can perform group vs. group (etc) overlap checks with a custom callback and process handler.
51+
* New: Added Sound.externalNode which allows you to connect a Sound to an external node input rather than the SoundManager gain node.
52+
* New: Added SoundManager.connectToMaster boolean. Used in conjunction with Sound.externalNode you can easily configure audio nodes to connect together for special effects.
5153
* New: PluginManager.remove, added PluginManager.removeAll (thanks crazysam)
5254
* New: scrollFactorX/scrollFactorY have been added to TilemapLayers (thanks jcd-as)
5355
* New: Phaser.Game parent can now be an HTMLElement or a string (thanks beeglebug)
@@ -64,8 +66,22 @@ Version 1.1.3 - in build
6466
* New: Device.littleEndian boolean added. Only safe to use if the browser supports TypedArrays (which IE9 doesn't, but nearly all others do)
6567
* New: You can now call game.sound.play() and simply pass it a key. The sound will play if the audio system is unlocked and optionally destroy itself on complete.
6668
* New: Mouse.capture is a boolean. If set to true then DOM mouse events will have event.preventDefault() applied, if false they will propogate fully.
67-
* New: Added Sound.externalNode which allows you to connect a Sound to an external node input rather than the SoundManager gain node.
68-
* New: Added SoundManager.connectToMaster boolean. Used in conjunction with Sound.externalNode you can easily configure audio nodes to connect together for special effects.
69+
* New: The object returned by Math.sinCosGenerator now contains a length property.
70+
71+
* Updated: Lots of documentation fixes and updates across nearly all files. Tilemap now documented for example and lots of instances of 'Description' filled out.
72+
* Updated: ArcadePhysics.updateMotion applies the dt to the velocity calculations as well as position now (thanks jcs)
73+
* Updated: RequestAnimationFrame now retains the callbackID which is passed to cancelRequestAnimationFrame.
74+
* Updated: Button now goes back to over state when setFrames used in action (thanks beeglebug)
75+
* Updated: plugins now have a postUpdate callback (thanks cocoademon)
76+
* Updated: Tided up the Graphics object (thanks BorisKozo)
77+
* Updated: If running in Canvas mode and you have a render function it will save the context and reset the transform before running your render function.
78+
* Updated: Sprite will now check the exists property of the Group it is in, if the Group.exists = false the Sprite won't update.
79+
* Updated: If you specify 'null' as a Group parent it will now revert to using the World as the parent (before only 'undefined' worked)
80+
* Updated: Skip preupdate/update for PIXI hierarchies in which an ancestor doesn't exist (thanks cocoademon)
81+
* Updated: Loader.audio can now accept either an array of URL strings or a single URL string (thanks crazysam + kevinthompson)
82+
* Updated: MSPointer updated to support IE11 by dropping the prefix from the event listeners.
83+
* Updated: Device.cocoonJS added to detect if the game is running under Cocoon or a native browser.
84+
* Updated: Loader now uses a new queue system internally, meaning you can have assets with the same key spread across different types.
6985

7086
* Fixed: Lots of fixes to the TypeScript definitions file (many thanks gltovar)
7187
* Fixed: Tilemap commands use specified layer when one given (thanks Izzimach)
@@ -82,20 +98,7 @@ Version 1.1.3 - in build
8298
* Fixed: Device.isTouch modified to test maxTouchPointers instead of MSPointer.
8399
* Fixed: InputHandler.checkPointerOver now checks the visible status of the Sprite Group before processing.
84100
* Fixed: The Sprite hulls (used for tile collision) were not being updated in sprite->sprite separations (thanks jcs)
85-
86-
* Updated: ArcadePhysics.updateMotion applies the dt to the velocity calculations as well as position now (thanks jcs)
87-
* Updated: RequestAnimationFrame now retains the callbackID which is passed to cancelRequestAnimationFrame.
88-
* Updated: Button now goes back to over state when setFrames used in action (thanks beeglebug)
89-
* Updated: plugins now have a postUpdate callback (thanks cocoademon)
90-
* Updated: Tided up the Graphics object (thanks BorisKozo)
91-
* Updated: If running in Canvas mode and you have a render function it will save the context and reset the transform before running your render function.
92-
* Updated: Sprite will now check the exists property of the Group it is in, if the Group.exists = false the Sprite won't update.
93-
* Updated: Lots of documentation fixes and updates across nearly all files.
94-
* Updated: If you specify 'null' as a Group parent it will now revert to using the World as the parent (before only 'undefined' worked)
95-
* Updated: Skip preupdate/update for PIXI hierarchies in which an ancestor doesn't exist (thanks cocoademon)
96-
* Updated: Loader.audio can now accept either an array of URL strings or a single URL string (thanks crazysam + kevinthompson)
97-
* Updated: MSPointer updated to support IE11 by dropping the prefix from the event listeners.
98-
* Updated: Device.cocoonJS added to detect if the game is running under Cocoon or a native browser.
101+
* Fixed: Plugins that had a postUpdate but no Update weren't being marked as active (thanks crazysam)
99102

100103
You can view the complete Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md
101104

@@ -211,12 +214,6 @@ The 1.1 release was a massive under-taking, but we're really happy with how Phas
211214
* Create more touch input examples (http://www.html5gamedevs.com/topic/1556-mobile-touch-event/)
212215
* Look at HiDPI Canvas settings.
213216

214-
Some specific features / issues we will address soon:
215-
216-
* Loader conflict if 2 keys are the same even if they are in different packages (i.e. you can't use "title" for both and image and sound file).
217-
* Sound.addMarker hh:mm:ss:ms.
218-
* Add support for a rotation offset.
219-
220217
Learn By Example
221218
----------------
222219

@@ -243,10 +240,10 @@ If you find a bug (highly likely!) then please report it on github or our forum.
243240

244241
If you have a feature request, or have written a small game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you.
245242

246-
Before submitting a pull request, please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, first install it by running `npm install jshint`, then test your code by running `jshint src`. This isn't a requirement, we are happy to receive pull requests that haven't been JSHinted, so don't let it put you off contributing - but do know that we'll reformat your source before going live with it.
247-
248243
You can do this on the Phaser board that is part of the [HTML5 Game Devs forum](http://www.html5gamedevs.com/forum/14-phaser/) or email: rich@photonstorm.com
249244

245+
Before submitting a pull request, please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, first install it by running `npm install jshint`, then test your code by running `jshint src`. This isn't a requirement, we are happy to receive pull requests that haven't been JSHinted, so don't let it put you off contributing - but do know that we'll reformat your source before going live with it.
246+
250247
Bugs?
251248
-----
252249

build/phaser.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,10 @@ declare module Phaser {
15651565
computeVelocity(axis: number, body: Phaser.Physics.Arcade.Body, velocity: number, acceleration: number, drag: number, max: number): void;
15661566
preUpdate(): void;
15671567
postUpdate(): void;
1568+
overlap(object1: any, object2: any, overlapCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
1569+
overlapSpriteVsSprite(sprite1: Phaser.Sprite, sprite2: Phaser.Sprite, overlapCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
1570+
overlapSpriteVsGroup(sprite1: Phaser.Sprite, group: Phaser.Group, overlapCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
1571+
overlapGroupVsGroup(group: Phaser.Group, group2: Phaser.Group, overlapCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
15681572
collide(object1: any, object2: any, collideCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
15691573
collideSpriteVsSprite(sprite1: Phaser.Sprite, sprite2: Phaser.Sprite, collideCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
15701574
collideSpriteVsTilemap(sprite1: Phaser.Sprite, tilemap: Phaser.Tilemap, collideCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;

build/ts.bat

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/build/conf.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"../../src/physics/arcade/",
1919
"../../src/sound/",
2020
"../../src/system/",
21+
"../../src/tilemap/",
2122
"../../src/time/",
2223
"../../src/tween/",
2324
"../../src/utils/"

docs/build/conf_dev.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"../../src/physics/arcade/",
1919
"../../src/sound/",
2020
"../../src/system/",
21+
"../../src/tilemap/",
2122
"../../src/time/",
2223
"../../src/tween/",
2324
"../../src/utils/"

examples/_site/examples.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@
392392
"file": "load+audio.js",
393393
"title": "load audio"
394394
},
395+
{
396+
"file": "load+bitmap+font.js",
397+
"title": "load bitmap font"
398+
},
395399
{
396400
"file": "load+image.js",
397401
"title": "load image"
@@ -400,6 +404,18 @@
400404
"file": "load+spritesheet.js",
401405
"title": "load spritesheet"
402406
},
407+
{
408+
"file": "load+starling+atlas.js",
409+
"title": "load starling atlas"
410+
},
411+
{
412+
"file": "load+text+file.js",
413+
"title": "load text file"
414+
},
415+
{
416+
"file": "load+texture+atlas.js",
417+
"title": "load texture atlas"
418+
},
403419
{
404420
"file": "pick+images+from+cache.js",
405421
"title": "pick images from cache"
@@ -592,6 +608,10 @@
592608
"file": "animated+tiling+sprite.js",
593609
"title": "animated tiling sprite"
594610
},
611+
{
612+
"file": "tiling+sprite+input.js",
613+
"title": "tiling sprite input"
614+
},
595615
{
596616
"file": "tiling+sprite.js",
597617
"title": "tiling sprite"

examples/loader/load audio.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
2+
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });
33

44
function preload() {
55

@@ -14,6 +14,9 @@ function preload() {
1414

1515
game.load.audio('boden', ['assets/audio/bodenstaendig_2000_in_rock_4bit.mp3', 'assets/audio/bodenstaendig_2000_in_rock_4bit.ogg']);
1616

17+
// If you know you only need to load 1 type of audio file, you can pass a string instead of an array, like this:
18+
// game.load.audio('boden', 'assets/audio/bodenstaendig_2000_in_rock_4bit.mp3');
19+
1720
}
1821

1922
var music;
@@ -22,8 +25,6 @@ function create() {
2225

2326
game.stage.backgroundColor = '#182d3b';
2427

25-
// game.input.touch.preventDefault = false;
26-
2728
music = game.sound.play('boden');
2829

2930
}
@@ -32,4 +33,9 @@ function render() {
3233

3334
game.debug.renderSoundInfo(music, 32, 32);
3435

36+
if (music.isDecoding)
37+
{
38+
game.debug.renderText("Decoding MP3 ...", 32, 200);
39+
}
40+
3541
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
3+
4+
function preload() {
5+
6+
// Phaser can load Bitmap Fonts.
7+
8+
// As with all load operations the first parameter is a unique key, which must be unique between all image files.
9+
// Next is the bitmap font file itself, in this case desyrel.png
10+
// Finally is the path to the XML file that goes with the font.
11+
12+
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml');
13+
14+
// Note that the XML file should be saved with UTF-8 encoding or some browsers (such as Firefox) won't load it.
15+
16+
// There are various tools that can create Bitmap Fonts and the XML file needed.
17+
// On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/
18+
// On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner
19+
20+
}
21+
22+
var text;
23+
24+
function create() {
25+
26+
game.stage.backgroundColor = '#0072bc';
27+
28+
text = game.add.bitmapText(200, 100, 'Bitmap Fonts!', { font: '64px Desyrel', align: 'center' });
29+
30+
}
31+
32+
function update() {
33+
34+
text.setText('Bitmap Fonts!\nx: ' + Math.round(game.input.x) + ' y: ' + Math.round(game.input.y));
35+
36+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
3+
4+
function preload() {
5+
6+
// Phaser can load texture atlas files that use the Starling XML file format.
7+
8+
// As with all load operations the first parameter is a unique key, which must be unique between all image files.
9+
10+
// Next is the texture atlas itself, in this case seacreatures.png
11+
// Finally is the path to the XML file that goes with the atlas.
12+
game.load.atlasXML('seacreatures', 'assets/sprites/seacreatures.png', 'assets/sprites/seacreatures.xml');
13+
14+
// Note that the XML file should be saved with UTF-8 encoding or some browsers (such as Firefox) won't load it.
15+
16+
17+
18+
// These are just a few images to use in our underwater scene.
19+
game.load.image('undersea', 'assets/pics/undersea.jpg');
20+
game.load.image('coral', 'assets/pics/seabed.png');
21+
22+
}
23+
24+
var jellyfish;
25+
26+
function create() {
27+
28+
game.add.sprite(0, 0, 'undersea');
29+
30+
jellyfish = game.add.sprite(330, 100, 'seacreatures');
31+
jellyfish.animations.add('swim', Phaser.Animation.generateFrameNames('greenJellyfish', 0, 39, '', 4), 30, true);
32+
jellyfish.animations.play('swim');
33+
34+
game.add.sprite(0, 466, 'coral');
35+
36+
game.add.tween(jellyfish).to({ y: 250 }, 4000, Phaser.Easing.Quadratic.InOut, true, 0, 10000, true);
37+
38+
}

examples/loader/load text file.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });
3+
4+
function preload() {
5+
6+
// Phaser can load Text files.
7+
8+
// It does this using an XMLHttpRequest.
9+
10+
// If loading a file from outside of the domain in which the game is running
11+
// a 'Access-Control-Allow-Origin' header must be present on the server.
12+
// No parsing of the text file is performed, it's literally just the raw data.
13+
14+
game.load.text('html', 'http://phaser.io');
15+
16+
}
17+
18+
var text;
19+
20+
function create() {
21+
22+
game.stage.backgroundColor = '#0072bc';
23+
24+
var html = game.cache.getText('html');
25+
26+
text = html.split('\n');
27+
28+
}
29+
30+
function render() {
31+
32+
for (var i = 0; i < 30; i++)
33+
{
34+
game.debug.renderText(text[i], 32, i * 20);
35+
}
36+
37+
}

0 commit comments

Comments
 (0)