mirror of
https://github.com/photonstorm/phaser
synced 2024-12-26 21:13:41 +00:00
26 lines
790 B
JavaScript
26 lines
790 B
JavaScript
|
/**
|
||
|
* @author Richard Davey <rich@photonstorm.com>
|
||
|
* @copyright 2016 Photon Storm Ltd.
|
||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Parse a Sprite Sheet and extracts the frame data from it.
|
||
|
*
|
||
|
* @class Phaser.TextureParser.Image
|
||
|
* @static
|
||
|
* @param {Phaser.Texture} texture - The parent Texture.
|
||
|
* @param {string} key - The key of the Frame within the Texture that the Sprite Sheet is stored in.
|
||
|
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||
|
*/
|
||
|
var ImageTextureParser = function (texture, sourceIndex)
|
||
|
{
|
||
|
var source = texture.source[sourceIndex];
|
||
|
|
||
|
texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);
|
||
|
|
||
|
return texture;
|
||
|
};
|
||
|
|
||
|
module.exports = ImageTextureParser;
|