You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/gameobjects/rendertexture/RenderTextureCanvas.js
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,15 @@
1
1
varRenderTextureCanvas={
2
2
3
+
/**
4
+
* Fills the Render Texture with the given color.
5
+
*
6
+
* @method Phaser.GameObjects.RenderTexture#fill
7
+
* @since 3.2.0
8
+
*
9
+
* @param {number} rgb - The color to fill the Render Texture with.
10
+
*
11
+
* @return {Phaser.GameObjects.RenderTexture} This Game Object.
12
+
*/
3
13
fill: function(rgb)
4
14
{
5
15
varur=((rgb>>16)|0)&0xff;
@@ -12,6 +22,14 @@ var RenderTextureCanvas = {
12
22
returnthis;
13
23
},
14
24
25
+
/**
26
+
* Clears the Render Texture.
27
+
*
28
+
* @method Phaser.GameObjects.RenderTexture#clear
29
+
* @since 3.2.0
30
+
*
31
+
* @return {Phaser.GameObjects.RenderTexture} This Game Object.
32
+
*/
15
33
clear: function()
16
34
{
17
35
this.context.save();
@@ -22,6 +40,19 @@ var RenderTextureCanvas = {
22
40
returnthis;
23
41
},
24
42
43
+
/**
44
+
* Draws the Texture Frame to the Render Texture at the given position.
45
+
*
46
+
* @method Phaser.GameObjects.RenderTexture#draw
47
+
* @since 3.2.0
48
+
*
49
+
* @param {Phaser.Textures.Texture} texture - Currently unused.
50
+
* @param {Phaser.Textures.Frame} frame - The Texture Frame that will be drawn to the Render Texture. Get this from the Texture Manager via `this.textures.getFrame(key)`.
51
+
* @param {number} x - The x position to draw the frame at.
52
+
* @param {number} y - The y position to draw the frame at.
53
+
*
54
+
* @return {Phaser.GameObjects.RenderTexture} This Game Object.
Copy file name to clipboardExpand all lines: src/gameobjects/rendertexture/RenderTextureWebGL.js
+41Lines changed: 41 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,15 @@
1
1
varRenderTextureWebGL={
2
2
3
+
/**
4
+
* Fills the Render Texture with the given color.
5
+
*
6
+
* @method Phaser.GameObjects.RenderTexture#fill
7
+
* @since 3.2.0
8
+
*
9
+
* @param {number} rgb - The color to fill the Render Texture with.
10
+
*
11
+
* @return {Phaser.GameObjects.RenderTexture} This Game Object.
12
+
*/
3
13
fill: function(rgb,alpha)
4
14
{
5
15
if(alpha===undefined){alpha=1;}
@@ -9,23 +19,54 @@ var RenderTextureWebGL = {
9
19
varub=(rgb|0)&0xff;
10
20
11
21
this.renderer.setFramebuffer(this.framebuffer);
22
+
12
23
vargl=this.gl;
24
+
13
25
gl.clearColor(ur/255.0,ug/255.0,ub/255.0,alpha);
26
+
14
27
gl.clear(gl.COLOR_BUFFER_BIT);
28
+
15
29
this.renderer.setFramebuffer(null);
30
+
16
31
returnthis;
17
32
},
18
33
34
+
/**
35
+
* Clears the Render Texture.
36
+
*
37
+
* @method Phaser.GameObjects.RenderTexture#clear
38
+
* @since 3.2.0
39
+
*
40
+
* @return {Phaser.GameObjects.RenderTexture} This Game Object.
41
+
*/
19
42
clear: function()
20
43
{
21
44
this.renderer.setFramebuffer(this.framebuffer);
45
+
22
46
vargl=this.gl;
47
+
23
48
gl.clearColor(0,0,0,0);
49
+
24
50
gl.clear(gl.COLOR_BUFFER_BIT);
51
+
25
52
this.renderer.setFramebuffer(null);
53
+
26
54
returnthis;
27
55
},
28
56
57
+
/**
58
+
* Draws the Texture Frame to the Render Texture at the given position.
59
+
*
60
+
* @method Phaser.GameObjects.RenderTexture#draw
61
+
* @since 3.2.0
62
+
*
63
+
* @param {Phaser.Textures.Texture} texture - Currently unused.
64
+
* @param {Phaser.Textures.Frame} frame - The Texture Frame that will be drawn to the Render Texture. Get this from the Texture Manager via `this.textures.getFrame(key)`.
65
+
* @param {number} x - The x position to draw the frame at.
66
+
* @param {number} y - The y position to draw the frame at.
67
+
*
68
+
* @return {Phaser.GameObjects.RenderTexture} This Game Object.
0 commit comments