Skip to content

Commit 8cb812b

Browse files
committed
Merged jsdocs (re: phaserjs#3823)
1 parent 84ae027 commit 8cb812b

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

src/gameobjects/rendertexture/RenderTextureCanvas.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
var RenderTextureCanvas = {
22

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+
*/
313
fill: function (rgb)
414
{
515
var ur = ((rgb >> 16)|0) & 0xff;
@@ -12,6 +22,14 @@ var RenderTextureCanvas = {
1222
return this;
1323
},
1424

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+
*/
1533
clear: function ()
1634
{
1735
this.context.save();
@@ -22,6 +40,19 @@ var RenderTextureCanvas = {
2240
return this;
2341
},
2442

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.
55+
*/
2556
draw: function (texture, frame, x, y)
2657
{
2758
var cd = frame.canvasData;

src/gameobjects/rendertexture/RenderTextureWebGL.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
var RenderTextureWebGL = {
22

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+
*/
313
fill: function (rgb, alpha)
414
{
515
if (alpha === undefined) { alpha = 1; }
@@ -9,23 +19,54 @@ var RenderTextureWebGL = {
919
var ub = (rgb|0) & 0xff;
1020

1121
this.renderer.setFramebuffer(this.framebuffer);
22+
1223
var gl = this.gl;
24+
1325
gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, alpha);
26+
1427
gl.clear(gl.COLOR_BUFFER_BIT);
28+
1529
this.renderer.setFramebuffer(null);
30+
1631
return this;
1732
},
1833

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+
*/
1942
clear: function ()
2043
{
2144
this.renderer.setFramebuffer(this.framebuffer);
45+
2246
var gl = this.gl;
47+
2348
gl.clearColor(0, 0, 0, 0);
49+
2450
gl.clear(gl.COLOR_BUFFER_BIT);
51+
2552
this.renderer.setFramebuffer(null);
53+
2654
return this;
2755
},
2856

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.
69+
*/
2970
draw: function (texture, frame, x, y, tint)
3071
{
3172
if (tint === undefined)

0 commit comments

Comments
 (0)