Skip to content

Commit 99913b9

Browse files
committed
More jsdoc updates
1 parent 9e8ee07 commit 99913b9

6 files changed

Lines changed: 313 additions & 39 deletions

File tree

src/gameobjects/GameObjectFactory.js

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
11
var Class = require('../utils/Class');
22
var PluginManager = require('../plugins/PluginManager');
33

4+
/**
5+
* [description]
6+
*
7+
* @class GameObjectFactory
8+
* @memberOf Phaser.GameObjects
9+
* @constructor
10+
* @since 3.0.0
11+
*
12+
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
13+
*/
414
var GameObjectFactory = new Class({
515

616
initialize:
717

818
function GameObjectFactory (scene)
919
{
10-
// The Scene that owns this plugin
20+
/**
21+
* The Scene to which this Game Object belongs.
22+
* Game Objects can only belong to one Scene.
23+
*
24+
* @name Phaser.GameObjects.GameObjectFactory#scene
25+
* @type {Phaser.Scene}
26+
* @protected
27+
* @since 3.0.0
28+
*/
1129
this.scene = scene;
1230

31+
/**
32+
* A reference to the Scene.Systems.
33+
*
34+
* @name Phaser.GameObjects.GameObjectFactory#systems
35+
* @type {Phaser.Scenes.Systems}
36+
* @protected
37+
* @since 3.0.0
38+
*/
1339
this.systems = scene.sys;
1440

1541
if (!scene.sys.settings.isBooted)
@@ -18,9 +44,17 @@ var GameObjectFactory = new Class({
1844
}
1945

2046
this.displayList;
47+
2148
this.updateList;
2249
},
2350

51+
/**
52+
* Boots the plugin.
53+
*
54+
* @method Phaser.GameObjects.GameObjectFactory#boot
55+
* @private
56+
* @since 3.0.0
57+
*/
2458
boot: function ()
2559
{
2660
this.displayList = this.systems.displayList;
@@ -32,6 +66,19 @@ var GameObjectFactory = new Class({
3266
eventEmitter.on('destroy', this.destroy, this);
3367
},
3468

69+
/**
70+
* Adds an existing Game Object to this Scene.
71+
*
72+
* If the Game Object renders, it will be added to the Display List.
73+
* If it has a `preUpdate` method, it will be added to the Update List.
74+
*
75+
* @method Phaser.GameObjects.GameObjectFactory#existing
76+
* @since 3.0.0
77+
*
78+
* @param {Phaser.GameObjects.GameObject} child - The child to be added to this Scene.
79+
*
80+
* @return {Phaser.GameObjects.GameObject} The Game Object that was added.
81+
*/
3582
existing: function (child)
3683
{
3784
if (child.renderCanvas || child.renderWebGL)
@@ -47,11 +94,22 @@ var GameObjectFactory = new Class({
4794
return child;
4895
},
4996

97+
/**
98+
* Shuts this plugin down.
99+
*
100+
* @method Phaser.GameObjects.GameObjectFactory#shutdown
101+
* @since 3.0.0
102+
*/
50103
shutdown: function ()
51104
{
52-
// TODO
53105
},
54106

107+
/**
108+
* Destroys this plugin.
109+
*
110+
* @method Phaser.GameObjects.GameObjectFactory#destroy
111+
* @since 3.0.0
112+
*/
55113
destroy: function ()
56114
{
57115
this.scene = null;

src/gameobjects/blitter/Blitter.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,18 @@ var Blitter = new Class({
125125
return bob;
126126
},
127127

128-
// frame MUST be part of the Blitter texture
129128
/**
130129
* [description]
131130
*
132131
* @method Phaser.GameObjects.Blitter#createFromCallback
133132
* @since 3.0.0
134133
*
135-
* @param {[type]} callback - [description]
136-
* @param {[type]} quantity - [description]
137-
* @param {[type]} frame - [description]
138-
* @param {[type]} visible - [description]
134+
* @param {function} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob.
135+
* @param {integer} quantity - The quantity of Bob objects to create.
136+
* @param {string} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
137+
* @param {boolean} [visible=true] - [description]
139138
*
140-
* @return {[type]} [description]
139+
* @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created.
141140
*/
142141
createFromCallback: function (callback, quantity, frame, visible)
143142
{
@@ -153,18 +152,17 @@ var Blitter = new Class({
153152
return bobs;
154153
},
155154

156-
// frame MUST be part of the Blitter texture
157155
/**
158156
* [description]
159157
*
160158
* @method Phaser.GameObjects.Blitter#createMultiple
161159
* @since 3.0.0
162160
*
163-
* @param {[type]} quantity - [description]
164-
* @param {[type]} frame - [description]
165-
* @param {[type]} visible - [description]
161+
* @param {integer} quantity - The quantity of Bob objects to create.
162+
* @param {string} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
163+
* @param {boolean} [visible=true] - [description]
166164
*
167-
* @return {[type]} [description]
165+
* @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created.
168166
*/
169167
createMultiple: function (quantity, frame, visible)
170168
{
@@ -196,9 +194,9 @@ var Blitter = new Class({
196194
* @method Phaser.GameObjects.Blitter#childCanRender
197195
* @since 3.0.0
198196
*
199-
* @param {[type]} child - [description]
197+
* @param {Phaser.GameObjects.Blitter.Bob} child - [description]
200198
*
201-
* @return {[type]} [description]
199+
* @return {boolean} [description]
202200
*/
203201
childCanRender: function (child)
204202
{

src/gameobjects/blitter/BlitterCreator.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ var BuildGameObject = require('../BuildGameObject');
33
var GameObjectCreator = require('../GameObjectCreator');
44
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
55

6-
// When registering a factory function 'this' refers to the GameObjectCreator context.
7-
6+
/**
7+
* Creates a new Blitter Game Object and returns it.
8+
*
9+
* Note: This method will only be available if the Blitter Game Object has been built into Phaser.
10+
*
11+
* @method Phaser.GameObjects.GameObjectCreator#blitter
12+
* @since 3.0.0
13+
*
14+
* @param {object} config - [description]
15+
*
16+
* @return {Phaser.GameObjects.Blitter} The Game Object that was created.
17+
*/
818
GameObjectCreator.register('blitter', function (config)
919
{
1020
var key = GetAdvancedValue(config, 'key', null);
@@ -16,3 +26,5 @@ GameObjectCreator.register('blitter', function (config)
1626

1727
return blitter;
1828
});
29+
30+
// When registering a factory function 'this' refers to the GameObjectCreator context.

src/gameobjects/blitter/BlitterFactory.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
var Blitter = require('./Blitter');
22
var GameObjectFactory = require('../GameObjectFactory');
33

4+
/**
5+
* Creates a new Blitter Game Object and adds it to the Scene.
6+
*
7+
* Note: This method will only be available if the Blitter Game Object has been built into Phaser.
8+
*
9+
* @method Phaser.GameObjects.GameObjectFactory#blitter
10+
* @since 3.0.0
11+
*
12+
* @param {number} x - The x position of the Game Object.
13+
* @param {number} y - The y position of the Game Object.
14+
* @param {string} key - The key of the Texture the Blitter object will use.
15+
* @param {string|integer} [frame] - The default Frame children of the Blitter will use.
16+
*
17+
* @return {Phaser.GameObjects.Blitter} The Game Object that was created.
18+
*/
19+
GameObjectFactory.register('blitter', function (x, y, key, frame)
20+
{
21+
return this.displayList.add(new Blitter(this.scene, x, y, key, frame));
22+
});
23+
424
// When registering a factory function 'this' refers to the GameObjectFactory context.
525
//
626
// There are several properties available to use:
727
//
828
// this.scene - a reference to the Scene that owns the GameObjectFactory
929
// this.displayList - a reference to the Display List the Scene owns
1030
// this.updateList - a reference to the Update List the Scene owns
11-
12-
GameObjectFactory.register('blitter', function (x, y, key, frame)
13-
{
14-
return this.displayList.add(new Blitter(this.scene, x, y, key, frame));
15-
});

0 commit comments

Comments
 (0)