mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
The RenderTexture now uses the ComputedSize component instead of Size (which requires a frame), allowing calls to getBounds to work. Fix #3451
This commit is contained in:
parent
574221d6cf
commit
2cd7da0126
2 changed files with 32 additions and 3 deletions
|
@ -11,6 +11,7 @@ being passed to the simulation. The default value is 1 to remain consistent with
|
|||
### Bug Fixes
|
||||
|
||||
* In the WebGL Render Texture the tint of the texture was always set to 0xffffff and therefore the alpha values were ignored. The tint is now calculated using the alpha value. Fix #3385 (thanks @ger1995)
|
||||
* The RenderTexture now uses the ComputedSize component instead of Size (which requires a frame), allowing calls to getBounds to work. Fix #3451 (thanks @kuoruan)
|
||||
|
||||
### Updates
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ var RenderTextureWebGL = require('./RenderTextureWebGL');
|
|||
* @extends Phaser.GameObjects.Components.Pipeline
|
||||
* @extends Phaser.GameObjects.Components.ScaleMode
|
||||
* @extends Phaser.GameObjects.Components.ScrollFactor
|
||||
* @extends Phaser.GameObjects.Components.Size
|
||||
* @extends Phaser.GameObjects.Components.ComputedSize
|
||||
* @extends Phaser.GameObjects.Components.Tint
|
||||
* @extends Phaser.GameObjects.Components.Transform
|
||||
* @extends Phaser.GameObjects.Components.Visible
|
||||
|
@ -51,6 +51,7 @@ var RenderTexture = new Class({
|
|||
Mixins: [
|
||||
Components.Alpha,
|
||||
Components.BlendMode,
|
||||
Components.ComputedSize,
|
||||
Components.Depth,
|
||||
Components.Flip,
|
||||
Components.GetBounds,
|
||||
|
@ -59,7 +60,6 @@ var RenderTexture = new Class({
|
|||
Components.Pipeline,
|
||||
Components.ScaleMode,
|
||||
Components.ScrollFactor,
|
||||
Components.Size,
|
||||
Components.Tint,
|
||||
Components.Transform,
|
||||
Components.Visible,
|
||||
|
@ -77,13 +77,39 @@ var RenderTexture = new Class({
|
|||
|
||||
this.initMatrixStack();
|
||||
|
||||
/**
|
||||
* A reference to either the Canvas or WebGL Renderer that the Game instance is using.
|
||||
*
|
||||
* @name Phaser.GameObjects.RenderTexture#renderer
|
||||
* @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)}
|
||||
* @since 3.2.0
|
||||
*/
|
||||
this.renderer = scene.sys.game.renderer;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.RenderTexture#globalTint
|
||||
* @type {number}
|
||||
* @default 0xffffff
|
||||
* @since 3.2.0
|
||||
*/
|
||||
this.globalTint = 0xffffff;
|
||||
this.globalAlpha = 1.0;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.GameObjects.RenderTexture#globalAlpha
|
||||
* @type {float}
|
||||
* @default 1
|
||||
* @since 3.2.0
|
||||
*/
|
||||
this.globalAlpha = 1;
|
||||
|
||||
if (this.renderer.type === CONST.WEBGL)
|
||||
{
|
||||
var gl = this.renderer.gl;
|
||||
|
||||
this.gl = gl;
|
||||
this.fill = RenderTextureWebGL.fill;
|
||||
this.clear = RenderTextureWebGL.clear;
|
||||
|
@ -137,6 +163,7 @@ var RenderTexture = new Class({
|
|||
setGlobalTint: function (tint)
|
||||
{
|
||||
this.globalTint = tint;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -153,6 +180,7 @@ var RenderTexture = new Class({
|
|||
setGlobalAlpha: function (alpha)
|
||||
{
|
||||
this.globalAlpha = alpha;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue