Lots of small jsdoc fixes and DocGen updates.

This commit is contained in:
photonstorm 2014-10-20 00:54:56 +01:00
parent d70406588c
commit 35d29170d0
17 changed files with 86 additions and 60 deletions

View file

@ -40,23 +40,30 @@
$gen = new PhaserDocGen();
$gen->start();
$sprite = $gen->get('Phaser.Sprite');
// $gen->extend();
echo $sprite;
// $sprite = $gen->get('Phaser.Sprite');
// echo $sprite;
// $gen->extend('Phaser.Sprite');
// echo $sprite;
$gen->extend('Phaser.Sprite');
echo $sprite;
// foreach ($gen->classes as $key => $processor)
// {
// echo $key . " = " . $processor . "\n";
foreach ($gen->classes as $key => $processor)
{
echo $key . " = " . $processor . "\n";
// echo $processor . "\n";
// echo $key . "\n";
// }
}
// print_r($gen->classes);
echo "\n";
echo " - EXTENDING ... \n";
echo "\n";
$gen->extend();
foreach ($gen->classes as $key => $processor)
{
echo $key . " = " . $processor . "\n";
}
?>
</pre>

View file

@ -3,7 +3,7 @@
{
private $src;
private $ignore = array('.', '..');
private $fileIgnore = array('p2.js');
private $fileIgnore = array('Intro.js', 'Outro.js', 'Pixi.js', 'Spine.js', 'p2.js');
public $log;
public $files;
@ -38,9 +38,11 @@
// This will go through each class and add in inherited properties, etc
foreach ($this->classes as $key => $processor)
{
$processor->extend();
// echo "Extended $key\n";
if ($processor !== 'corrupted')
{
// echo "Extended $key\n";
$processor->extend();
}
}
}
@ -96,16 +98,26 @@
// $classKey = substr($value, 0, -3);
// $classKey = str_replace(DIRECTORY_SEPARATOR, ".", $index);
$result[$classKey] = $index;
// echo "Class key: $classKey \n";
$this->classes[$classKey] = $tempProcessor;
}
else
{
$this->classes[$index] = 'corrupted';
// echo "CORRUPTED \n";
}
// Dump to log
// echo $index . "\n";
}
else
{
// echo "Ignored: $value \n";
}
}
else
{
// echo "NOT A JS FILE\n";
}
}
}

View file

@ -96,12 +96,16 @@
{
if ($this->blocks[$i]->isClass)
{
$tempClass = new ClassDesc($this, $this->blocks[$i]);
$this->class = $tempClass;
if ($tempClass->corrupted)
// Some files like PIXI.Graphics have multiple class blocks within them
if ($this->class === null)
{
$this->corrupted = true;
$tempClass = new ClassDesc($this, $this->blocks[$i]);
$this->class = $tempClass;
if ($tempClass->corrupted)
{
$this->corrupted = true;
}
}
}
else if ($this->blocks[$i]->isConst)
@ -271,9 +275,16 @@
{
$extends = $proc->class->extends;
$proc = $this->docgen->get($extends);
// echo "\n\nextend found: " . $proc->getName() . "\n";
$this->merge($proc);
if ($proc !== null)
{
// echo "\n\nextend found: " . $proc->getName() . "\n";
$this->merge($proc);
}
else
{
// echo "\n\n --------> fatal extend: " . $extends . "\n";
}
}
while ($proc->class->extendsFrom());
@ -389,7 +400,7 @@
}
else
{
return "Class: " . $this->class->name . ", Methods: " . count($this->methods['public']) . ", Properties: " . count($this->properties['public']) . "\n";
return "Class: " . $this->class->name . ", Methods: " . count($this->methods['public']) . ", Properties: " . count($this->properties['public']);
}
}

View file

