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.
|
2013-10-25 14:22:45 +00:00
|
|
|
* @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
|
|
|
*/
|
2013-09-11 01:57:36 +00:00
|
|
|
Phaser.RenderTexture = function (game, key, width, height) {
|
2013-09-10 00:26:50 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {Phaser.Game} game - A reference to the currently running game.
|
|
|
|
*/
|
2013-09-10 00:26:50 +00:00
|
|
|
this.game = game;
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-10-25 14:22:45 +00:00
|
|
|
* @property {string} name - the name of the object.
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
2013-09-11 01:57:36 +00:00
|
|
|
this.name = key;
|
|
|
|
|
2013-09-10 00:26:50 +00:00
|
|
|
PIXI.EventTarget.call( this );
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-10-25 14:22:45 +00:00
|
|
|
* @property {number} width - the width.
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
2013-09-10 00:26:50 +00:00
|
|
|
this.width = width || 100;
|
2013-10-01 12:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2013-10-25 14:22:45 +00:00
|
|
|
* @property {number} height - the height.
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
2013-09-10 00:26:50 +00:00
|
|
|
this.height = height || 100;
|
|
|
|
|
2013-10-11 03:42:11 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2013-09-19 12:33:51 +00:00
|
|
|
this.indetityMatrix = PIXI.mat3.create();
|
2013-09-10 00:26:50 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {Description} frame - Description.
|
|
|
|
*/
|
2013-09-10 00:26:50 +00:00
|
|
|
this.frame = new PIXI.Rectangle(0, 0, this.width, this.height);
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {Description} type - Description.
|
|
|
|
*/
|
2013-09-12 20:54:41 +00:00
|
|
|
this.type = Phaser.RENDERTEXTURE;
|
|
|
|
|
2013-09-10 00:26:50 +00:00
|
|
|
if (PIXI.gl)
|
|
|
|
{
|
|
|
|
this.initWebGL();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.initCanvas();
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Phaser.RenderTexture.prototype = Phaser.Utils.extend(true, PIXI.RenderTexture.prototype);
|
|
|
|
Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture;
|