Skip to content

Commit 1f967ae

Browse files
committed
More JSDocs added.
1 parent ea94059 commit 1f967ae

35 files changed

Lines changed: 334 additions & 19 deletions

v3/src/math/Within.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
/**
2-
* Checks if two values are within the given tolerance of each other.
3-
*
4-
* @param {number} a - The first number to check
5-
* @param {number} b - The second number to check
6-
* @param {number} tolerance - The tolerance. Anything equal to or less than this is considered within the range.
7-
* @return {boolean} True if a is <= tolerance of b.
8-
*/
2+
* Checks if the two values are within the given `tolerance` of each other.
3+
*
4+
* @function Phaser.Math.Within
5+
* @since 3.0.0
6+
*
7+
* @param {number} a - [description]
8+
* @param {number} b - [description]
9+
* @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range.
10+
*
11+
* @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`.
12+
*/
913
var Within = function (a, b, tolerance)
1014
{
1115
return (Math.abs(a - b) <= tolerance);

v3/src/math/Wrap.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
* [description]
3+
*
4+
* @function Phaser.Math.Wrap
5+
* @since 3.0.0
6+
*
7+
* @param {number} value - [description]
8+
* @param {number} min - [description]
9+
* @param {number} max - [description]
10+
*
11+
* @return {number} [description]
12+
*/
113
var Wrap = function (value, min, max)
214
{
315
var range = max - min;

v3/src/scene/global/inc/Add.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
var Scene = require('../../local/Scene');
22

33
/**
4-
* Adds a new Scene into the GlobalSceneManager. You must give each Scene a unique key by which you'll identify it.
5-
* The Scene can be either a Phaser.Scene object (or an object that extends it), a plain JavaScript object or a function.
6-
* If a function is given a new scene object will be created by calling it.
7-
*
8-
* @param {string} key - A unique key you use to reference this scene, i.e. "MainMenu", "Level1".
9-
* @param {Phaser.Scene|object|function} scene - The scene you want to switch to.
10-
* @param {boolean} [autoStart=false] - If true the Scene will be started immediately after adding it.
11-
*/
4+
* Adds a new Scene into the SceneManager.
5+
* You must give each Scene a unique key by which you'll identify it.
6+
*
7+
* The `sceneConfig` can be:
8+
*
9+
* * A `Phaser.Scene` object, or an object that extends it.
10+
* * A plain JavaScript object
11+
* * A JavaScript ES6 Class that extends `Phaser.Scene`
12+
* * A JavaScript ES5 prototype based Class
13+
* * A JavaScript function
14+
*
15+
* If a function is given then a new Scene will be created by calling it.
16+
*
17+
* @method Phaser.Scenes.GlobalSceneManager#add
18+
* @since 3.0.0
19+
*
20+
* @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`.
21+
* @param {Phaser.Scene|object|function} sceneConfig - [description]
22+
* @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added.
23+
*
24+
* @return {Phaser.Scene} [description]
25+
*/
1226
var Add = function (key, sceneConfig, autoStart)
1327
{
1428
if (autoStart === undefined) { autoStart = false; }

v3/src/scene/global/inc/Boot.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/**
2-
* The Boot handler is called by Phaser.Game when it first starts up.
3-
* The renderer is available by now.
4-
*/
2+
* [description]
3+
*
4+
* @method Phaser.Scenes.GlobalSceneManager#boot
5+
* @since 3.0.0
6+
*/
57
var Boot = function ()
68
{
79
var i;

v3/src/scene/global/inc/BootScene.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* [description]
3+
*
4+
* @method Phaser.Scenes.GlobalSceneManager#bootScene
5+
* @since 3.0.0
6+
*
7+
* @param {Phaser.Scene} scene - [description]
8+
*/
19
var BootScene = function (scene)
210
{
311
if (scene.init)

v3/src/scene/global/inc/BringToTop.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// If the arguments are strings they are assumed to be keys, otherwise they are Scene objects
22
// You can only swap the positions of Active (rendering / updating) Scenes. If a Scene is not active it cannot be moved.
33

4+
/**
5+
* [description]
6+
*
7+
* @method Phaser.Scenes.GlobalSceneManager#bringToTop
8+
* @since 3.0.0
9+
*
10+
* @param {string|Phaser.Scene} scene - [description]
11+
*/
412
var BringToTop = function (scene)
513
{
614
var index = (typeof scene === 'string') ? this.getActiveSceneIndexByKey(scene) : this.getActiveSceneIndex(scene);

v3/src/scene/global/inc/Create.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
var SortScenes = require('./SortScenes');
22

3+
/**
4+
* [description]
5+
*
6+
* @method Phaser.Scenes.GlobalSceneManager#create
7+
* @since 3.0.0
8+
*
9+
* @param {Phaser.Scene} scene - [description]
10+
*/
311
var Create = function (scene)
412
{
513
// Insert at the correct index, or it just all goes wrong :)

v3/src/scene/global/inc/CreateSceneDisplay.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ var CONST = require('../../../const');
33
var GetContext = require('../../../canvas/GetContext');
44
var CanvasInterpolation = require('../../../dom/CanvasInterpolation');
55

6+
/**
7+
* [description]
8+
*
9+
* @method Phaser.Scenes.GlobalSceneManager#createSceneDisplay
10+
* @since 3.0.0
11+
*
12+
* @param {Phaser.Scene} scene - [description]
13+
*/
614
var CreateSceneDisplay = function (scene)
715
{
816
var settings = scene.sys.settings;

v3/src/scene/global/inc/CreateSceneFromFunction.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ var Scene = require('../../local/Scene');
22
var Systems = require('../../local/Systems');
33
var NOOP = require('../../../utils/NOOP');
44

5+
/**
6+
* [description]
7+
*
8+
* @method Phaser.Scenes.GlobalSceneManager#createSceneFromFunction
9+
* @since 3.0.0
10+
*
11+
* @param {string} key - [description]
12+
* @param {function} scene - [description]
13+
*
14+
* @return {Phaser.Scene} [description]
15+
*/
516
var CreateSceneFromFunction = function (key, scene)
617
{
718
var newScene = new scene();

v3/src/scene/global/inc/CreateSceneFromInstance.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* [description]
3+
*
4+
* @method Phaser.Scenes.GlobalSceneManager#createSceneFromInstance
5+
* @since 3.0.0
6+
*
7+
* @param {string} key - [description]
8+
* @param {Phaser.Scene} newScene - [description]
9+
*
10+
* @return {Phaser.Scene} [description]
11+
*/
112
var CreateSceneFromInstance = function (key, newScene)
213
{
314
var configKey = newScene.sys.settings.key;

0 commit comments

Comments
 (0)