Skip to content

Commit 20551f9

Browse files
committed
Lots of jsdocs fixes ready for the new doc generator.
1 parent 2ea2751 commit 20551f9

69 files changed

Lines changed: 152 additions & 177 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docgen/src/ClassDesc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ public function __construct($block)
3838
// This is a problem because the @classdesc block is often multi-line, but repeated in the clear content too.
3939
// So all the classes probably need tidying up before this part will work correctly.
4040

41-
// $this->help = $block->cleanContent();
41+
$this->help = $block->cleanContent();
4242

4343
}
4444

4545
public function getArray()
4646
{
4747
return array(
4848
'name' => $this->name,
49-
'parameters' => $this->parameters,
50-
'help' => implode('\n', $this->help),
5149
'extends' => $this->extends,
5250
'static' => $this->isStatic,
53-
'constructor' => $this->hasConstructor
51+
'constructor' => $this->hasConstructor,
52+
'parameters' => $this->parameters,
53+
'help' => implode('\n', $this->help)
5454
);
5555

5656
}

docgen/src/Parameter.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public function __construct($line)
2626

2727
public function parsePhaser($output)
2828
{
29-
$this->types = explode('|', $output[2]);
30-
$this->help = $output[5];
31-
3229
$name = $output[3];
3330

3431
// $this->debug = $name . " -- ";
@@ -53,6 +50,29 @@ public function parsePhaser($output)
5350

5451
$this->name = $name;
5552

53+
// Remove optional braces
54+
if (substr($output[2], 0, 1) === "(")
55+
{
56+
$output[2] = substr($output[2], 1, -1);
57+
}
58+
59+
$this->types = explode('|', $output[2]);
60+
61+
// @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order.
62+
// @param {(number[]|...number)} points - An array of 2d vectors that form the convex or concave polygon.
63+
// Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
64+
// or the arguments passed can be flat x,y values e.g. `setPolygon(options, x,y, x,y, x,y, ...)` where `x` and `y` are numbers.
65+
66+
foreach ($this->types as $key => $type)
67+
{
68+
if (substr($type, -2) === "[]")
69+
{
70+
$this->types[$key] = "Array " . substr($type, 0, -2);
71+
}
72+
}
73+
74+
$this->help = $output[5];
75+
5676
}
5777

5878
public function parsePixi($output)

src/animation/Animation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @param {Phaser.Sprite} parent - A reference to the owner of this Animation.
1515
* @param {string} name - The unique name for this animation, used in playback commands.
1616
* @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
17-
* @param {(Array.<number>|Array.<string>)} frames - An array of numbers or strings indicating which frames to play in which order.
17+
* @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order.
1818
* @param {number} delay - The time between each frame of the animation, given in ms.
1919
* @param {boolean} loop - Should this animation loop when it reaches the end or play through once.
2020
*/

src/core/Filter.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* This is a base Filter template to use for any Phaser filter development.
99
*
1010
* @class Phaser.Filter
11-
* @classdesc Phaser - Filter
1211
* @constructor
1312
* @param {Phaser.Game} game - A reference to the currently running game.
1413
* @param {Object} uniforms - Uniform mappings object

src/core/Game.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55
*/
66

77
/**
8-
* Game constructor
9-
*
10-
* Instantiate a new <code>Phaser.Game</code> object.
11-
* @class Phaser.Game
12-
* @classdesc This is where the magic happens. The Game object is the heart of your game,
8+
* This is where the magic happens. The Game object is the heart of your game,
139
* providing quick access to common functions and handling the boot process.
1410
* "Hell, there are no rules here - we're trying to accomplish something."
1511
* Thomas A. Edison
12+
*
13+
* @class Phaser.Game
1614
* @constructor
1715
* @param {number|string} [width=800] - The width of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage width of the parent container, or the browser window if no parent is given.
1816
* @param {number|string} [height=600] - The height of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage height of the parent container, or the browser window if no parent is given.
1917
* @param {number} [renderer=Phaser.AUTO] - Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all).
2018
* @param {string|HTMLElement} [parent=''] - The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself.
2119
* @param {object} [state=null] - The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null.
2220
* @param {boolean} [transparent=false] - Use a transparent canvas background or not.
23-
* @param {boolean} [antialias=true] - Draw all image textures anti-aliased or not. The default is for smooth textures, but disable if your game features pixel art.
21+
* @param {boolean} [antialias=true] - Draw all image textures anti-aliased or not. The default is for smooth textures, but disable if your game features pixel art.
2422
* @param {object} [physicsConfig=null] - A physics configuration object to pass to the Physics world on creation.
2523
*/
2624
Phaser.Game = function (width, height, renderer, parent, state, transparent, antialias, physicsConfig) {

src/core/Group.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*/
66

77
/**
8-
* Phaser Group constructor.
8+
* A Group is a container for display objects that allows for fast pooling and object recycling.
9+
* Groups can be nested within other Groups and have their own local transforms.
10+
*
911
* @class Phaser.Group
10-
* @classdesc A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms.
1112
* @constructor
1213
* @param {Phaser.Game} game - A reference to the currently running game.
1314
* @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If `undefined` it will use game.world. If null it won't be added to anything.

src/core/Plugin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* This is a base Plugin template to use for any Phaser plugin development.
99
*
1010
* @class Phaser.Plugin
11-
* @classdesc Phaser - Plugin
1211
* @constructor
1312
* @param {Phaser.Game} game - A reference to the currently running game.
1413
* @param {Any} parent - The object that owns this plugin, usually Phaser.PluginManager.

src/core/PluginManager.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* The Plugin Manager is responsible for the loading, running and unloading of Phaser Plugins.
1111
*
1212
* @class Phaser.PluginManager
13-
* @classdesc Phaser - PluginManager
1413
* @constructor
1514
* @param {Phaser.Game} game - A reference to the currently running game.
1615
*/

src/core/Signal.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/**
2+
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
23
* @author Richard Davey <rich@photonstorm.com>
34
* @copyright 2014 Photon Storm Ltd.
45
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
56
*/
67

78
/**
9+
* A Signal is used for object communication via a custom broadcaster instead of Events.
10+
*
811
* @class Phaser.Signal
9-
* @classdesc A Signal is used for object communication via a custom broadcaster instead of Events.
10-
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
1112
* @constructor
1213
*/
1314
Phaser.Signal = function () {

src/core/SignalBinding.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
2+
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
23
* @author Richard Davey <rich@photonstorm.com>
34
* @copyright 2014 Photon Storm Ltd.
45
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
56
*/
67

78
/**
8-
* @class Phaser.SignalBinding
9-
* @classdesc Object that represents a binding between a Signal and a listener function.
9+
* Object that represents a binding between a Signal and a listener function.
1010
* This is an internal constructor and shouldn't be created directly.
1111
* Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
12-
*
13-
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
12+
*
13+
* @class Phaser.SignalBinding
1414
* @constructor
1515
* @param {Phaser.Signal} signal - Reference to Signal object that listener is currently bound to.
1616
* @param {function} listener - Handler function bound to the signal.

0 commit comments

Comments
 (0)