Added jsdocs

This commit is contained in:
Richard Davey 2018-02-08 13:45:53 +00:00
parent 4c5150a24c
commit 93a2c3734b

View file

@ -193,15 +193,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Creates a new Texture using the given config values.
* Generated textures consist of a Canvas element to which the texture data is drawn.
* See the Phaser.Create function for the more direct way to create textures.
*
* @method Phaser.Textures.TextureManager#generate
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} config - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {object} config - [description]
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
generate: function (key, config)
{
@ -215,16 +217,19 @@ var TextureManager = new Class({
},
/**
* [description]
* Creates a new Texture using a blank Canvas element of the size given.
*
* Canvas elements are automatically pooled and calling this method will
* extract a free canvas from the CanvasPool, or create one if none are available.
*
* @method Phaser.Textures.TextureManager#createCanvas
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} width - [description]
* @param {[type]} height - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {integer} width - The width of the Canvas element.
* @param {integer} height - The height of the Canvas element.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
createCanvas: function (key, width, height)
{
@ -237,15 +242,16 @@ var TextureManager = new Class({
},
/**
* [description]
* Creates a new Texture object from an existing Canvas element and adds
* it to this Texture Manager.
*
* @method Phaser.Textures.TextureManager#addCanvas
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {HTMLCanvasElement} source - The Canvas element to form the base of the new Texture.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addCanvas: function (key, source)
{
@ -257,16 +263,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a new Texture Atlas to this Texture Manager.
* It can accept either JSON Array or JSON Hash formats, as exported by Texture Packer and similar software.
*
* @method Phaser.Textures.TextureManager#addAtlas
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} data - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} data - The Texture Atlas data.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addAtlas: function (key, source, data)
{
@ -283,16 +290,18 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a Texture Atlas to this Texture Manager.
* The frame data of the atlas must be stored in an Array within the JSON.
* This is known as a JSON Array in software such as Texture Packer.
*
* @method Phaser.Textures.TextureManager#addAtlasJSONArray
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} data - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} data - The Texture Atlas data.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addAtlasJSONArray: function (key, source, data)
{
@ -314,16 +323,18 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a Texture Atlas to this Texture Manager.
* The frame data of the atlas must be stored in an Object within the JSON.
* This is known as a JSON Hash in software such as Texture Packer.
*
* @method Phaser.Textures.TextureManager#addAtlasJSONHash
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} data - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} data - The Texture Atlas data.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addAtlasJSONHash: function (key, source, data)
{
@ -345,16 +356,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a Unity Texture Atlas to this Texture Manager.
* The data must be in the form of a Unity YAML file.
*
* @method Phaser.Textures.TextureManager#addUnityAtlas
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} data - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} data - The Texture Atlas data.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addUnityAtlas: function (key, source, data)
{
@ -366,28 +378,25 @@ var TextureManager = new Class({
},
/**
* [addSpriteSheet description]
* @param {[type]} key [description]
* @param {[type]} source [description]
* @param {[type]} config [description]
* @param {number} config.frameWidth - The fixed width of each frame.
* @param {number} [config.frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
* @param {number} [config.startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
* @param {number} [config.endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
* @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here.
* @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
*/
/**
* [description]
* Adds a Sprite Sheet to this Texture Manager.
*
* In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact
* same size and cannot be trimmed or rotated.
*
* @method Phaser.Textures.TextureManager#addSpriteSheet
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} config - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} config - The configuration object for this Sprite Sheet.
* @param {integer} config.frameWidth - The fixed width of each frame.
* @param {integer} [config.frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
* @param {integer} [config.startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
* @param {integer} [config.endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
* @param {integer} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here.
* @param {integer} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addSpriteSheet: function (key, source, config)
{
@ -402,15 +411,26 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas.
*
* In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact
* same size and cannot be trimmed or rotated.
*
* @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} config - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {object} config - The configuration object for this Sprite Sheet.
* @param {string} config.atlas - The key of the Texture Atlas in which this Sprite Sheet can be found.
* @param {string} config.frame - The key of the Texture Atlas Frame in which this Sprite Sheet can be found.
* @param {integer} config.frameWidth - The fixed width of each frame.
* @param {integer} [config.frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
* @param {integer} [config.startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
* @param {integer} [config.endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
* @param {integer} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here.
* @param {integer} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addSpriteSheetFromAtlas: function (key, config)
{
@ -444,16 +464,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a Texture Atlas to this Texture Manager, where the atlas data is given
* in the Starling XML format.
*
* @method Phaser.Textures.TextureManager#addAtlasStarlingXML
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} data - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} data - The Texture Atlas XML data.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addAtlasStarlingXML: function (key, source, data)
{
@ -475,16 +496,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Adds a Texture Atlas to this Texture Manager, where the atlas data is given
* in the Pyxel JSON format.
*
* @method Phaser.Textures.TextureManager#addAtlasPyxel
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} data - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {object} data - The Texture Atlas XML data.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
addAtlasPyxel: function (key, source, data)
{
@ -506,17 +528,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Creates a new Texture using the given source and dimensions.
*
* @method Phaser.Textures.TextureManager#create
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} source - [description]
* @param {[type]} width - [description]
* @param {[type]} height - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {Image} source - The source Image element.
* @param {integer} width - The width of the Texture.
* @param {integer} height - The height of the Texture.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
create: function (key, source, width, height)
{
@ -528,14 +550,14 @@ var TextureManager = new Class({
},
/**
* [description]
* Checks the given key to see if a Texture using it exists within this Texture Manager.
*
* @method Phaser.Textures.TextureManager#exists
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {string} key - The unique string-based key of the Texture.
*
* @return {[type]} [description]
* @return {boolean} Returns `true` if a Texture matching the given key exists in this Texture Manager.
*/
exists: function (key)
{
@ -543,14 +565,16 @@ var TextureManager = new Class({
},
/**
* [description]
* Returns a Texture from the Texture Manager that matches the given key.
* If the key is undefined it will return the `__DEFAULT` Texture.
* If the key is given, but not found, it will return the `__MISSING` Texture.
*
* @method Phaser.Textures.TextureManager#get
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {string} key - The unique string-based key of the Texture.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Texture} The Texture that was created.
*/
get: function (key)
{
@ -567,15 +591,15 @@ var TextureManager = new Class({
},
/**
* [description]
* Takes a Texture key and Frame name and returns a clone of that Frame if found.
*
* @method Phaser.Textures.TextureManager#cloneFrame
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} frame - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {string|integer} frame - The string or index of the Frame to be cloned.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Frame} A Clone of the given Frame.
*/
cloneFrame: function (key, frame)
{
@ -586,15 +610,15 @@ var TextureManager = new Class({
},
/**
* [description]
* Takes a Texture key and Frame name and returns a reference to that Frame, if found.
*
* @method Phaser.Textures.TextureManager#getFrame
* @since 3.0.0
*
* @param {[type]} key - [description]
* @param {[type]} frame - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {string|integer} frame - The string or index of the Frame.
*
* @return {[type]} [description]
* @return {Phaser.Textures.Frame} A Texture Frame object.
*/
getFrame: function (key, frame)
{
@ -605,12 +629,13 @@ var TextureManager = new Class({
},
/**
* [description]
* Returns an array with all of the keys of all Textures in this Texture Manager.
* The output array will exclude the `__DEFAULT` and `__MISSING` keys.
*
* @method Phaser.Textures.TextureManager#getTextureKeys
* @since 3.0.0
*
* @return {[type]} [description]
* @return {string[]} An array containing all of the Texture keys stored in this Texture Manager.
*/
getTextureKeys: function ()
{
@ -628,17 +653,20 @@ var TextureManager = new Class({
},
/**
* [description]
* Given a Texture and an `x` and `y` coordinate this method will return a new
* Color object that has been populated with the color and alpha values of the pixel
* at that location in the Texture.
*
* @method Phaser.Textures.TextureManager#getPixel
* @since 3.0.0
*
* @param {[type]} x - [description]
* @param {[type]} y - [description]
* @param {[type]} key - [description]
* @param {[type]} frame - [description]
* @param {integer} x - The x coordinate of the pixel within the Texture.
* @param {integer} y - The y coordinate of the pixel within the Texture.
* @param {string} key - The unique string-based key of the Texture.
* @param {string|integer} frame - The string or index of the Frame.
*
* @return {[type]} [description]
* @return {Phaser.Display.Color|null} A Color object populated with the color values of the requested pixel,
* or `null` if the coordinates were out of bounds.
*/
getPixel: function (x, y, key, frame)
{
@ -674,16 +702,17 @@ var TextureManager = new Class({
},
/**
* [description]
* Sets the given Game Objects `texture` and `frame` properties so that it uses
* the Texture and Frame specified in the `key` and `frame` arguments to this method.
*
* @method Phaser.Textures.TextureManager#setTexture
* @since 3.0.0
*
* @param {[type]} gameObject - [description]
* @param {[type]} key - [description]
* @param {[type]} frame - [description]
* @param {Phaser.GameObjects.GameObject} gameObject - [description]
* @param {string} key - The unique string-based key of the Texture.
* @param {string|integer} frame - The string or index of the Frame.
*
* @return {[type]} [description]
* @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on.
*/
setTexture: function (gameObject, key, frame)
{
@ -697,23 +726,16 @@ var TextureManager = new Class({
},
/**
* Passes all Textures to the given callback.
*
* @method each
* @param {function} callback - The function to call.
* @param {object} [thisArg] - Value to use as `this` when executing callback.
* @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child.
*/
/**
* [description]
* Passes all Textures to the given callback.
*
* @method Phaser.Textures.TextureManager#each
* @since 3.0.0
*
* @param {[type]} callback - [description]
* @param {[type]} thisArg - [description]
* @param {function} callback - The callback function to be sent the Textures.
* @param {object} scope - The value to use as `this` when executing the callback.
* @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child.
*/
each: function (callback, thisArg)
each: function (callback, scope)
{
var args = [ null ];
@ -726,12 +748,12 @@ var TextureManager = new Class({
{
args[0] = this.list[texture];
callback.apply(thisArg, args);
callback.apply(scope, args);
}
},
/**
* [description]
* Destroys the Texture Manager and all Textures stored within it.
*
* @method Phaser.Textures.TextureManager#destroy
* @since 3.0.0