mirror of
https://github.com/photonstorm/phaser
synced 2024-12-25 20:43:26 +00:00
29 lines
803 B
JavaScript
29 lines
803 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2019 Photon Storm Ltd.
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
*/
|
|
|
|
/**
|
|
* Adds an Image Element to a Texture.
|
|
*
|
|
* @function Phaser.Textures.Parsers.Image
|
|
* @memberof Phaser.Textures.Parsers
|
|
* @private
|
|
* @since 3.0.0
|
|
*
|
|
* @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to.
|
|
* @param {integer} sourceIndex - The index of the TextureSource.
|
|
*
|
|
* @return {Phaser.Textures.Texture} The Texture modified by this parser.
|
|
*/
|
|
var Image = function (texture, sourceIndex)
|
|
{
|
|
var source = texture.source[sourceIndex];
|
|
|
|
texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);
|
|
|
|
return texture;
|
|
};
|
|
|
|
module.exports = Image;
|