mirror of
https://github.com/photonstorm/phaser
synced 2025-01-12 05:08:54 +00:00
21 lines
555 B
JavaScript
21 lines
555 B
JavaScript
/**
|
|
* Adds a Canvas Element to a Texture.
|
|
*
|
|
* @function Phaser.Textures.Parsers.Canvas
|
|
* @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 Canvas = function (texture, sourceIndex)
|
|
{
|
|
var source = texture.source[sourceIndex];
|
|
|
|
texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);
|
|
|
|
return texture;
|
|
};
|
|
|
|
module.exports = Canvas;
|