Skip to content

Commit ae0b3b8

Browse files
committed
Fix types on GameObjects
1 parent b1d8318 commit ae0b3b8

16 files changed

Lines changed: 117 additions & 80 deletions

File tree

src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextCreator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue');
1616
* @property {string} [font=''] - [description]
1717
* @property {string} [text=''] - [description]
1818
* @property {(number|false)} [size=false] - [description]
19-
* @property {string} [align=''] - [description]
19+
* @property {string} [align='left'] - [description]
2020
*/
2121

2222
/**

src/gameobjects/blitter/Blitter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ var Blitter = new Class({
9999
* [description]
100100
*
101101
* @name Phaser.GameObjects.Blitter#renderList
102-
* @type {array}
102+
* @type {Phaser.GameObjects.Blitter.Bob[]}
103103
* @default []
104104
* @since 3.0.0
105105
*/

src/gameobjects/components/BlendMode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var BlendMode = {
3939
* are used.
4040
*
4141
* @name Phaser.GameObjects.Components.BlendMode#blendMode
42-
* @type {(integer|string)}
42+
* @type {(Phaser.BlendModes|string)}
4343
* @since 3.0.0
4444
*/
4545
blendMode: {
@@ -89,7 +89,7 @@ var BlendMode = {
8989
* @method Phaser.GameObjects.Components.BlendMode#setBlendMode
9090
* @since 3.0.0
9191
*
92-
* @param {(string|integer)} value - The BlendMode value. Either a string or a CONST.
92+
* @param {(string|Phaser.BlendModes)} value - The BlendMode value. Either a string or a CONST.
9393
*
9494
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
9595
*/

src/gameobjects/components/GetBounds.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ var GetBounds = {
2424
* @method Phaser.GameObjects.Components.GetBounds#getCenter
2525
* @since 3.0.0
2626
*
27+
* @generic {Phaser.Math.Vector2} O - [output,$return]
28+
*
2729
* @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created.
2830
*
2931
* @return {(Phaser.Math.Vector2|object)} The values stored in the output object.
@@ -44,6 +46,8 @@ var GetBounds = {
4446
* @method Phaser.GameObjects.Components.GetBounds#getTopLeft
4547
* @since 3.0.0
4648
*
49+
* @generic {Phaser.Math.Vector2} O - [output,$return]
50+
*
4751
* @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created.
4852
*
4953
* @return {(Phaser.Math.Vector2|object)} The values stored in the output object.
@@ -69,6 +73,8 @@ var GetBounds = {
6973
* @method Phaser.GameObjects.Components.GetBounds#getTopRight
7074
* @since 3.0.0
7175
*
76+
* @generic {Phaser.Math.Vector2} O - [output,$return]
77+
*
7278
* @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created.
7379
*
7480
* @return {(Phaser.Math.Vector2|object)} The values stored in the output object.
@@ -94,6 +100,8 @@ var GetBounds = {
94100
* @method Phaser.GameObjects.Components.GetBounds#getBottomLeft
95101
* @since 3.0.0
96102
*
103+
* @generic {Phaser.Math.Vector2} O - [output,$return]
104+
*
97105
* @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created.
98106
*
99107
* @return {(Phaser.Math.Vector2|object)} The values stored in the output object.
@@ -119,6 +127,8 @@ var GetBounds = {
119127
* @method Phaser.GameObjects.Components.GetBounds#getBottomRight
120128
* @since 3.0.0
121129
*
130+
* @generic {Phaser.Math.Vector2} O - [output,$return]
131+
*
122132
* @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created.
123133
*
124134
* @return {(Phaser.Math.Vector2|object)} The values stored in the output object.
@@ -145,6 +155,8 @@ var GetBounds = {
145155
* @method Phaser.GameObjects.Components.GetBounds#getBounds
146156
* @since 3.0.0
147157
*
158+
* @generic {Phaser.Math.Vector2} O - [output,$return]
159+
*
148160
* @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. If not provided a new Rectangle will be created.
149161
*
150162
* @return {(Phaser.Geom.Rectangle|object)} The values stored in the output object.

src/gameobjects/components/Origin.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Values are normalized, given in the range 0 to 1.
1010
* Display values contain the calculated pixel values.
1111
* Should be applied as a mixin and not used directly.
12-
*
12+
*
1313
* @name Phaser.GameObjects.Components.Origin
1414
* @since 3.0.0
1515
*/
@@ -18,7 +18,7 @@ var Origin = {
1818

1919
/**
2020
* A property indicating that a Game Object has this component.
21-
*
21+
*
2222
* @name Phaser.GameObjects.Components.Origin#_originComponent
2323
* @type {boolean}
2424
* @private
@@ -32,7 +32,7 @@ var Origin = {
3232
* The origin maps the relationship between the size and position of the Game Object.
3333
* The default value is 0.5, meaning all Game Objects are positioned based on their center.
3434
* Setting the value to 0 means the position now relates to the left of the Game Object.
35-
*
35+
*
3636
* @name Phaser.GameObjects.Components.Origin#originX
3737
* @type {float}
3838
* @default 0.5
@@ -45,7 +45,7 @@ var Origin = {
4545
* The origin maps the relationship between the size and position of the Game Object.
4646
* The default value is 0.5, meaning all Game Objects are positioned based on their center.
4747
* Setting the value to 0 means the position now relates to the top of the Game Object.
48-
*
48+
*
4949
* @name Phaser.GameObjects.Components.Origin#originY
5050
* @type {float}
5151
* @default 0.5
@@ -61,7 +61,7 @@ var Origin = {
6161
* The horizontal display origin of this Game Object.
6262
* The origin is a normalized value between 0 and 1.
6363
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
64-
*
64+
*
6565
* @name Phaser.GameObjects.Components.Origin#displayOriginX
6666
* @type {float}
6767
* @since 3.0.0
@@ -85,7 +85,7 @@ var Origin = {
8585
* The vertical display origin of this Game Object.
8686
* The origin is a normalized value between 0 and 1.
8787
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
88-
*
88+
*
8989
* @name Phaser.GameObjects.Components.Origin#displayOriginY
9090
* @type {float}
9191
* @since 3.0.0
@@ -109,13 +109,13 @@ var Origin = {
109109
* Sets the origin of this Game Object.
110110
*
111111
* The values are given in the range 0 to 1.
112-
*
112+
*
113113
* @method Phaser.GameObjects.Components.Origin#setOrigin
114114
* @since 3.0.0
115115
*
116116
* @param {number} [x=0.5] - The horizontal origin value.
117-
* @param {number} [y=0.5] - The vertical origin value. If not defined it will be set to the value of `x`.
118-
*
117+
* @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`.
118+
*
119119
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
120120
*/
121121
setOrigin: function (x, y)
@@ -131,10 +131,10 @@ var Origin = {
131131

132132
/**
133133
* Sets the origin of this Game Object based on the Pivot values in its Frame.
134-
*
134+
*
135135
* @method Phaser.GameObjects.Components.Origin#setOriginFromFrame
136136
* @since 3.0.0
137-
*
137+
*
138138
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
139139
*/
140140
setOriginFromFrame: function ()
@@ -155,13 +155,13 @@ var Origin = {
155155
/**
156156
* Sets the display origin of this Game Object.
157157
* The difference between this and setting the origin is that you can use pixel values for setting the display origin.
158-
*
158+
*
159159
* @method Phaser.GameObjects.Components.Origin#setDisplayOrigin
160160
* @since 3.0.0
161161
*
162162
* @param {number} [x=0] - The horizontal display origin value.
163-
* @param {number} [y=0] - The vertical display origin value. If not defined it will be set to the value of `x`.
164-
*
163+
* @param {number} [y=x] - The vertical display origin value. If not defined it will be set to the value of `x`.
164+
*
165165
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
166166
*/
167167
setDisplayOrigin: function (x, y)
@@ -178,10 +178,10 @@ var Origin = {
178178
/**
179179
* Updates the Display Origin cached values internally stored on this Game Object.
180180
* You don't usually call this directly, but it is exposed for edge-cases where you may.
181-
*
181+
*
182182
* @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin
183183
* @since 3.0.0
184-
*
184+
*
185185
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
186186
*/
187187
updateDisplayOrigin: function ()

src/gameobjects/components/ScaleMode.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var ScaleModes = require('../../renderer/ScaleModes');
88

99
/**
1010
* Provides methods used for getting and setting the scale of a Game Object.
11-
*
11+
*
1212
* @name Phaser.GameObjects.Components.ScaleMode
1313
* @since 3.0.0
1414
*/
@@ -20,9 +20,9 @@ var ScaleMode = {
2020
/**
2121
* The Scale Mode being used by this Game Object.
2222
* Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`.
23-
*
23+
*
2424
* @name Phaser.GameObjects.Components.ScaleMode#scaleMode
25-
* @type {integer}
25+
* @type {Phaser.ScaleModes}
2626
* @since 3.0.0
2727
*/
2828
scaleMode: {
@@ -45,12 +45,12 @@ var ScaleMode = {
4545
/**
4646
* Sets the Scale Mode being used by this Game Object.
4747
* Can be either `ScaleModes.LINEAR` or `ScaleModes.NEAREST`.
48-
*
48+
*
4949
* @method Phaser.GameObjects.Components.ScaleMode#setScaleMode
5050
* @since 3.0.0
5151
*
52-
* @param {integer} value - The Scale Mode to be used by this Game Object.
53-
*
52+
* @param {Phaser.ScaleModes} value - The Scale Mode to be used by this Game Object.
53+
*
5454
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
5555
*/
5656
setScaleMode: function (value)

src/gameobjects/components/ScrollFactor.js

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

77
/**
88
* Provides methods used for getting and setting the Scroll Factor of a Game Object.
9-
*
9+
*
1010
* @name Phaser.GameObjects.Components.ScrollFactor
1111
* @since 3.0.0
1212
*/
@@ -15,16 +15,16 @@ var ScrollFactor = {
1515

1616
/**
1717
* The horizontal scroll factor of this Game Object.
18-
*
18+
*
1919
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
2020
*
2121
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
2222
* It does not change the Game Objects actual position values.
23-
*
23+
*
2424
* A value of 1 means it will move exactly in sync with a camera.
2525
* A value of 0 means it will not move at all, even if the camera moves.
2626
* Other values control the degree to which the camera movement is mapped to this Game Object.
27-
*
27+
*
2828
* @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX
2929
* @type {number}
3030
* @default 1
@@ -34,16 +34,16 @@ var ScrollFactor = {
3434

3535
/**
3636
* The vertical scroll factor of this Game Object.
37-
*
37+
*
3838
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
3939
*
4040
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
4141
* It does not change the Game Objects actual position values.
42-
*
42+
*
4343
* A value of 1 means it will move exactly in sync with a camera.
4444
* A value of 0 means it will not move at all, even if the camera moves.
4545
* Other values control the degree to which the camera movement is mapped to this Game Object.
46-
*
46+
*
4747
* @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY
4848
* @type {number}
4949
* @default 1
@@ -53,22 +53,22 @@ var ScrollFactor = {
5353

5454
/**
5555
* Sets the scroll factor of this Game Object.
56-
*
56+
*
5757
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
5858
*
5959
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
6060
* It does not change the Game Objects actual position values.
61-
*
61+
*
6262
* A value of 1 means it will move exactly in sync with a camera.
6363
* A value of 0 means it will not move at all, even if the camera moves.
6464
* Other values control the degree to which the camera movement is mapped to this Game Object.
65-
*
65+
*
6666
* @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor
6767
* @since 3.0.0
6868
*
6969
* @param {number} x - The horizontal scroll factor of this Game Object.
70-
* @param {number} [y] - The vertical scroll factor of this Game Object. If not set it will use the `x` value.
71-
*
70+
* @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value.
71+
*
7272
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
7373
*/
7474
setScrollFactor: function (x, y)

src/gameobjects/components/ToJSON.js

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

77
/**
88
* @typedef {object} JSONGameObject
9-
* @template DATA
9+
* @generic {object} DATA - [data]
1010
*
1111
* @property {string} name - The name of this Game Object.
1212
* @property {string} type - A textual representation of this Game Object, i.e. `sprite`.
@@ -27,7 +27,7 @@
2727
* @property {(integer|string)} blendMode - Sets the Blend Mode being used by this Game Object.
2828
* @property {string} textureKey - The texture key of this Game Object.
2929
* @property {string} frameKey - The frame key of this Game Object.
30-
* @property {DATA} data - The data of this Game Object.
30+
* @property {object} data - The data of this Game Object.
3131
*/
3232

3333
// Default Game Object JSON export

src/gameobjects/group/Group.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ var Sprite = require('../sprite/Sprite');
8686
* @since 3.0.0
8787
*
8888
* @param {Phaser.Scene} scene - [description]
89-
* @param {Phaser.GameObjects.GameObject[]} children - [description]
90-
* @param {GroupConfig} config - [description]
89+
* @param {?(Phaser.GameObjects.GameObject[]|GroupConfig)} children - [description]
90+
* @param {GroupConfig} [config] - [description]
9191
*/
9292
var Group = new Class({
9393

src/gameobjects/group/GroupCreator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var Group = require('./Group');
1515
* @method Phaser.GameObjects.GameObjectCreator#group
1616
* @since 3.0.0
1717
*
18-
* @param {object} config - [description]
18+
* @param {GroupConfig} config - [description]
1919
*
2020
* @return {Phaser.GameObjects.Group} The Game Object that was created.
2121
*/

0 commit comments

Comments
 (0)