Skip to content

Commit 35d2917

Browse files
committed
Lots of small jsdoc fixes and DocGen updates.
1 parent d704065 commit 35d2917

17 files changed

Lines changed: 85 additions & 59 deletions

File tree

docgen/export.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,30 @@
4040
$gen = new PhaserDocGen();
4141
$gen->start();
4242

43-
$sprite = $gen->get('Phaser.Sprite');
43+
// $gen->extend();
4444

45-
echo $sprite;
46-
47-
$gen->extend('Phaser.Sprite');
48-
49-
echo $sprite;
45+
// $sprite = $gen->get('Phaser.Sprite');
46+
// echo $sprite;
47+
// $gen->extend('Phaser.Sprite');
48+
// echo $sprite;
5049

50+
foreach ($gen->classes as $key => $processor)
51+
{
52+
echo $key . " = " . $processor . "\n";
53+
// echo $processor . "\n";
54+
// echo $key . "\n";
55+
}
5156

57+
echo "\n";
58+
echo " - EXTENDING ... \n";
59+
echo "\n";
5260

53-
// foreach ($gen->classes as $key => $processor)
54-
// {
55-
// echo $key . " = " . $processor . "\n";
56-
// echo $key . "\n";
57-
// }
61+
$gen->extend();
5862

59-
// print_r($gen->classes);
63+
foreach ($gen->classes as $key => $processor)
64+
{
65+
echo $key . " = " . $processor . "\n";
66+
}
6067

6168
?>
6269
</pre>

docgen/src/PhaserDocGen.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class PhaserDocGen
33
{
44
private $src;
55
private $ignore = array('.', '..');
6-
private $fileIgnore = array('p2.js');
6+
private $fileIgnore = array('Intro.js', 'Outro.js', 'Pixi.js', 'Spine.js', 'p2.js');
77

88
public $log;
99
public $files;
@@ -38,9 +38,11 @@ public function extend($classKey = '')
3838
// This will go through each class and add in inherited properties, etc
3939
foreach ($this->classes as $key => $processor)
4040
{
41-
$processor->extend();
42-
43-
// echo "Extended $key\n";
41+
if ($processor !== 'corrupted')
42+
{
43+
// echo "Extended $key\n";
44+
$processor->extend();
45+
}
4446
}
4547
}
4648

@@ -96,16 +98,26 @@ private function dirToArray($dir)
9698
// $classKey = substr($value, 0, -3);
9799
// $classKey = str_replace(DIRECTORY_SEPARATOR, ".", $index);
98100
$result[$classKey] = $index;
101+
// echo "Class key: $classKey \n";
99102
$this->classes[$classKey] = $tempProcessor;
100103
}
101104
else
102105
{
103106
$this->classes[$index] = 'corrupted';
107+
// echo "CORRUPTED \n";
104108
}
105109

106110
// Dump to log
107111
// echo $index . "\n";
108112
}
113+
else
114+
{
115+
// echo "Ignored: $value \n";
116+
}
117+
}
118+
else
119+
{
120+
// echo "NOT A JS FILE\n";
109121
}
110122
}
111123
}

docgen/src/Processor.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,16 @@ private function scanFile() {
9696
{
9797
if ($this->blocks[$i]->isClass)
9898
{
99-
$tempClass = new ClassDesc($this, $this->blocks[$i]);
100-
$this->class = $tempClass;
101-
102-
if ($tempClass->corrupted)
99+
// Some files like PIXI.Graphics have multiple class blocks within them
100+
if ($this->class === null)
103101
{
104-
$this->corrupted = true;
102+
$tempClass = new ClassDesc($this, $this->blocks[$i]);
103+
$this->class = $tempClass;
104+
105+
if ($tempClass->corrupted)
106+
{
107+
$this->corrupted = true;
108+
}
105109
}
106110
}
107111
else if ($this->blocks[$i]->isConst)
@@ -271,9 +275,16 @@ public function extend()
271275
{
272276
$extends = $proc->class->extends;
273277
$proc = $this->docgen->get($extends);
274-
// echo "\n\nextend found: " . $proc->getName() . "\n";
275278

276-
$this->merge($proc);
279+
if ($proc !== null)
280+
{
281+
// echo "\n\nextend found: " . $proc->getName() . "\n";
282+
$this->merge($proc);
283+
}
284+
else
285+
{
286+
// echo "\n\n --------> fatal extend: " . $extends . "\n";
287+
}
277288
}
278289
while ($proc->class->extendsFrom());
279290

@@ -389,7 +400,7 @@ public function __toString()
389400
}
390401
else
391402
{
392-
return "Class: " . $this->class->name . ", Methods: " . count($this->methods['public']) . ", Properties: " . count($this->properties['public']) . "\n";
403+
return "Class: " . $this->class->name . ", Methods: " . count($this->methods['public']) . ", Properties: " . count($this->properties['public']);
393404
}
394405
}
395406

