Skip to content

Commit d44424f

Browse files
committed
2.1.3 documentation updates.
1 parent fbe68e3 commit d44424f

237 files changed

Lines changed: 3292 additions & 2396 deletions

File tree

Some content is hidden

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

docgen/output/Phaser.RenderTexture.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docgen/output/Phaser.RetroFont.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/AABB.js.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@
526526
</ul>
527527
</li>
528528

529+
529530
</ul>
530531
</div>
531532
</div>
@@ -1596,7 +1597,7 @@ <h1 class="page-title">Source: physics/ninja/AABB.js</h1>
15961597

15971598
<span class="jsdoc-message">
15981599
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</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>.
1600+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
16001601
</span>
16011602
</footer>
16021603
</div>

docs/Animation.js.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,13 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
561561
* @param {string} name - The unique name for this animation, used in playback commands.
562562
* @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
563563
* @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order.
564-
* @param {number} delay - The time between each frame of the animation, given in ms.
564+
* @param {number} [frameRate=60] - The speed at which the animation should play. The speed is given in frames per second.
565+
* @param {boolean} [loop=false] - Whether or not the animation is looped or just plays once.
565566
* @param {boolean} loop - Should this animation loop when it reaches the end or play through once.
566567
*/
567-
Phaser.Animation = function (game, parent, name, frameData, frames, delay, loop) {
568+
Phaser.Animation = function (game, parent, name, frameData, frames, frameRate, loop) {
569+
570+
if (typeof loop === 'undefined') { loop = false; }
568571

569572
/**
570573
* @property {Phaser.Game} game - A reference to the currently running Game.
@@ -596,9 +599,9 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
596599
this._frames = this._frames.concat(frames);
597600

598601
/**
599-
* @property {number} delay - The delay in ms between each frame of the Animation.
602+
* @property {number} delay - The delay in ms between each frame of the Animation, based on the given frameRate.
600603
*/
601-
this.delay = 1000 / delay;
604+
this.delay = 1000 / frameRate;
602605

603606
/**
604607
* @property {boolean} loop - The loop state of the Animation.
@@ -956,7 +959,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
956959
this._parent.__tilePattern = false;
957960
this._parent.tilingTexture = false;
958961
}
959-
962+
960963
if (this.onUpdate)
961964
{
962965
this.onUpdate.dispatch(this, this.currentFrame);
@@ -1090,7 +1093,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
10901093

10911094
this.game.onPause.remove(this.onPause, this);
10921095
this.game.onResume.remove(this.onResume, this);
1093-
1096+
10941097
this.game = null;
10951098
this._parent = null;
10961099
this._frames = null;
@@ -1223,7 +1226,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
12231226

12241227
/**
12251228
* @name Phaser.Animation#speed
1226-
* @property {number} speed - Gets or sets the current speed of the animation, the time between each frame of the animation, given in ms. Takes effect from the NEXT frame. Minimum value is 1.
1229+
* @property {number} speed - Gets or sets the current speed of the animation in frames per second. Changing this in a playing animation will take effect from the next frame. Minimum value is 1.
12271230
*/
12281231
Object.defineProperty(Phaser.Animation.prototype, 'speed', {
12291232

@@ -1288,7 +1291,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
12881291
*/
12891292
Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zeroPad) {
12901293

1291-
if (typeof suffix == 'undefined') { suffix = ''; }
1294+
if (typeof suffix === 'undefined') { suffix = ''; }
12921295

12931296
var output = [];
12941297
var frame = '';
@@ -1297,7 +1300,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
12971300
{
12981301
for (var i = start; i &lt;= stop; i++)
12991302
{
1300-
if (typeof zeroPad == 'number')
1303+
if (typeof zeroPad === 'number')
13011304
{
13021305
// str, len, pad, dir
13031306
frame = Phaser.Utils.pad(i.toString(), zeroPad, '0', 1);
@@ -1316,7 +1319,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
13161319
{
13171320
for (var i = start; i >= stop; i--)
13181321
{
1319-
if (typeof zeroPad == 'number')
1322+
if (typeof zeroPad === 'number')
13201323
{
13211324
// str, len, pad, dir
13221325
frame = Phaser.Utils.pad(i.toString(), zeroPad, '0', 1);
@@ -1356,7 +1359,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
13561359

13571360
<span class="jsdoc-message">
13581361
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</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>.
1362+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
13601363
</span>
13611364
</footer>
13621365
</div>

docs/AnimationManager.js.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ <h1 class="page-title">Source: animation/AnimationManager.js</h1>
783783
*/
784784
validateFrames: function (frames, useNumericIndex) {
785785

786-
if (typeof useNumericIndex == 'undefined') { useNumericIndex = true; }
786+
if (typeof useNumericIndex === 'undefined') { useNumericIndex = true; }
787787

788788
for (var i = 0; i &lt; frames.length; i++)
789789
{
@@ -857,9 +857,9 @@ <h1 class="page-title">Source: animation/AnimationManager.js</h1>
857857
*/
858858
stop: function (name, resetFrame) {
859859

860-
if (typeof resetFrame == 'undefined') { resetFrame = false; }
860+
if (typeof resetFrame === 'undefined') { resetFrame = false; }
861861

862-
if (typeof name == 'string')
862+
if (typeof name === 'string')
863863
{
864864
if (this._anims[name])
865865
{
@@ -1166,7 +1166,7 @@ <h1 class="page-title">Source: animation/AnimationManager.js</h1>
11661166

11671167
<span class="jsdoc-message">
11681168
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</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>.
1169+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
11701170
</span>
11711171
</footer>
11721172
</div>

docs/AnimationParser.js.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
554554
* Responsible for parsing sprite sheet and JSON data into the internal FrameData format that Phaser uses for animations.
555555
*
556556
* @class Phaser.AnimationParser
557+
* @static
557558
*/
558559
Phaser.AnimationParser = {
559560

@@ -873,7 +874,7 @@ <h1 class="page-title">Source: animation/AnimationParser.js</h1>
873874

874875
<span class="jsdoc-message">
875876
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</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>.
877+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
877878
</span>
878879
</footer>
879880
</div>

docs/ArcadeParticles.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ <h1 class="page-title">Source: particles/arcade/ArcadeParticles.js</h1>
576576

577577
<span class="jsdoc-message">
578578
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
579-
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
579+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
580580
</span>
581581
</footer>
582582
</div>

docs/ArrayList.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ <h1 class="page-title">Source: core/ArrayList.js</h1>
775775

776776
<span class="jsdoc-message">
777777
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
778-
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
778+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
779779
</span>
780780
</footer>
781781
</div>

docs/AudioSprite.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ <h1 class="page-title">Source: sound/AudioSprite.js</h1>
702702

703703
<span class="jsdoc-message">
704704
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
705-
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
705+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
706706
</span>
707707
</footer>
708708
</div>

docs/BitmapData.js.html

Lines changed: 120 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
784784
* If a string is given it will assume it's a cache key and look in Phaser.Cache for an image key matching the string.
785785
*
786786
* @method Phaser.BitmapData#load
787-
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|HTMLCanvasElement|string} source - The object that will be used to populate this BitmapData. If you give a string it will try and find the Image in the Game.Cache first.
787+
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} source - The object that will be used to populate this BitmapData. If you give a string it will try and find the Image in the Game.Cache first.
788788
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
789789
*/
790790
load: function (source) {
@@ -1363,6 +1363,117 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
13631363

13641364
},
13651365

1366+
/**
1367+
* Scans the BitmapData, pixel by pixel, until it encounters a pixel that isn't transparent (i.e. has an alpha value > 0).
1368+
* It then stops scanning and returns an object containing the colour of the pixel in r, g and b properties and the location in the x and y properties.
1369+
*
1370+
* The direction parameter controls from which direction it should start the scan:
1371+
*
1372+
* 0 = top to bottom
1373+
* 1 = bottom to top
1374+
* 2 = left to right
1375+
* 3 = right to left
1376+
*
1377+
* @method Phaser.BitmapData#getFirstPixel
1378+
* @param {number} [direction=0] - The direction in which to scan for the first pixel. 0 = top to bottom, 1 = bottom to top, 2 = left to right and 3 = right to left.
1379+
* @return {object} Returns an object containing the colour of the pixel in the `r`, `g` and `b` properties and the location in the `x` and `y` properties.
1380+
*/
1381+
getFirstPixel: function (direction) {
1382+
1383+
if (typeof direction === 'undefined') { direction = 0; }
1384+
1385+
var pixel = Phaser.Color.createColor();
1386+
1387+
var x = 0;
1388+
var y = 0;
1389+
var v = 1;
1390+
var scan = false;
1391+
1392+
if (direction === 1)
1393+
{
1394+
v = -1;
1395+
y = this.height;
1396+
}
1397+
else if (direction === 3)
1398+
{
1399+
v = -1;
1400+
x = this.width;
1401+
}
1402+
1403+
do {
1404+
1405+
Phaser.Color.unpackPixel(this.getPixel32(x, y), pixel);
1406+
1407+
if (direction === 0 || direction === 1)
1408+
{
1409+
// Top to Bottom / Bottom to Top
1410+
x++;
1411+
1412+
if (x === this.width)
1413+
{
1414+
x = 0;
1415+
y += v;
1416+
1417+
if (y >= this.height || y &lt;= 0)
1418+
{
1419+
scan = true;
1420+
}
1421+
}
1422+
}
1423+
else if (direction === 2 || direction === 3)
1424+
{
1425+
// Left to Right / Right to Left
1426+
y++;
1427+
1428+
if (y === this.height)
1429+
{
1430+
y = 0;
1431+
x += v;
1432+
1433+
if (x >= this.width || x &lt;= 0)
1434+
{
1435+
scan = true;
1436+
}
1437+
}
1438+
}
1439+
}
1440+
while (pixel.a === 0 && !scan);
1441+
1442+
pixel.x = x;
1443+
pixel.y = y;
1444+
1445+
return pixel;
1446+
1447+
},
1448+
1449+
/**
1450+
* Scans the BitmapData and calculates the bounds. This is a rectangle that defines the extent of all non-transparent pixels.
1451+
* The rectangle returned will extend from the top-left of the image to the bottom-right, exluding transparent pixels.
1452+
*
1453+
* @method Phaser.BitmapData#getBounds
1454+
* @param {Phaser.Rectangle} [rect] - If provided this Rectangle object will be populated with the bounds, otherwise a new object will be created.
1455+
* @return {Phaser.Rectangle} A Rectangle whose dimensions encompass the full extent of non-transparent pixels in this BitmapData.
1456+
*/
1457+
getBounds: function (rect) {
1458+
1459+
if (typeof rect === 'undefined') { rect = new Phaser.Rectangle(); }
1460+
1461+
rect.x = this.getFirstPixel(2).x;
1462+
1463+
// If we hit this, there's no point scanning any more, the image is empty
1464+
if (rect.x === this.width)
1465+
{
1466+
return rect.setTo(0, 0, 0, 0);
1467+
}
1468+
1469+
rect.y = this.getFirstPixel(0).y;
1470+
rect.width = (this.getFirstPixel(3).x - rect.x) + 1;
1471+
rect.height = (this.getFirstPixel(1).y - rect.y) + 1;
1472+
1473+
return rect;
1474+
1475+
},
1476+
13661477
/**
13671478
* Creates a new Phaser.Image object, assigns this BitmapData to be its texture, adds it to the world then returns it.
13681479
*
@@ -1399,7 +1510,7 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
13991510
* You can use the more friendly methods like `copyRect` and `draw` to avoid having to remember them all.
14001511
*
14011512
* @method Phaser.BitmapData#copy
1402-
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|HTMLCanvasElement|string} [source] - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
1513+
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} [source] - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
14031514
* @param {number} [x=0] - The x coordinate representing the top-left of the region to copy from the source image.
14041515
* @param {number} [y=0] - The y coordinate representing the top-left of the region to copy from the source image.
14051516
* @param {number} [width] - The width of the region to copy from the source image. If not specified it will use the full source image width.
@@ -1586,7 +1697,7 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
15861697
* Copies the area defined by the Rectangle parameter from the source image to this BitmapData at the given location.
15871698
*
15881699
* @method Phaser.BitmapData#copyRect
1589-
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|string} source - The Image to copy from. If you give a string it will try and find the Image in the Game.Cache.
1700+
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|string} source - The Image to copy from. If you give a string it will try and find the Image in the Game.Cache.
15901701
* @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
15911702
* @param {number} x - The destination x coordinate to copy the image to.
15921703
* @param {number} y - The destination y coordinate to copy the image to.
@@ -1655,8 +1766,8 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
16551766
* Draws the image onto this BitmapData using an image as an alpha mask.
16561767
*
16571768
* @method Phaser.BitmapData#alphaMask
1658-
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|HTMLCanvasElement|string} source - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
1659-
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|HTMLCanvasElement|string} [mask] - The object to be used as the mask. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself. If you don't provide a mask it will use this BitmapData as the mask.
1769+
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} source - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
1770+
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|Image|HTMLCanvasElement|string} [mask] - The object to be used as the mask. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself. If you don't provide a mask it will use this BitmapData as the mask.
16601771
* @param {Phaser.Rectangle} [sourceRect] - A Rectangle where x/y define the coordinates to draw the Source image to and width/height define the size.
16611772
* @param {Phaser.Rectangle} [maskRect] - A Rectangle where x/y define the coordinates to draw the Mask image to and width/height define the size.
16621773
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
@@ -1794,7 +1905,7 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
17941905
*
17951906
* @method Phaser.BitmapData#textureLine
17961907
* @param {Phaser.Line} line - A Phaser.Line object that will be used to plot the start and end of the line.
1797-
* @param {string|HTMLImage} image - The key of an image in the Phaser.Cache to use as the texture for this line, or an actual Image.
1908+
* @param {string|Image} image - The key of an image in the Phaser.Cache to use as the texture for this line, or an actual Image.
17981909
* @param {string} [repeat='repeat-x'] - The pattern repeat mode to use when drawing the line. Either `repeat`, `repeat-x` or `no-repeat`.
17991910
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
18001911
*/
@@ -1847,12 +1958,9 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
18471958
*/
18481959
render: function () {
18491960

1850-
if (!this.disableTextureUpload && this.game.renderType === Phaser.WEBGL && this.dirty)
1961+
if (!this.disableTextureUpload && this.dirty)
18511962
{
1852-
// Only needed if running in WebGL, otherwise this array will never get cleared down
1853-
// should use the rendersession
1854-
PIXI.updateWebGLTexture(this.baseTexture, this.game.renderer.gl);
1855-
1963+
this.baseTexture.dirty();
18561964
this.dirty = false;
18571965
}
18581966

@@ -2267,7 +2375,7 @@ <h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
22672375

22682376
<span class="jsdoc-message">
22692377
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
2270-
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
2378+
on Wed Oct 22 2014 21:45:44 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
22712379
</span>
22722380
</footer>
22732381
</div>

0 commit comments

Comments
 (0)