Phaser.RenderTexture = function (game, width, height, key, scaleMode, resolution){ if (typeof key === 'undefined') { key = ''; } if (typeof scaleMode === 'undefined') { scaleMode = Phaser.scaleModes.DEFAULT; } if (typeof resolution === 'undefined') { resolution = 1; } this.game = game; this.key = key; this.type = Phaser.RENDERTEXTURE; this._tempMatrix = new PIXI.Matrix(); PIXI.RenderTexture.call(this, width, height, this.game.renderer, scaleMode, resolution); this.render = Phaser.RenderTexture.prototype.render; } ; Phaser.RenderTexture.prototype = Object.create(PIXI.RenderTexture.prototype); Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture; Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear){ displayObject.updateTransform(); this._tempMatrix.copyFrom(displayObject.worldTransform); this._tempMatrix.tx = x; this._tempMatrix.ty = y; if (this.renderer.type === PIXI.WEBGL_RENDERER) { this.renderWebGL(displayObject, this._tempMatrix, clear); } else { this.renderCanvas(displayObject, this._tempMatrix, clear); } } ; Phaser.RenderTexture.prototype.renderRawXY = function (displayObject, x, y, clear){ this._tempMatrix.identity().translate(x, y); if (this.renderer.type === PIXI.WEBGL_RENDERER) { this.renderWebGL(displayObject, this._tempMatrix, clear); } else { this.renderCanvas(displayObject, this._tempMatrix, clear); } } ; Phaser.RenderTexture.prototype.render = function (displayObject, matrix, clear){ if (typeof matrix === 'undefined' || matrix === null ) { this._tempMatrix.copyFrom(displayObject.worldTransform); } else { this._tempMatrix.copyFrom(matrix); } if (this.renderer.type === PIXI.WEBGL_RENDERER) { this.renderWebGL(displayObject, this._tempMatrix, clear); } else { this.renderCanvas(displayObject, this._tempMatrix, clear); } } ;