src/animation/AnimationParser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Responsible for parsing sprite sheet and JSON data into the internal FrameData format that Phaser uses for animations.
99
*
1010
* @class Phaser.AnimationParser
11+
* @static
1112
*/
1213
Phaser.AnimationParser = {
1314

src/core/Group.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Groups can be nested within other Groups and have their own local transforms.
1010
*
1111
* @class Phaser.Group
12+
* @extends PIXI.DisplayObjectContainer
1213
* @constructor
1314
* @param {Phaser.Game} game - A reference to the currently running game.
1415
* @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/State.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* @class Phaser.State
1212
* @constructor
1313
*/
14-
1514
Phaser.State = function () {
1615

1716
/**

src/gameobjects/Rope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
/**
88
* A Rope is a Sprite that has a repeating texture. The texture can be scrolled and scaled and will automatically wrap on the edges as it does so.
99
* Please note that Ropes, as with normal Sprites, have no input handler or physics bodies by default. Both need enabling.
10+
* Example usage: https://github.com/codevinsky/phaser-rope-demo/blob/master/dist/demo.js
1011
*
1112
* @class Phaser.Rope
1213
* @constructor
13-
* @extends Pixi.Rope
14+
* @extends PIXI.Rope
1415
* @param {Phaser.Game} game - A reference to the currently running game.
1516
* @param {number} x - The x coordinate (in world space) to position the Rope at.
1617
* @param {number} y - The y coordinate (in world space) to position the Rope at.
1718
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Rope during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
1819
* @param {string|number} frame - If this Rope is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
1920
* @param {Array} points - An array of {Phaser.Point}.
20-
* Example usage: https://github.com/codevinsky/phaser-rope-demo/blob/master/dist/demo.js
2121
*/
2222
Phaser.Rope = function (game, x, y, key, frame, points) {
2323

src/gameobjects/TileSprite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @class Phaser.TileSprite
1212
* @constructor
13-
* @extends Pixi.TilingSprite
13+
* @extends PIXI.TilingSprite
1414
* @param {Phaser.Game} game - A reference to the currently running game.
1515
* @param {number} x - The x coordinate (in world space) to position the TileSprite at.
1616
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.

src/input/Input.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,12 +803,7 @@ Phaser.Input.prototype = {
803803

804804
if (displayObject.hitArea && displayObject.hitArea.contains)
805805
{
806-
if (displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y))
807-
{
808-
return true;
809-
}
810-
811-
return false;
806+
return (displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y));
812807
}
813808
else if (displayObject instanceof Phaser.TileSprite)
814809
{

src/pixi/extras/Rope.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* @extends Strip
1111
* @param {Texture} texture - The texture to use on the rope.
1212
* @param {Array} points - An array of {PIXI.Point}.
13-
*
1413
*/
1514
PIXI.Rope = function(texture, points)
1615
{
@@ -26,7 +25,6 @@ PIXI.Rope = function(texture, points)
2625
this.refresh();
2726
};
2827

29-
3028
// constructor
3129
PIXI.Rope.prototype = Object.create( PIXI.Strip.prototype );
3230
PIXI.Rope.prototype.constructor = PIXI.Rope;
@@ -160,6 +158,7 @@ PIXI.Rope.prototype.updateTransform = function()
160158

161159
PIXI.DisplayObjectContainer.prototype.updateTransform.call( this );
162160
};
161+
163162
/*
164163
* Sets the texture that the Rope will use
165164
*

0 commit comments

Comments
 (0)