Skip to content

Commit 956a091

Browse files
committed
Added new jsdocs
1 parent 2180b1f commit 956a091

16 files changed

Lines changed: 232 additions & 217 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Thanks to the following for helping with the Phaser 3 Examples and TypeScript de
3636

3737
The [Phaser Doc Jam](http://docjam.phaser.io) is an on-going effort to ensure that the Phaser 3 API has 100% documentation coverage. Thanks to the monumental effort of myself and the following people we're now really close to that goal! My thanks to:
3838

39-
16patsle - @icbat - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - madclaws - marc136 - Mihail Ilinov - naum303 - Robert Kowalski - rootasjey - scottwestover - stetso - therealsamf - Tigran - willblackmore - zenwaichi
39+
16patsle - @icbat - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - madclaws - marc136 - Mihail Ilinov - naum303 - NicolasRoehm - rejacobson - Robert Kowalski - rootasjey - scottwestover - stetso - therealsamf - Tigran - willblackmore - zenwaichi
4040

4141
If you'd like to help finish off the last parts of documentation then take a look at the [Doc Jam site](http://docjam.phaser.io).
4242

src/geom/rectangle/Equals.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*/
66

77
/**
8-
* [description]
8+
* Compares the `x`, `y`, `width` and `height` properties of two rectangles.
99
*
1010
* @function Phaser.Geom.Rectangle.Equals
1111
* @since 3.0.0
1212
*
13-
* @param {Phaser.Geom.Rectangle} rect - [description]
14-
* @param {Phaser.Geom.Rectangle} toCompare - [description]
13+
* @param {Phaser.Geom.Rectangle} rect - Rectangle A
14+
* @param {Phaser.Geom.Rectangle} toCompare - Rectangle B
1515
*
16-
* @return {boolean} [description]
16+
* @return {boolean} `true` if the rectangles' properties are an exact match, otherwise `false`.
1717
*/
1818
var Equals = function (rect, toCompare)
1919
{

src/geom/rectangle/Inflate.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,22 @@
66

77
var CenterOn = require('./CenterOn');
88

9-
// Increases the size of the Rectangle object by the specified amounts.
10-
// The center point of the Rectangle object stays the same, and its size increases
11-
// to the left and right by the x value, and to the top and the bottom by the y value.
129

1310
/**
14-
* [description]
11+
* Increases the size of a Rectangle by a specified amount.
12+
*
13+
* The center of the Rectangle stays the same. The amounts are added to each side, so the actual increase in width or height is two times bigger than the respective argument.
1514
*
1615
* @function Phaser.Geom.Rectangle.Inflate
1716
* @since 3.0.0
1817
*
1918
* @generic {Phaser.Geom.Rectangle} O - [rect,$return]
2019
*
21-
* @param {Phaser.Geom.Rectangle} rect - [description]
22-
* @param {number} x - [description]
23-
* @param {number} y - [description]
20+
* @param {Phaser.Geom.Rectangle} rect - The Rectangle to inflate.
21+
* @param {number} x - How many pixels the left and the right side should be moved by horizontally.
22+
* @param {number} y - How many pixels the top and the bottom side should be moved by vertically.
2423
*
25-
* @return {Phaser.Geom.Rectangle} [description]
24+
* @return {Phaser.Geom.Rectangle} The inflated Rectangle.
2625
*/
2726
var Inflate = function (rect, x, y)
2827
{

src/geom/triangle/Contains.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
// http://www.blackpawn.com/texts/pointinpoly/
88

99
/**
10-
* [description]
10+
* Checks if a point (as a pair of coordinates) is inside a Triangle's bounds.
1111
*
1212
* @function Phaser.Geom.Triangle.Contains
1313
* @since 3.0.0
1414
*
15-
* @param {Phaser.Geom.Triangle} triangle - [description]
16-
* @param {number} x - [description]
17-
* @param {number} y - [description]
15+
* @param {Phaser.Geom.Triangle} triangle - The Triangle to check.
16+
* @param {number} x - The X coordinate of the point to check.
17+
* @param {number} y - The Y coordinate of the point to check.
1818
*
19-
* @return {boolean} [description]
19+
* @return {boolean} `true` if the point is inside the Triangle, otherwise `false`.
2020
*/
2121
var Contains = function (triangle, x, y)
2222
{

src/geom/triangle/GetPoint.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@
77
var Point = require('../point/Point');
88
var Length = require('../line/Length');
99

10-
// Position is a value between 0 and 1
1110
/**
12-
* [description]
11+
* Returns a Point from around the perimeter of a Triangle.
1312
*
1413
* @function Phaser.Geom.Triangle.GetPoint
1514
* @since 3.0.0
1615
*
1716
* @generic {Phaser.Geom.Point} O - [out,$return]
1817
*
19-
* @param {Phaser.Geom.Triangle} triangle - [description]
20-
* @param {number} position - [description]
21-
* @param {(Phaser.Geom.Point|object)} [out] - [description]
18+
* @param {Phaser.Geom.Triangle} triangle - The Triangle to get the point on its perimeter from.
19+
* @param {number} position - The position along the perimeter of the triangle. A value between 0 and 1.
20+
* @param {(Phaser.Geom.Point|object)} [out] - An option Point, or Point-like object to store the value in. If not given a new Point will be created.
2221
*
23-
* @return {(Phaser.Geom.Point|object)} [description]
22+
* @return {(Phaser.Geom.Point|object)} A Point object containing the given position from the perimeter of the triangle.
2423
*/
2524
var GetPoint = function (triangle, position, out)
2625
{

src/physics/impact/ImpactImage.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var Image = require('../../gameobjects/image/Image');
5050
* @extends Phaser.GameObjects.Components.Transform
5151
* @extends Phaser.GameObjects.Components.Visible
5252
*
53-
* @param {Phaser.Physics.Impact.World} world - [description]
53+
* @param {Phaser.Physics.Impact.World} world - The physics world of the Impact physics system.
5454
* @param {number} x - The horizontal position of this Game Object in the world.
5555
* @param {number} y - The vertical position of this Game Object in the world.
5656
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
@@ -82,7 +82,7 @@ var ImpactImage = new Class({
8282
Image.call(this, world.scene, x, y, texture, frame);
8383

8484
/**
85-
* [description]
85+
* The Physics Body linked to an ImpactImage.
8686
*
8787
* @name Phaser.Physics.Impact.ImpactImage#body
8888
* @type {Phaser.Physics.Impact.Body}
@@ -94,7 +94,7 @@ var ImpactImage = new Class({
9494
this.body.gameObject = this;
9595

9696
/**
97-
* [description]
97+
* The size of the physics Body.
9898
*
9999
* @name Phaser.Physics.Impact.ImpactImage#size
100100
* @type {{x: number, y: number}}
@@ -103,7 +103,7 @@ var ImpactImage = new Class({
103103
this.size = this.body.size;
104104

105105
/**
106-
* [description]
106+
* The X and Y offset of the Body from the left and top of the Image.
107107
*
108108
* @name Phaser.Physics.Impact.ImpactImage#offset
109109
* @type {{x: number, y: number}}
@@ -112,7 +112,7 @@ var ImpactImage = new Class({
112112
this.offset = this.body.offset;
113113

114114
/**
115-
* [description]
115+
* The velocity, or rate of change the Body's position. Measured in pixels per second.
116116
*
117117
* @name Phaser.Physics.Impact.ImpactImage#vel
118118
* @type {{x: number, y: number}}
@@ -121,7 +121,7 @@ var ImpactImage = new Class({
121121
this.vel = this.body.vel;
122122

123123
/**
124-
* [description]
124+
* The acceleration is the rate of change of the velocity. Measured in pixels per second squared.
125125
*
126126
* @name Phaser.Physics.Impact.ImpactImage#accel
127127
* @type {{x: number, y: number}}
@@ -130,7 +130,7 @@ var ImpactImage = new Class({
130130
this.accel = this.body.accel;
131131

132132
/**
133-
* [description]
133+
* Friction between colliding bodies.
134134
*
135135
* @name Phaser.Physics.Impact.ImpactImage#friction
136136
* @type {{x: number, y: number}}
@@ -139,7 +139,7 @@ var ImpactImage = new Class({
139139
this.friction = this.body.friction;
140140

141141
/**
142-
* [description]
142+
* The maximum velocity of the body.
143143
*
144144
* @name Phaser.Physics.Impact.ImpactImage#maxVel
145145
* @type {{x: number, y: number}}

src/physics/matter-js/Factory.js

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ var PointerConstraint = require('./PointerConstraint');
1616

1717
/**
1818
* @classdesc
19-
* [description]
19+
* The Matter Factory can create different types of bodies and them to a physics world.
2020
*
2121
* @class Factory
2222
* @memberof Phaser.Physics.Matter
2323
* @constructor
2424
* @since 3.0.0
2525
*
26-
* @param {Phaser.Physics.Matter.World} world - [description]
26+
* @param {Phaser.Physics.Matter.World} world - The Matter World which this Factory adds to.
2727
*/
2828
var Factory = new Class({
2929

@@ -32,7 +32,7 @@ var Factory = new Class({
3232
function Factory (world)
3333
{
3434
/**
35-
* [description]
35+
* The Matter World which this Factory adds to.
3636
*
3737
* @name Phaser.Physics.Matter.Factory#world
3838
* @type {Phaser.Physics.Matter.World}
@@ -41,7 +41,7 @@ var Factory = new Class({
4141
this.world = world;
4242

4343
/**
44-
* [description]
44+
* The Scene which this Factory's Matter World belongs to.
4545
*
4646
* @name Phaser.Physics.Matter.Factory#scene
4747
* @type {Phaser.Scene}
@@ -60,16 +60,16 @@ var Factory = new Class({
6060
},
6161

6262
/**
63-
* [description]
63+
* Creates a new rigid rectangular Body and adds it to the World.
6464
*
6565
* @method Phaser.Physics.Matter.Factory#rectangle
6666
* @since 3.0.0
6767
*
68-
* @param {number} x - [description]
69-
* @param {number} y - [description]
70-
* @param {number} width - [description]
71-
* @param {number} height - [description]
72-
* @param {object} options - [description]
68+
* @param {number} x - The X coordinate of the center of the Body.
69+
* @param {number} y - The Y coordinate of the center of the Body.
70+
* @param {number} width - The width of the Body.
71+
* @param {number} height - The height of the Body.
72+
* @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
7373
*
7474
* @return {MatterJS.Body} A Matter JS Body.
7575
*/
@@ -83,17 +83,17 @@ var Factory = new Class({
8383
},
8484

8585
/**
86-
* [description]
86+
* Creates a new rigid trapezoidal Body and adds it to the World.
8787
*
8888
* @method Phaser.Physics.Matter.Factory#trapezoid
8989
* @since 3.0.0
9090
*
91-
* @param {number} x - [description]
92-
* @param {number} y - [description]
93-
* @param {number} width - [description]
94-
* @param {number} height - [description]
95-
* @param {number} slope - [description]
96-
* @param {object} options - [description]
91+
* @param {number} x - The X coordinate of the center of the Body.
92+
* @param {number} y - The Y coordinate of the center of the Body.
93+
* @param {number} width - The width of the trapezoid of the Body.
94+
* @param {number} height - The height of the trapezoid of the Body.
95+
* @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
96+
* @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
9797
*
9898
* @return {MatterJS.Body} A Matter JS Body.
9999
*/
@@ -107,16 +107,16 @@ var Factory = new Class({
107107
},
108108

109109
/**
110-
* [description]
110+
* Creates a new rigid circular Body and adds it to the World.
111111
*
112112
* @method Phaser.Physics.Matter.Factory#circle
113113
* @since 3.0.0
114114
*
115-
* @param {number} x - [description]
116-
* @param {number} y - [description]
117-
* @param {number} radius - [description]
118-
* @param {object} options - [description]
119-
* @param {number} maxSides - [description]
115+
* @param {number} x - The X coordinate of the center of the Body.
116+
* @param {number} y - The Y coordinate of the center of the Body.
117+
* @param {number} radius - The radius of the circle.
118+
* @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
119+
* @param {number} maxSides - The maximum amount of sides to use for the polygon which will approximate this circle.
120120
*
121121
* @return {MatterJS.Body} A Matter JS Body.
122122
*/
@@ -130,16 +130,16 @@ var Factory = new Class({
130130
},
131131

132132
/**
133-
* [description]
133+
* Creates a new rigid polygonal Body and adds it to the World.
134134
*
135135
* @method Phaser.Physics.Matter.Factory#polygon
136136
* @since 3.0.0
137137
*
138-
* @param {number} x - [description]
139-
* @param {number} y - [description]
140-
* @param {number} sides - [description]
141-
* @param {number} radius - [description]
142-
* @param {object} options - [description]
138+
* @param {number} x - The X coordinate of the center of the Body.
139+
* @param {number} y - The Y coordinate of the center of the Body.
140+
* @param {number} sides - The number of sides the polygon will have.
141+
* @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.
142+
* @param {object} options - An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
143143
*
144144
* @return {MatterJS.Body} A Matter JS Body.
145145
*/
@@ -153,13 +153,14 @@ var Factory = new Class({
153153
},
154154

155155
/**
156-
* [description]
156+
* Creates a body using the supplied vertices (or an array containing multiple sets of vertices) and adds it to the World.
157+
* If the vertices are convex, they will pass through as supplied. Otherwise, if the vertices are concave, they will be decomposed. Note that this process is not guaranteed to support complex sets of vertices, e.g. ones with holes.
157158
*
158159
* @method Phaser.Physics.Matter.Factory#fromVertices
159160
* @since 3.0.0
160161
*
161-
* @param {number} x - [description]
162-
* @param {number} y - [description]
162+
* @param {number} x - The X coordinate of the center of the Body.
163+
* @param {number} y - The Y coordinate of the center of the Body.
163164
* @param {array} vertexSets - [description]
164165
* @param {object} options - [description]
165166
* @param {boolean} flagInternal - [description]

src/renderer/snapshot/CanvasSnapshot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66

77
/**
8-
* [description]
8+
* Takes a snapshot of the current frame displayed by a 2D canvas.
99
*
1010
* @function Phaser.Renderer.Snapshot.Canvas
1111
* @since 3.0.0
1212
*
13-
* @param {HTMLCanvasElement} canvas - [description]
14-
* @param {string} [type='image/png'] - [description]
15-
* @param {number} [encoderOptions=0.92] - [description]
13+
* @param {HTMLCanvasElement} canvas - The canvas to take a snapshot of.
14+
* @param {string} [type='image/png'] - The format of the returned image.
15+
* @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1, for image formats which use lossy compression (such as `image/jpeg`).
1616
*
1717
* @return {HTMLImageElement} Returns an image of the type specified.
1818
*/

src/renderer/webgl/Utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ module.exports = {
1818
* @since 3.0.0
1919
*
2020
* @param {number} r - Red component in a range from 0.0 to 1.0
21-
* @param {number} g - [description]
22-
* @param {number} b - [description]
21+
* @param {number} g - Green component in a range from 0.0 to 1.0
22+
* @param {number} b - Blue component in a range from 0.0 to 1.0
2323
* @param {number} a - Alpha component in a range from 0.0 to 1.0
2424
*
2525
* @return {number} [description]

0 commit comments

Comments
 (0)