Skip to content

Commit 118c69f

Browse files
committed
Added jsdocs
1 parent bfddb09 commit 118c69f

3 files changed

Lines changed: 507 additions & 10 deletions

File tree

src/cameras/2d/CameraManager.js

Lines changed: 179 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,67 @@ var GetFastValue = require('../../utils/object/GetFastValue');
44
var PluginManager = require('../../plugins/PluginManager');
55
var RectangleContains = require('../../geom/rectangle/Contains');
66

7-
// Phaser.Cameras.Scene2D.CameraManager
8-
97
var CameraManager = new Class({
108

119
initialize:
1210

11+
/**
12+
* [description]
13+
*
14+
* @class CameraManager
15+
* @memberOf Phaser.Cameras.Scene2D
16+
* @constructor
17+
* @since 3.0.0
18+
*
19+
* @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin.
20+
*/
1321
function CameraManager (scene)
1422
{
15-
// The Scene that owns this plugin
23+
/**
24+
* The Scene that owns the Camera Manager plugin.
25+
*
26+
* @property {Phaser.Scene} scene
27+
* @since 3.0.0
28+
*/
1629
this.scene = scene;
1730

31+
/**
32+
* A reference to the Scene.Systems handler for the Scene that owns the Camera Manager.
33+
*
34+
* @property {Phaser.Scenes.Systems} systems
35+
* @since 3.0.0
36+
*/
1837
this.systems = scene.sys;
1938

2039
if (!scene.sys.settings.isBooted)
2140
{
2241
scene.sys.events.once('boot', this.boot, this);
2342
}
2443

44+
/**
45+
* The current Camera ID.
46+
*
47+
* @property {number} currentCameraId
48+
* @default 1
49+
* @readOnly
50+
* @since 3.0.0
51+
*/
2552
this.currentCameraId = 1;
2653

54+
/**
55+
* An Array of the Camera objects being managed by this Camera Manager.
56+
*
57+
* @property {Phaser.Cameras.Scene2D.Camera[]} cameras
58+
* @since 3.0.0
59+
*/
2760
this.cameras = [];
61+
62+
/**
63+
* A pool of Camera objects available to be used by the Camera Manager.
64+
*
65+
* @property {Phaser.Cameras.Scene2D.Camera[]} cameraPool
66+
* @since 3.0.0
67+
*/
2868
this.cameraPool = [];
2969

3070
if (scene.sys.settings.cameras)
@@ -38,10 +78,22 @@ var CameraManager = new Class({
3878
this.add();
3979
}
4080

41-
// Set the default camera
81+
/**
82+
* The default Camera in the Camera Manager.
83+
*
84+
* @property {Phaser.Cameras.Scene2D.Camera} main
85+
* @since 3.0.0
86+
*/
4287
this.main = this.cameras[0];
4388
},
4489

90+
/**
91+
* Called when the Camera Manager boots.
92+
* Starts the event listeners running.
93+
*
94+
* @method Phaser.Cameras.Scene2D.CameraManager#boot
95+
* @since 3.0.0
96+
*/
4597
boot: function ()
4698
{
4799
var eventEmitter = this.systems.events;
@@ -51,6 +103,21 @@ var CameraManager = new Class({
51103
eventEmitter.on('destroy', this.destroy, this);
52104
},
53105

106+
/**
107+
* [description]
108+
*
109+
* @method Phaser.Cameras.Scene2D.CameraManager#add
110+
* @since 3.0.0
111+
*
112+
* @param {number} [x=0] - [description]
113+
* @param {number} [y=0] - [description]
114+
* @param {number} [width] - [description]
115+
* @param {number} [height] - [description]
116+
* @param {boolean} [makeMain=false] - [description]
117+
* @param {string} [name=''] - [description]
118+
*
119+
* @return {Phaser.Cameras.Scene2D.Camera} [description]
120+
*/
54121
add: function (x, y, width, height, makeMain, name)
55122
{
56123
if (x === undefined) { x = 0; }
@@ -90,6 +157,16 @@ var CameraManager = new Class({
90157
return camera;
91158
},
92159

160+
/**
161+
* [description]
162+
*
163+
* @method Phaser.Cameras.Scene2D.CameraManager#addExisting
164+
* @since 3.0.0
165+
*
166+
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
167+
*
168+
* @return {Phaser.Cameras.Scene2D.Camera} [description]
169+
*/
93170
addExisting: function (camera)
94171
{
95172
var index = this.cameras.indexOf(camera);
@@ -105,17 +182,35 @@ var CameraManager = new Class({
105182
return null;
106183
},
107184

108-
/*
185+
/**
186+
* [description]
187+
*
188+
* @method Phaser.Cameras.Scene2D.CameraManager#addKeyControl
189+
* @since 3.0.0
190+
*
191+
* @param {[type]} config - [description]
192+
*
193+
* @return {[type]} [description]
194+
*/
109195
addKeyControl: function (config)
110196
{
111197
return new KeyControl(config);
112198
},
113199

200+
/**
201+
* [description]
202+
*
203+
* @method Phaser.Cameras.Scene2D.CameraManager#addSmoothedKeyControl
204+
* @since 3.0.0
205+
*
206+
* @param {[type]} config - [description]
207+
*
208+
* @return {[type]} [description]
209+
*/
114210
addSmoothedKeyControl: function (config)
115211
{
116212
return new SmoothedKeyControl(config);
117213
},
118-
*/
119214

120215
/*
121216
{
@@ -143,6 +238,16 @@ var CameraManager = new Class({
143238
}
144239
*/
145240

241+
/**
242+
* [description]
243+
*
244+
* @method Phaser.Cameras.Scene2D.CameraManager#fromJSON
245+
* @since 3.0.0
246+
*
247+
* @param {[type]} config - [description]
248+
*
249+
* @return {[type]} [description]
250+
*/
146251
fromJSON: function (config)
147252
{
148253
if (!Array.isArray(config))
@@ -199,6 +304,16 @@ var CameraManager = new Class({
199304
return this;
200305
},
201306

307+
/**
308+
* [description]
309+
*
310+
* @method Phaser.Cameras.Scene2D.CameraManager#getCamera
311+
* @since 3.0.0
312+
*
313+
* @param {string} name - [description]
314+
*
315+
* @return {Phaser.Cameras.Scene2D.Camera} [description]
316+
*/
202317
getCamera: function (name)
203318
{
204319
this.cameras.forEach(function (camera)
@@ -212,6 +327,16 @@ var CameraManager = new Class({
212327
return null;
213328
},
214329

330+
/**
331+
* [description]
332+
*
333+
* @method Phaser.Cameras.Scene2D.CameraManager#getCameraBelowPointer
334+
* @since 3.0.0
335+
*
336+
* @param {[type]} pointer - [description]
337+
*
338+
* @return {Phaser.Cameras.Scene2D.Camera} [description]
339+
*/
215340
getCameraBelowPointer: function (pointer)
216341
{
217342
var cameras = this.cameras;
@@ -228,6 +353,14 @@ var CameraManager = new Class({
228353
}
229354
},
230355

356+
/**
357+
* [description]
358+
*
359+
* @method Phaser.Cameras.Scene2D.CameraManager#remove
360+
* @since 3.0.0
361+
*
362+
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
363+
*/
231364
remove: function (camera)
232365
{
233366
var cameraIndex = this.cameras.indexOf(camera);
@@ -244,6 +377,16 @@ var CameraManager = new Class({
244377
}
245378
},
246379

380+
/**
381+
* [description]
382+
*
383+
* @method Phaser.Cameras.Scene2D.CameraManager#render
384+
* @since 3.0.0
385+
*
386+
* @param {[type]} renderer - [description]
387+
* @param {[type]} children - [description]
388+
* @param {[type]} interpolation - [description]
389+
*/
247390
render: function (renderer, children, interpolation)
248391
{
249392
var cameras = this.cameras;
@@ -258,6 +401,14 @@ var CameraManager = new Class({
258401
}
259402
},
260403

404+
/**
405+
* [description]
406+
*
407+
* @method Phaser.Cameras.Scene2D.CameraManager#resetAll
408+
* @since 3.0.0
409+
*
410+
* @return {Phaser.Cameras.Scene2D.Camera} [description]
411+
*/
261412
resetAll: function ()
262413
{
263414
while (this.cameras.length > 0)
@@ -270,6 +421,15 @@ var CameraManager = new Class({
270421
return this.main;
271422
},
272423

424+
/**
425+
* [description]
426+
*
427+
* @method Phaser.Cameras.Scene2D.CameraManager#update
428+
* @since 3.0.0
429+
*
430+
* @param {[type]} timestep - [description]
431+
* @param {[type]} delta - [description]
432+
*/
273433
update: function (timestep, delta)
274434
{
275435
for (var i = 0, l = this.cameras.length; i < l; ++i)
@@ -278,10 +438,23 @@ var CameraManager = new Class({
278438
}
279439
},
280440

441+
/**
442+
* [description]
443+
*
444+
* @method Phaser.Cameras.Scene2D.CameraManager#shutdown
445+
* @since 3.0.0
446+
*/
281447
shutdown: function ()
282448
{
449+
// TODO
283450
},
284451

452+
/**
453+
* [description]
454+
*
455+
* @method Phaser.Cameras.Scene2D.CameraManager#destroy
456+
* @since 3.0.0
457+
*/
285458
destroy: function ()
286459
{
287460
this.main = undefined;

0 commit comments

Comments
 (0)