Updated doc files.

This commit is contained in:
photonstorm
2014-02-05 16:55:02 +00:00
parent 0896c2fac7
commit 02b75b9e23
182 changed files with 72763 additions and 19286 deletions
+137 -150
View File
@@ -90,6 +90,10 @@
<a href="Phaser.Device.html">Device</a>
</li>
<li>
<a href="Phaser.DOMSprite.html">DOMSprite</a>
</li>
<li>
<a href="Phaser.Easing.html">Easing</a>
</li>
@@ -162,6 +166,14 @@
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li>
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
<li>
<a href="Phaser.GamepadButton.html">GamepadButton</a>
</li>
<li>
<a href="Phaser.Graphics.html">Graphics</a>
</li>
@@ -186,6 +198,10 @@
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li>
<a href="Phaser.Line.html">Line</a>
</li>
<li>
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
@@ -278,6 +294,10 @@
<a href="Phaser.Signal.html">Signal</a>
</li>
<li>
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
<li>
<a href="Phaser.Sound.html">Sound</a>
</li>
@@ -342,6 +362,10 @@
<a href="Phaser.Timer.html">Timer</a>
</li>
<li>
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
<li>
<a href="Phaser.Touch.html">Touch</a>
</li>
@@ -374,36 +398,6 @@
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="global.html#bottom">bottom</a>
</li>
<li>
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
</li>
<li>
<a href="global.html#render">render</a>
</li>
<li>
<a href="global.html#renderXY">renderXY</a>
</li>
<li>
<a href="global.html#right">right</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
@@ -423,16 +417,15 @@
<article>
<pre class="sunlight-highlight-javascript linenums">/**
* @author Richard Davey &lt;rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Phaser.Cache constructor.
*
* @class Phaser.Cache
* @classdesc A game only has one instance of a Cache and it is used to store all externally loaded assets such
* as images, sounds and data files as a result of Loader calls. Cache items use string based keys for look-up.
* @class Phaser.Cache
* @classdesc A game only has one instance of a Cache and it is used to store all externally loaded assets such as images, sounds and data files as a result of Loader calls. Cached items use string based keys for look-up.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
*/
@@ -480,10 +473,10 @@ Phaser.Cache = function (game) {
this._tilemaps = {};
/**
* @property {object} _tilesets - Tileset key-value container.
* @property {object} _binary - Binary file key-value container.
* @private
*/
this._tilesets = {};
this._binary = {};
/**
* @property {object} _bitmapDatas - BitmapData key-value container.
@@ -516,6 +509,18 @@ Phaser.Cache.prototype = {
},
/**
* Add a binary object in to the cache.
* @method Phaser.Cache#addBinary
* @param {string} key - Asset key for this binary data.
* @param {object} binaryData - The binary object to be addded to the cache.
*/
addBinary: function (key, binaryData) {
this._binary[key] = binaryData;
},
/**
* Add a BitmapData object in to the cache.
* @method Phaser.Cache#addBitmapData
@@ -555,40 +560,18 @@ Phaser.Cache.prototype = {
* @param {object} data - Extra sprite sheet data.
* @param {number} frameWidth - Width of the sprite sheet.
* @param {number} frameHeight - Height of the sprite sheet.
* @param {number} frameMax - How many frames stored in the sprite sheet.
* @param {number} [frameMax=-1] - How many frames stored in the sprite sheet. If -1 then it divides the whole sheet evenly.
* @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
* @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
*/
addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax) {
addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax, margin, spacing) {
this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight };
this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight, margin: margin, spacing: spacing };
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax);
},
/**
* Add a new tile set in to the cache.
*
* @method Phaser.Cache#addTileset
* @param {string} key - The unique key by which you will reference this object.
* @param {string} url - URL of this tile set file.
* @param {object} data - Extra tile set data.
* @param {number} tileWidth - Width of the sprite sheet.
* @param {number} tileHeight - Height of the sprite sheet.
* @param {number} tileMax - How many tiles stored in the sprite sheet.
* @param {number} [tileMargin=0] - If the tiles have been drawn with a margin, specify the amount here.
* @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
*/
addTileset: function (key, url, data, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) {
this._tilesets[key] = { url: url, data: data, tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing };
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
this._tilesets[key].tileData = Phaser.TilemapParser.tileset(this.game, key, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing);
this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax, margin, spacing);
},
@@ -598,15 +581,13 @@ Phaser.Cache.prototype = {
* @method Phaser.Cache#addTilemap
* @param {string} key - The unique key by which you will reference this object.
* @param {string} url - URL of the tilemap image.
* @param {object} mapData - The tilemap data object.
* @param {object} mapData - The tilemap data object (either a CSV or JSON file).
* @param {number} format - The format of the tilemap data.
*/
addTilemap: function (key, url, mapData, format) {
this._tilemaps[key] = { url: url, data: mapData, format: format };
this._tilemaps[key].layers = Phaser.TilemapParser.parse(this.game, mapData, format);
},
/**
@@ -756,12 +737,13 @@ Phaser.Cache.prototype = {
decoded = true;
}
this._sounds[key] = { url: url, data: data, isDecoding: false, decoded: decoded, webAudio: webAudio, audioTag: audioTag };
this._sounds[key] = { url: url, data: data, isDecoding: false, decoded: decoded, webAudio: webAudio, audioTag: audioTag, locked: this.game.sound.touchLocked };
},
/**
* Reload a sound.
*
* @method Phaser.Cache#reloadSound
* @param {string} key - Asset key for the sound.
*/
@@ -782,7 +764,8 @@ Phaser.Cache.prototype = {
},
/**
* Description.
* Fires the onSoundUnlock event when the sound has completed reloading.
*
* @method Phaser.Cache#reloadSoundComplete
* @param {string} key - Asset key for the sound.
*/
@@ -797,7 +780,8 @@ Phaser.Cache.prototype = {
},
/**
* Description.
* Updates the sound object in the cache.
*
* @method Phaser.Cache#updateSound
* @param {string} key - Asset key for the sound.
*/
@@ -829,8 +813,8 @@ Phaser.Cache.prototype = {
* Get a canvas object from the cache by its key.
*
* @method Phaser.Cache#getCanvas
* @param {string} key - Asset key of the canvas you want.
* @return {object} The canvas you want.
* @param {string} key - Asset key of the canvas to retrieve from the Cache.
* @return {object} The canvas object.
*/
getCanvas: function (key) {
@@ -838,8 +822,10 @@ Phaser.Cache.prototype = {
{
return this._canvases[key].canvas;
}
return null;
else
{
console.warn('Phaser.Cache.getCanvas: Invalid key: "' + key + '"');
}
},
@@ -847,7 +833,7 @@ Phaser.Cache.prototype = {
* Get a BitmapData object from the cache by its key.
*
* @method Phaser.Cache#getBitmapData
* @param {string} key - Asset key of the BitmapData object you want.
* @param {string} key - Asset key of the BitmapData object to retrieve from the Cache.
* @return {Phaser.BitmapData} The requested BitmapData object if found, or null if not.
*/
getBitmapData: function (key) {
@@ -856,8 +842,10 @@ Phaser.Cache.prototype = {
{
return this._bitmapDatas[key];
}
return null;
else
{
console.warn('Phaser.Cache.getBitmapData: Invalid key: "' + key + '"');
}
},
@@ -865,7 +853,7 @@ Phaser.Cache.prototype = {
* Checks if an image key exists.
*
* @method Phaser.Cache#checkImageKey
* @param {string} key - Asset key of the image you want.
* @param {string} key - Asset key of the image to check is in the Cache.
* @return {boolean} True if the key exists, otherwise false.
*/
checkImageKey: function (key) {
@@ -883,8 +871,8 @@ Phaser.Cache.prototype = {
* Get image data by key.
*
* @method Phaser.Cache#getImage
* @param {string} key - Asset key of the image you want.
* @return {object} The image data you want.
* @param {string} key - Asset key of the image to retrieve from the Cache.
* @return {object} The image data.
*/
getImage: function (key) {
@@ -892,53 +880,19 @@ Phaser.Cache.prototype = {
{
return this._images[key].data;
}
return null;
},
/**
* Get tile set image data by key.
*
* @method Phaser.Cache#getTileSetImage
* @param {string} key - Asset key of the image you want.
* @return {object} The image data you want.
*/
getTilesetImage: function (key) {
if (this._tilesets[key])
else
{
return this._tilesets[key].data;
console.warn('Phaser.Cache.getImage: Invalid key: "' + key + '"');
}
return null;
},
/**
* Get tile set image data by key.
*
* @method Phaser.Cache#getTileset
* @param {string} key - Asset key of the image you want.
* @return {Phaser.Tileset} The tileset data. The tileset image is in the data property, the tile data in tileData.
*/
getTileset: function (key) {
if (this._tilesets[key])
{
return this._tilesets[key].tileData;
}
return null;
},
/**
* Get tilemap data by key.
*
* @method Phaser.Cache#getTilemap
* @param {string} key - Asset key of the tilemap you want.
* @return {Object} The tilemap data. The tileset image is in the data property, the map data in mapData.
* @param {string} key - Asset key of the tilemap data to retrieve from the Cache.
* @return {Object} The raw tilemap data in CSV or JSON format.
*/
getTilemapData: function (key) {
@@ -946,16 +900,19 @@ Phaser.Cache.prototype = {
{
return this._tilemaps[key];
}
else
{
console.warn('Phaser.Cache.getTilemapData: Invalid key: "' + key + '"');
}
return null;
},
/**
* Get frame data by key.
*
* @method Phaser.Cache#getFrameData
* @param {string} key - Asset key of the frame data you want.
* @return {Phaser.FrameData} The frame data you want.
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
* @return {Phaser.FrameData} The frame data.
*/
getFrameData: function (key) {
@@ -971,8 +928,8 @@ Phaser.Cache.prototype = {
* Get a single frame out of a frameData set by key.
*
* @method Phaser.Cache#getFrameByIndex
* @param {string} key - Asset key of the frame data you want.
* @return {Phaser.Frame} The frame data you want.
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
* @return {Phaser.Frame} The frame object.
*/
getFrameByIndex: function (key, frame) {
@@ -988,8 +945,8 @@ Phaser.Cache.prototype = {
* Get a single frame out of a frameData set by key.
*
* @method Phaser.Cache#getFrameByName
* @param {string} key - Asset key of the frame data you want.
* @return {Phaser.Frame} The frame data you want.
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
* @return {Phaser.Frame} The frame object.
*/
getFrameByName: function (key, frame) {
@@ -1005,8 +962,8 @@ Phaser.Cache.prototype = {
* Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
*
* @method Phaser.Cache#getFrame
* @param {string} key - Asset key of the frame data you want.
* @return {Phaser.Frame} The frame data you want.
* @param {string} key - Asset key of the frame data to retrieve from the Cache.
* @return {Phaser.Frame} The frame data.
*/
getFrame: function (key) {
@@ -1019,11 +976,11 @@ Phaser.Cache.prototype = {
},
/**
* Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
* Get a single texture frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
*
* @method Phaser.Cache#getTextureFrame
* @param {string} key - Asset key of the frame data you want.
* @return {Phaser.Frame} The frame data you want.
* @param {string} key - Asset key of the frame to retrieve from the Cache.
* @return {Phaser.Frame} The frame data.
*/
getTextureFrame: function (key) {
@@ -1039,8 +996,8 @@ Phaser.Cache.prototype = {
* Get a RenderTexture by key.
*
* @method Phaser.Cache#getTexture
* @param {string} key - Asset key of the RenderTexture you want.
* @return {Phaser.RenderTexture} The RenderTexture you want.
* @param {string} key - Asset key of the RenderTexture to retrieve from the Cache.
* @return {Phaser.RenderTexture} The RenderTexture object.
*/
getTexture: function (key) {
@@ -1048,8 +1005,10 @@ Phaser.Cache.prototype = {
{
return this._textures[key];
}
return null;
else
{
console.warn('Phaser.Cache.getTexture: Invalid key: "' + key + '"');
}
},
@@ -1057,8 +1016,8 @@ Phaser.Cache.prototype = {
* Get sound by key.
*
* @method Phaser.Cache#getSound
* @param {string} key - Asset key of the sound you want.
* @return {Phaser.Sound} The sound you want.
* @param {string} key - Asset key of the sound to retrieve from the Cache.
* @return {Phaser.Sound} The sound object.
*/
getSound: function (key) {
@@ -1066,8 +1025,10 @@ Phaser.Cache.prototype = {
{
return this._sounds[key];
}
return null;
else
{
console.warn('Phaser.Cache.getSound: Invalid key: "' + key + '"');
}
},
@@ -1075,8 +1036,8 @@ Phaser.Cache.prototype = {
* Get sound data by key.
*
* @method Phaser.Cache#getSoundData
* @param {string} key - Asset key of the sound you want.
* @return {object} The sound data you want.
* @param {string} key - Asset key of the sound to retrieve from the Cache.
* @return {object} The sound data.
*/
getSoundData: function (key) {
@@ -1084,8 +1045,10 @@ Phaser.Cache.prototype = {
{
return this._sounds[key].data;
}
return null;
else
{
console.warn('Phaser.Cache.getSoundData: Invalid key: "' + key + '"');
}
},
@@ -1093,7 +1056,7 @@ Phaser.Cache.prototype = {
* Check if the given sound has finished decoding.
*
* @method Phaser.Cache#isSoundDecoded
* @param {string} key - Asset key of the sound you want.
* @param {string} key - Asset key of the sound in the Cache.
* @return {boolean} The decoded state of the Sound object.
*/
isSoundDecoded: function (key) {
@@ -1109,7 +1072,7 @@ Phaser.Cache.prototype = {
* Check if the given sound is ready for playback. A sound is considered ready when it has finished decoding and the device is no longer touch locked.
*
* @method Phaser.Cache#isSoundReady
* @param {string} key - Asset key of the sound you want.
* @param {string} key - Asset key of the sound in the Cache.
* @return {boolean} True if the sound is decoded and the device is not touch locked.
*/
isSoundReady: function (key) {
@@ -1140,8 +1103,8 @@ Phaser.Cache.prototype = {
* Get text data by key.
*
* @method Phaser.Cache#getText
* @param {string} key - Asset key of the text data you want.
* @return {object} The text data you want.
* @param {string} key - Asset key of the text data to retrieve from the Cache.
* @return {object} The text data.
*/
getText: function (key) {
@@ -1149,8 +1112,30 @@ Phaser.Cache.prototype = {
{
return this._text[key].data;
}
else
{
console.warn('Phaser.Cache.getText: Invalid key: "' + key + '"');
}
},
return null;
/**
* Get binary data by key.
*
* @method Phaser.Cache#getBinary
* @param {string} key - Asset key of the binary data object to retrieve from the Cache.
* @return {object} The binary data object.
*/
getBinary: function (key) {
if (this._binary[key])
{
return this._binary[key];
}
else
{
console.warn('Phaser.Cache.getBinary: Invalid key: "' + key + '"');
}
},
@@ -1168,7 +1153,7 @@ Phaser.Cache.prototype = {
for (var item in array)
{
if (item !== '__default')
if (item !== '__default' && item !== '__missing')
{
output.push(item);
}
@@ -1277,6 +1262,8 @@ Phaser.Cache.prototype = {
}
};
Phaser.Cache.prototype.constructor = Phaser.Cache;
</pre>
</article>
</section>
@@ -1292,13 +1279,13 @@ Phaser.Cache.prototype = {
<span class="copyright">
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Phaser Copyright © 2012-2014 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>