@ -8,6 +8,7 @@
* Responsible for parsing sprite sheet and JSON data into the internal FrameData format that Phaser uses for animations.
*
* @class Phaser.AnimationParser
* @static
*/
Phaser.AnimationParser = {

View file

@ -9,6 +9,7 @@
* Groups can be nested within other Groups and have their own local transforms.
*
* @class Phaser.Group
* @extends PIXI.DisplayObjectContainer
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @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.

View file

@ -11,7 +11,6 @@
* @class Phaser.State
* @constructor
*/
Phaser.State = function () {
/**

View file

@ -7,17 +7,17 @@
/**
* 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.
* Please note that Ropes, as with normal Sprites, have no input handler or physics bodies by default. Both need enabling.
* Example usage: https://github.com/codevinsky/phaser-rope-demo/blob/master/dist/demo.js
*
* @class Phaser.Rope
* @constructor
* @extends Pixi.Rope
* @extends PIXI.Rope
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {number} x - The x coordinate (in world space) to position the Rope at.
* @param {number} y - The y coordinate (in world space) to position the Rope at.
* @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.
* @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.
* @param {Array} points - An array of {Phaser.Point}.
* Example usage: https://github.com/codevinsky/phaser-rope-demo/blob/master/dist/demo.js
*/
Phaser.Rope = function (game, x, y, key, frame, points) {

View file

@ -10,7 +10,7 @@
*
* @class Phaser.TileSprite
* @constructor
* @extends Pixi.TilingSprite
* @extends PIXI.TilingSprite
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {number} x - The x coordinate (in world space) to position the TileSprite at.
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.

View file

@ -803,12 +803,7 @@ Phaser.Input.prototype = {
if (displayObject.hitArea && displayObject.hitArea.contains)
{
if (displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y))
{
return true;
}
return false;
return (displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y));
}
else if (displayObject instanceof Phaser.TileSprite)
{

View file

@ -10,7 +10,6 @@
* @extends Strip
* @param {Texture} texture - The texture to use on the rope.
* @param {Array} points - An array of {PIXI.Point}.
*
*/
PIXI.Rope = function(texture, points)
{
@ -26,7 +25,6 @@ PIXI.Rope = function(texture, points)
this.refresh();
};
// constructor
PIXI.Rope.prototype = Object.create( PIXI.Strip.prototype );
PIXI.Rope.prototype.constructor = PIXI.Rope;
@ -160,6 +158,7 @@ PIXI.Rope.prototype.updateTransform = function()
PIXI.DisplayObjectContainer.prototype.updateTransform.call( this );
};
/*
* Sets the texture that the Rope will use
*

View file

@ -15,7 +15,7 @@
* You will need to generate a sprite sheet to accompany the spine data
* When loaded this class will dispatch a "loaded" event
*
* @class Spine
* @class SpineLoader
* @uses EventTarget
* @constructor
* @param url {String} The url of the JSON file

View file

@ -529,21 +529,13 @@ PIXI.Graphics.prototype.drawRect = function( x, y, width, height )
* @param width {Number} The width of the rectangle
* @param height {Number} The height of the rectangle
* @param radius {Number} Radius of the rectangle corners
*//*
*/
PIXI.Graphics.prototype.drawRoundedRect = function( x, y, width, height, radius )
{
if (!this.currentPath.points.length) this.graphicsData.pop();
// this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha,
/// fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling,
// points:[x, y, width, height, radius], shape:new PIXI.Rectangle(x,y, width, height), type:PIXI.Graphics.RREC};
this.graphicsData.push(this.currentPath);
this.dirty = true;
this.drawShape({ points:[x, y, width, height, radius], type:PIXI.Graphics.RREC });
return this;
};
*/
/**
* Draws a circle.

View file

@ -4,9 +4,10 @@
/**
* A set of functions used by the canvas renderer to draw the primitive graphics data
* A set of functions used by the canvas renderer to draw the primitive graphics data.
*
* @class CanvasGraphics
* @static
*/
PIXI.CanvasGraphics = function()
{
@ -15,8 +16,8 @@ PIXI.CanvasGraphics = function()
/*
* Renders a PIXI.Graphics object to a canvas.
*
* @static
* @method renderGraphics
* @static
* @param graphics {Graphics} the actual graphics object to render
* @param context {CanvasRenderingContext2D} the 2d drawing method of the canvas
*/
@ -145,14 +146,14 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
context.stroke();
}
}
/*
else if (data.type === PIXI.Graphics.RREC)
{
var rx = points[0];
var ry = points[1];
var width = points[2];
var height = points[3];
var radius = points[4];
var pts = shape.points;
var rx = pts[0];
var ry = pts[1];
var width = pts[2];
var height = pts[3];
var radius = pts[4];
var maxRadius = Math.min(width, height) / 2 | 0;
radius = radius > maxRadius ? maxRadius : radius;
@ -182,7 +183,6 @@ PIXI.CanvasGraphics.renderGraphics = function(graphics, context)
context.stroke();
}
}
*/
}
};

View file

@ -5,7 +5,8 @@
/**
* Creates a Canvas element of the given size.
*
* @method CanvasBuffer
* @class CanvasBuffer
* @constructor
* @param width {Number} the width for the newly created canvas
* @param height {Number} the height for the newly created canvas
*/

View file

@ -3,14 +3,17 @@
*/
/**
* A set of functions used to handle masking
* A set of functions used to handle masking.
*
* @class CanvasMaskManager
* @constructor
*/
PIXI.CanvasMaskManager = function()
{
};
PIXI.CanvasMaskManager.prototype.constructor = PIXI.CanvasMaskManager;
/**
* This method adds it to the current stack of masks.
*

View file

@ -309,7 +309,7 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
*/
PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
{
var points = graphicsData.points;
var points = graphicsData.shape.points;
var x = points[0];
var y = points[1];
var width = points[2];

View file

@ -4,6 +4,7 @@
/**
* @method initDefaultShaders
* @static
* @private
*/
PIXI.initDefaultShaders = function()
@ -12,6 +13,7 @@ PIXI.initDefaultShaders = function()
/**
* @method CompileVertexShader
* @static
* @param gl {WebGLContext} the current WebGL drawing context
* @param shaderSrc {Array}
* @return {Any}
@ -23,6 +25,7 @@ PIXI.CompileVertexShader = function(gl, shaderSrc)
/**
* @method CompileFragmentShader
* @static
* @param gl {WebGLContext} the current WebGL drawing context
* @param shaderSrc {Array}
* @return {Any}
@ -34,6 +37,7 @@ PIXI.CompileFragmentShader = function(gl, shaderSrc)
/**
* @method _CompileShader
* @static
* @private
* @param gl {WebGLContext} the current WebGL drawing context
* @param shaderSrc {Array}
@ -58,6 +62,7 @@ PIXI._CompileShader = function(gl, shaderSrc, shaderType)
/**
* @method compileProgram
* @static
* @param gl {WebGLContext} the current WebGL drawing context
* @param vertexSrc {Array}
* @param fragmentSrc {Array}