Skip to content

Commit 950a125

Browse files
committed
Added jsdocs
1 parent 35b1cce commit 950a125

12 files changed

Lines changed: 415 additions & 152 deletions

File tree

src/gameobjects/GameObject.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ var GameObject = new Class({
3030
* The Scene to which this Game Object belongs.
3131
* Game Objects can only belong to one Scene.
3232
*
33-
* @property {Phaser.Scene} scene
34-
* @alias Phaser.GameObjects.GameObject#scene
33+
* @name Phaser.GameObjects.GameObject#scene
34+
* @type {Phaser.Scene}
3535
* @protected
3636
* @since 3.0.0
3737
*/
@@ -41,8 +41,8 @@ var GameObject = new Class({
4141
* A textual representation of this Game Object, i.e. `sprite`.
4242
* Used internally by Phaser but is available for your own custom classes to populate.
4343
*
44-
* @property {string} type
45-
* @alias Phaser.GameObjects.GameObject#type
44+
* @name Phaser.GameObjects.GameObject#type
45+
* @type {string}
4646
* @since 3.0.0
4747
*/
4848
this.type = type;
@@ -51,8 +51,9 @@ var GameObject = new Class({
5151
* The name of this Game Object.
5252
* Empty by default and never populated by Phaser, this is left for developers to use.
5353
*
54-
* @property {string} [name='']
55-
* @alias Phaser.GameObjects.GameObject#name
54+
* @name Phaser.GameObjects.GameObject#name
55+
* @type {string}
56+
* @default ''
5657
* @since 3.0.0
5758
*/
5859
this.name = '';
@@ -62,8 +63,9 @@ var GameObject = new Class({
6263
* A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it.
6364
* An active object is one which is having its logic and internal systems updated.
6465
*
65-
* @property {boolean} [active=true]
66-
* @alias Phaser.GameObjects.GameObject#active
66+
* @name Phaser.GameObjects.GameObject#active
67+
* @type {boolean}
68+
* @default true
6769
* @since 3.0.0
6870
*/
6971
this.active = true;
@@ -72,8 +74,9 @@ var GameObject = new Class({
7274
* The Tab Index of the Game Object.
7375
* Reserved for future use by plugins and the Input Manager.
7476
*
75-
* @property {integer} [tabIndex=-1]
76-
* @alias Phaser.GameObjects.GameObject#tabIndex
77+
* @name Phaser.GameObjects.GameObject#tabIndex
78+
* @type {integer}
79+
* @default -1
7780
* @since 3.0.0
7881
*/
7982
this.tabIndex = -1;
@@ -83,8 +86,9 @@ var GameObject = new Class({
8386
* It allows you to store, query and get key/value paired information specific to this Game Object.
8487
* `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`.
8588
*
86-
* @property {Phaser.Data.DataManager} data
87-
* @alias Phaser.GameObjects.GameObject#data
89+
* @name Phaser.GameObjects.GameObject#data
90+
* @type {Phaser.Data.DataManager}
91+
* @default null
8892
* @since 3.0.0
8993
*/
9094
this.data = null;
@@ -94,8 +98,9 @@ var GameObject = new Class({
9498
* The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively.
9599
* If those components are not used by your custom class then you can use this bitmask as you wish.
96100
*
97-
* @property {integer} [renderFlags=15]
98-
* @alias Phaser.GameObjects.GameObject#renderFlags
101+
* @name Phaser.GameObjects.GameObject#renderFlags
102+
* @type {integer}
103+
* @default 15
99104
* @since 3.0.0
100105
*/
101106
this.renderFlags = 15;
@@ -104,8 +109,9 @@ var GameObject = new Class({
104109
* A bitmask that controls if this Game Object is drawn by a Camera or not.
105110
* Not usually set directly. Instead call `Camera.ignore`.
106111
*
107-
* @property {number} [cameraFilter=0]
108-
* @alias Phaser.GameObjects.GameObject#cameraFilter
112+
* @name Phaser.GameObjects.GameObject#cameraFilter
113+
* @type {number}
114+
* @default 0
109115
* @since 3.0.0
110116
*/
111117
this.cameraFilter = 0;
@@ -114,17 +120,19 @@ var GameObject = new Class({
114120
* If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
115121
* Not usually set directly. Instead call `GameObject.setInteractive()`.
116122
*
117-
* @property {?Phaser.Input.InteractiveObject} [input=null]
118-
* @alias Phaser.GameObjects.GameObject#input
123+
* @name Phaser.GameObjects.GameObject#input
124+
* @type {?Phaser.Input.InteractiveObject}
125+
* @default null
119126
* @since 3.0.0
120127
*/
121128
this.input = null;
122129

123130
/**
124131
* If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.
125132
*
126-
* @property {?Phaser.Physics.Body} [body=null]
127-
* @alias Phaser.GameObjects.GameObject#body
133+
* @name Phaser.GameObjects.GameObject#body
134+
* @type {?Phaser.Physics.Body}
135+
* @default null
128136
* @since 3.0.0
129137
*/
130138
this.body = null;

src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var Class = require('../../../utils/Class');
2-
var GameObject = require('../../GameObject');
32
var Components = require('../../components');
4-
var Render = require('./DynamicBitmapTextRender');
3+
var GameObject = require('../../GameObject');
54
var GetBitmapTextSize = require('../GetBitmapTextSize');
5+
var Render = require('./DynamicBitmapTextRender');
66

77
var DynamicBitmapText = new Class({
88

src/gameobjects/blitter/Blitter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ var GameObject = require('../GameObject');
2020
* @constructor
2121
* @since 3.0.0
2222
*
23-
* @mixes Phaser.GameObjects.Components.Alpha
23+
* Mixins:
24+
* @extends Phaser.GameObjects.Components.Alpha
2425
*
2526
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
2627
* @param {number} [x==] - The x coordinate of this Game Object in world space.
2728
* @param {number} [y=0] - The y coordinate of this Game Object in world space.
2829
* @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager.
2930
* @param {string|integer} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet.
3031
*/
31-
3232
var Blitter = new Class({
3333

3434
Extends: GameObject,
@@ -59,17 +59,17 @@ var Blitter = new Class({
5959
/**
6060
* [description]
6161
*
62-
* @property {Phaser.GameObjects.DisplayList} children
63-
* @alias Phaser.GameObjects.Blitter#children
62+
* @name Phaser.GameObjects.Blitter#children
63+
* @type {Phaser.GameObjects.DisplayList}
6464
* @since 3.0.0
6565
*/
6666
this.children = new DisplayList();
6767

6868
/**
6969
* [description]
7070
*
71-
* @property {array} renderList
72-
* @alias Phaser.GameObjects.Blitter#renderList
71+
* @name Phaser.GameObjects.Blitter#renderList
72+
* @type {array}
7373
* @default []
7474
* @since 3.0.0
7575
*/

src/gameobjects/components/Alpha.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var Alpha = {
2222
_alphaBR: 1,
2323

2424
/**
25-
* [description]
25+
* Clears all alpha values associated with this Game Object.
26+
* Immediately sets the alpha levels back to 1 (fully opaque)
2627
*
2728
* @method Phaser.GameObjects.Components.Alpha.clearAlpha
2829
* @since 3.0.0
@@ -35,15 +36,19 @@ var Alpha = {
3536
},
3637

3738
/**
38-
* [description]
39+
* Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders.
40+
* Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
41+
*
42+
* If your game is running under WebGL you can optionally specify four different alpha values, each of which
43+
* correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used.
3944
*
4045
* @method Phaser.GameObjects.Components.Alpha.setAlpha
4146
* @since 3.0.0
4247
*
4348
* @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object.
44-
* @param {float} [topRight] - The alpha value used for the top-right of the Game Object.
45-
* @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object.
46-
* @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object.
49+
* @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only.
50+
* @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only.
51+
* @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only.
4752
*
4853
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
4954
*/
@@ -71,7 +76,7 @@ var Alpha = {
7176
* [description]
7277
*
7378
* @name Phaser.GameObjects.Components.Alpha#alpha
74-
* @property {float} alpha
79+
* @type {float}
7580
* @since 3.0.0
7681
*/
7782
alpha: {
@@ -107,7 +112,7 @@ var Alpha = {
107112
* [description]
108113
*
109114
* @name Phaser.GameObjects.Components.Alpha#alphaTopLeft
110-
* @property {float} alphaTopLeft
115+
* @type {float}
111116
* @webglOnly
112117
* @since 3.0.0
113118
*/
@@ -136,7 +141,7 @@ var Alpha = {
136141
* [description]
137142
*
138143
* @name Phaser.GameObjects.Components.Alpha#alphaTopRight
139-
* @property {float} alphaTopRight
144+
* @type {float}
140145
* @webglOnly
141146
* @since 3.0.0
142147
*/
@@ -165,7 +170,7 @@ var Alpha = {
165170
* [description]
166171
*
167172
* @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft
168-
* @property {float} alphaBottomLeft
173+
* @type {float}
169174
* @webglOnly
170175
* @since 3.0.0
171176
*/
@@ -194,7 +199,7 @@ var Alpha = {
194199
* [description]
195200
*
196201
* @name Phaser.GameObjects.Components.Alpha#alphaBottomRight
197-
* @property {float} alphaBottomRight
202+
* @type {float}
198203
* @webglOnly
199204
* @since 3.0.0
200205
*/

src/gameobjects/components/BlendMode.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
var BlendModes = require('../../renderer/BlendModes');
22

3-
// BlendMode Component
3+
/**
4+
* Provides methods used for setting the blend mode of a Game Object.
5+
* Should be applied as a mixin and not used directly.
6+
*
7+
* @name Phaser.GameObjects.Components.BlendMode
8+
* @mixin
9+
* @since 3.0.0
10+
*/
411

512
var BlendMode = {
613

714
_blendMode: BlendModes.NORMAL,
815

16+
/**
17+
* [description]
18+
*
19+
* @name Phaser.GameObjects.Components.BlendMode#blendMode
20+
* @type {integer|string}
21+
* @since 3.0.0
22+
*/
923
blendMode: {
1024

1125
get: function ()
@@ -30,7 +44,28 @@ var BlendMode = {
3044

3145
},
3246

33-
// const or string
47+
/**
48+
* Sets the Blend Mode being used by this Game Object.
49+
*
50+
* This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay)
51+
*
52+
* Under WebGL only the following Blend Modes are available:
53+
*
54+
* * ADD
55+
* * MULTIPLY
56+
* * SCREEN
57+
*
58+
* Canvas has more available depending on browser support.
59+
*
60+
* You can also create your own custom Blend Modes in WebGL.
61+
*
62+
* @method Phaser.GameObjects.Components.BlendMode.setBlendMode
63+
* @since 3.0.0
64+
*
65+
* @param {string|integer} value - The BlendMode value. Either a string or a CONST.
66+
*
67+
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
68+
*/
3469
setBlendMode: function (value)
3570
{
3671
this.blendMode = value;

src/gameobjects/components/ComputedSize.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
1+
/**
2+
* Provides methods used for setting the blend mode of a Game Object.
3+
* Should be applied as a mixin and not used directly.
4+
*
5+
* @name Phaser.GameObjects.Components.ComputedSize
6+
* @mixin
7+
* @since 3.0.0
8+
*/
9+
110
var ComputedSize = {
211

12+
/**
13+
* The native (un-scaled) width of this Game Object.
14+
*
15+
* @name Phaser.GameObjects.Components.ComputedSize#width
16+
* @type {number}
17+
* @since 3.0.0
18+
*/
319
width: 0,
20+
21+
/**
22+
* The native (un-scaled) height of this Game Object.
23+
*
24+
* @name Phaser.GameObjects.Components.ComputedSize#height
25+
* @type {number}
26+
* @since 3.0.0
27+
*/
428
height: 0,
529

30+
/**
31+
* The displayed width of this Game Object.
32+
* This value takes into account the scale factor.
33+
*
34+
* @name Phaser.GameObjects.Components.ComputedSize#displayWidth
35+
* @type {number}
36+
* @since 3.0.0
37+
*/
638
displayWidth: {
739

840
get: function ()
@@ -17,6 +49,14 @@ var ComputedSize = {
1749

1850
},
1951

52+
/**
53+
* The displayed height of this Game Object.
54+
* This value takes into account the scale factor.
55+
*
56+
* @name Phaser.GameObjects.Components.ComputedSize#displayHeight
57+
* @type {number}
58+
* @since 3.0.0
59+
*/
2060
displayHeight: {
2161

2262
get: function ()

0 commit comments

Comments
 (0)