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}
|
|
|
|
* @module Phaser.RenderTexture
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Description of constructor.
|
|
|
|
* @class Phaser.RenderTexture
|
|
|
|
* @classdesc Description of class.
|
|
|
|
* @constructor
|
|
|
|
* @param {Phaser.Game} game - Current game instance.
|
|
|
|
* @param {string} key - Description.
|
|
|
|
* @param {number} width - Description.
|
|
|
|
* @param {number} height - Description.
|
|
|
|
*/
|
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
|
|
|
/**
|
|
|
|
* @property {Description} name - Description.
|
|
|
|
*/
|
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
|
|
|
/**
|
|
|
|
* @property {number} width - Description.
|
|
|
|
*/
|
2013-09-10 00:26:50 +00:00
|
|
|
this.width = width || 100;
|
2013-10-01 12:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @property {number} height - Description.
|
|
|
|
*/
|
2013-09-10 00:26:50 +00:00
|
|
|
this.height = height || 100;
|
|
|
|
|
2013-10-01 12:54:29 +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
|
|
|
|
* 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;
|