phaser/src/gameobjects/RenderTexture.js

70 lines
1.7 KiB
JavaScript
Raw Normal View History

2013-10-01 12:54:29 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2013-10-25 14:42:48 +00:00
* A dynamic initially blank canvas to which images can be drawn
2013-10-01 12:54:29 +00:00
* @class Phaser.RenderTexture
* @constructor
* @param {Phaser.Game} game - Current game instance.
* @param {string} key - Asset key for the render texture.
* @param {number} width - the width of the render texture.
* @param {number} height - the height of the render texture.
2013-10-01 12:54:29 +00:00
*/
Phaser.RenderTexture = function (game, key, width, height) {
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Game} game - A reference to the currently running game.
*/
this.game = game;
2013-10-01 12:54:29 +00:00
/**
* @property {string} name - the name of the object.
2013-10-01 12:54:29 +00:00
*/
this.name = key;
PIXI.EventTarget.call( this );
2013-10-01 12:54:29 +00:00
/**
* @property {number} width - the width.
2013-10-01 12:54:29 +00:00
*/
this.width = width || 100;
2013-10-01 12:54:29 +00:00
/**
* @property {number} height - the height.
2013-10-01 12:54:29 +00:00
*/
this.height = height || 100;
/**
* I know this has a typo in it, but it's because the PIXI.RenderTexture does and we need to pair-up with it
2013-10-01 12:54:29 +00:00
* once they update pixi to fix the typo, we'll fix it here too :)
* @property {Description} indetityMatrix - Description.
*/
this.indetityMatrix = PIXI.mat3.create();
2013-10-01 12:54:29 +00:00
/**
* @property {Description} frame - Description.
*/
this.frame = new PIXI.Rectangle(0, 0, this.width, this.height);
2013-10-01 12:54:29 +00:00
/**
* @property {Description} type - Description.
*/
this.type = Phaser.RENDERTEXTURE;
if (PIXI.gl)
{
this.initWebGL();
}
else
{
this.initCanvas();
}
};
Phaser.RenderTexture.prototype = Phaser.Utils.extend(true, PIXI.RenderTexture.prototype);
Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture;