mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Textures typedefs
This commit is contained in:
parent
0db663d901
commit
ccf677dfa6
6 changed files with 47 additions and 38 deletions
|
@ -405,17 +405,6 @@ var CanvasTexture = new Class({
|
||||||
return out;
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing the position and color data for a single pixel in a CanvasTexture.
|
|
||||||
*
|
|
||||||
* @typedef {object} PixelConfig
|
|
||||||
*
|
|
||||||
* @property {integer} x - The x-coordinate of the pixel.
|
|
||||||
* @property {integer} y - The y-coordinate of the pixel.
|
|
||||||
* @property {integer} color - The color of the pixel, not including the alpha channel.
|
|
||||||
* @property {number} alpha - The alpha of the pixel, between 0 and 1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array containing all of the pixels in the given region.
|
* Returns an array containing all of the pixels in the given region.
|
||||||
*
|
*
|
||||||
|
@ -433,7 +422,7 @@ var CanvasTexture = new Class({
|
||||||
* @param {integer} width - The width of the region to get. Must be an integer.
|
* @param {integer} width - The width of the region to get. Must be an integer.
|
||||||
* @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`.
|
* @param {integer} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`.
|
||||||
*
|
*
|
||||||
* @return {PixelConfig[]} An array of Pixel objects.
|
* @return {Phaser.Textures.Types.PixelConfig[]} An array of Pixel objects.
|
||||||
*/
|
*/
|
||||||
getPixels: function (x, y, width, height)
|
getPixels: function (x, y, width, height)
|
||||||
{
|
{
|
||||||
|
|
|
@ -677,17 +677,6 @@ var TextureManager = new Class({
|
||||||
return texture;
|
return texture;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} SpriteSheetConfig
|
|
||||||
*
|
|
||||||
* @property {integer} frameWidth - The fixed width of each frame.
|
|
||||||
* @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
|
|
||||||
* @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
|
|
||||||
* @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
|
|
||||||
* @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
|
||||||
* @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Sprite Sheet to this Texture Manager.
|
* Adds a Sprite Sheet to this Texture Manager.
|
||||||
*
|
*
|
||||||
|
@ -700,7 +689,7 @@ var TextureManager = new Class({
|
||||||
*
|
*
|
||||||
* @param {string} key - The unique string-based key of the Texture.
|
* @param {string} key - The unique string-based key of the Texture.
|
||||||
* @param {HTMLImageElement} source - The source Image element.
|
* @param {HTMLImageElement} source - The source Image element.
|
||||||
* @param {SpriteSheetConfig} config - The configuration object for this Sprite Sheet.
|
* @param {Phaser.Textures.Types.SpriteSheetConfig} config - The configuration object for this Sprite Sheet.
|
||||||
*
|
*
|
||||||
* @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use.
|
* @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use.
|
||||||
*/
|
*/
|
||||||
|
@ -723,19 +712,6 @@ var TextureManager = new Class({
|
||||||
return texture;
|
return texture;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} SpriteSheetFromAtlasConfig
|
|
||||||
*
|
|
||||||
* @property {string} atlas - The key of the Texture Atlas in which this Sprite Sheet can be found.
|
|
||||||
* @property {string} frame - The key of the Texture Atlas Frame in which this Sprite Sheet can be found.
|
|
||||||
* @property {integer} frameWidth - The fixed width of each frame.
|
|
||||||
* @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
|
|
||||||
* @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
|
|
||||||
* @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
|
|
||||||
* @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
|
||||||
* @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas.
|
* Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas.
|
||||||
*
|
*
|
||||||
|
@ -747,7 +723,7 @@ var TextureManager = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} key - The unique string-based key of the Texture.
|
* @param {string} key - The unique string-based key of the Texture.
|
||||||
* @param {SpriteSheetFromAtlasConfig} config - The configuration object for this Sprite Sheet.
|
* @param {Phaser.Textures.Types.SpriteSheetFromAtlasConfig} config - The configuration object for this Sprite Sheet.
|
||||||
*
|
*
|
||||||
* @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use.
|
* @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use.
|
||||||
*/
|
*/
|
||||||
|
|
11
src/textures/typedefs/PixelConfig.js
Normal file
11
src/textures/typedefs/PixelConfig.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/**
|
||||||
|
* An object containing the position and color data for a single pixel in a CanvasTexture.
|
||||||
|
*
|
||||||
|
* @typedef {object} Phaser.Textures.Types.PixelConfig
|
||||||
|
* @since 3.16.0
|
||||||
|
*
|
||||||
|
* @property {integer} x - The x-coordinate of the pixel.
|
||||||
|
* @property {integer} y - The y-coordinate of the pixel.
|
||||||
|
* @property {integer} color - The color of the pixel, not including the alpha channel.
|
||||||
|
* @property {number} alpha - The alpha of the pixel, between 0 and 1.
|
||||||
|
*/
|
11
src/textures/typedefs/SpriteSheetConfig.js
Normal file
11
src/textures/typedefs/SpriteSheetConfig.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/**
|
||||||
|
* @typedef {object} Phaser.Textures.Types.SpriteSheetConfig
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @property {integer} frameWidth - The fixed width of each frame.
|
||||||
|
* @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
|
||||||
|
* @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
|
||||||
|
* @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
|
||||||
|
* @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
||||||
|
* @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
||||||
|
*/
|
13
src/textures/typedefs/SpriteSheetFromAtlasConfig.js
Normal file
13
src/textures/typedefs/SpriteSheetFromAtlasConfig.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
/**
|
||||||
|
* @typedef {object} Phaser.Textures.Types.SpriteSheetFromAtlasConfig
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @property {string} atlas - The key of the Texture Atlas in which this Sprite Sheet can be found.
|
||||||
|
* @property {string} frame - The key of the Texture Atlas Frame in which this Sprite Sheet can be found.
|
||||||
|
* @property {integer} frameWidth - The fixed width of each frame.
|
||||||
|
* @property {integer} [frameHeight] - The fixed height of each frame. If not set it will use the frameWidth as the height.
|
||||||
|
* @property {integer} [startFrame=0] - Skip a number of frames. Useful when there are multiple sprite sheets in one Texture.
|
||||||
|
* @property {integer} [endFrame=-1] - The total number of frames to extract from the Sprite Sheet. The default value of -1 means "extract all frames".
|
||||||
|
* @property {integer} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
||||||
|
* @property {integer} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
||||||
|
*/
|
9
src/textures/typedefs/index.js
Normal file
9
src/textures/typedefs/index.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2019 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @namespace Phaser.Textures.Types
|
||||||
|
*/
|
Loading…
Reference in a new issue