Updated docs - they now actually list the new body methods :)

This commit is contained in:
photonstorm
2014-02-21 15:37:26 +00:00
parent 7ee0c20bb3
commit e9e5bf9436
192 changed files with 51286 additions and 4396 deletions
+144 -84
View File
@@ -166,6 +166,10 @@
<a href="Phaser.Game.html">Game</a>
</li>
<li>
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
<li>
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
@@ -254,6 +258,38 @@
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li>
<a href="Phaser.Physics.Body.html">Body</a>
</li>
<li>
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
</li>
<li>
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
</li>
<li>
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
</li>
<li>
<a href="Phaser.Physics.Material.html">Material</a>
</li>
<li>
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
</li>
<li>
<a href="Phaser.Physics.Spring.html">Spring</a>
</li>
<li>
<a href="Phaser.Physics.World.html">World</a>
</li>
<li>
<a href="Phaser.Plugin.html">Plugin</a>
</li>
@@ -532,7 +568,7 @@ Phaser.Utils.Debug.prototype = {
*/
start: function (x, y, color, columnWidth) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -577,7 +613,7 @@ Phaser.Utils.Debug.prototype = {
*/
line: function (text, x, y) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -604,7 +640,7 @@ Phaser.Utils.Debug.prototype = {
*/
splitline: function (text) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -629,46 +665,6 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Visually renders a QuadTree to the display.
* @method Phaser.Utils.Debug#renderQuadTree
* @param {Phaser.QuadTree} quadtree - The quadtree to render.
* @param {string} color - The color of the lines in the quadtree.
*/
renderQuadTree: function (quadtree, color) {
color = color || 'rgba(255,0,0,0.3)';
this.start();
var bounds = quadtree.bounds;
if (quadtree.nodes.length === 0)
{
this.context.strokeStyle = color;
this.context.strokeRect(bounds.x, bounds.y, bounds.width, bounds.height);
this.renderText(quadtree.ID + ' / ' + quadtree.objects.length, bounds.x + 4, bounds.y + 16, 'rgb(0,200,0)', '12px Courier');
this.context.strokeStyle = 'rgb(0,255,0)';
// children
for (var i = 0; i &lt; quadtree.objects.length; i++)
{
this.context.strokeRect(quadtree.objects[i].x, quadtree.objects[i].y, quadtree.objects[i].width, quadtree.objects[i].height);
}
}
else
{
for (var i = 0; i &lt; quadtree.nodes.length; i++)
{
this.renderQuadTree(quadtree.nodes[i]);
}
}
this.stop();
},
/**
* Render Sound information, including decoded state, duration, volume and more.
* @method Phaser.Utils.Debug#renderSoundInfo
@@ -679,7 +675,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderSoundInfo: function (sound, x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -716,7 +712,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderCameraInfo: function (camera, x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -743,7 +739,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPointer: function (pointer, hideIfUp, downColor, upColor, color) {
if (this.context == null || pointer == null)
if (this.context === null || pointer == null)
{
return;
}
@@ -802,6 +798,11 @@ Phaser.Utils.Debug.prototype = {
*/
renderSpriteInputInfo: function (sprite, x, y, color) {
if (this.context === null)
{
return;
}
color = color || 'rgb(255,255,255)';
this.start(x, y, color);
@@ -823,7 +824,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderInputInfo: function (x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -840,6 +841,21 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Renders the Sprites bounds. Note: This is really expensive as it has to calculate the bounds every time you call it!
* @method Phaser.Utils.Debug#renderSpriteBounds
* @param {Phaser.Sprite} sprite - Description.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
* @param {boolean} [filled=true] - Render the rectangle as a fillRect (default, true) or a strokeRect (false)
*/
renderSpriteBounds: function (sprite, color, filled) {
var bounds = sprite.getBounds();
this.renderRectangle(bounds, color, filled);
},
/**
* Render debug infos (including name, bounds info, position and some other properties) about the Sprite.
* @method Phaser.Utils.Debug#renderSpriteInfo
@@ -850,7 +866,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderSpriteInfo: function (sprite, x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -897,7 +913,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderSpriteCoords: function (sprite, x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -927,7 +943,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderLine: function (line, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -955,7 +971,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderLineInfo: function (line, x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -980,7 +996,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPointInfo: function (point, x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -1002,7 +1018,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPixel: function (x, y, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -1024,7 +1040,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPoint: function (point, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -1047,7 +1063,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderRectangle: function (rect, color, filled) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -1081,7 +1097,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderCircle: function (circle, color) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -1109,7 +1125,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderText: function (text, x, y, color, font) {
if (this.context == null)
if (this.context === null)
{
return;
}
@@ -1135,6 +1151,11 @@ Phaser.Utils.Debug.prototype = {
*/
renderBodyInfo: function (sprite, x, y, color) {
if (this.context === null)
{
return;
}
color = color || 'rgb(255,255,255)';
this.start(x, y, color, 210);
@@ -1153,12 +1174,12 @@ Phaser.Utils.Debug.prototype = {
/**
* @method Phaser.Utils.Debug#renderPhysicsBody
* @param {Phaser.Body} body - The Phaser.Body instance to render all shapes from.
* @param {Phaser.Physics.Body} body - The Phaser.Physics.Body instance to render all shapes from.
* @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in.
*/
renderPhysicsBody: function (body, color, context) {
renderPhysicsBody: function (body, color) {
if (this.context === null && context === null)
if (this.context === null)
{
return;
}
@@ -1172,8 +1193,8 @@ Phaser.Utils.Debug.prototype = {
var shapeAngles = body.data.shapeAngles;
var i = shapes.length;
var x = this.game.math.p2px(body.data.position[0]) - this.game.camera.view.x;
var y = this.game.math.p2px(body.data.position[1]) - this.game.camera.view.y;
var x = this.game.math.p2pxi(body.data.position[0]) - this.game.camera.view.x;
var y = this.game.math.p2pxi(body.data.position[1]) - this.game.camera.view.y;
var angle = body.data.angle;
while (i--)
@@ -1186,11 +1207,14 @@ Phaser.Utils.Debug.prototype = {
{
this.renderShapeLine(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]);
}
// else if (shapes[i] instanceof p2.Convex)
else
else if (shapes[i] instanceof p2.Convex)
{
this.renderShapeConvex(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]);
}
else if (shapes[i] instanceof p2.Circle)
{
this.renderShapeCircle(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]);
}
}
this.stop();
@@ -1198,11 +1222,15 @@ Phaser.Utils.Debug.prototype = {
},
/**
* @method Phaser.Utils.Debug#renderShape
* Renders a p2.Rectangle shape. Do not call this directly - instead use Debug.renderPhysicsBody.
*
* @method Phaser.Utils.Debug#renderShapeRectangle
* @param {number} x - The x coordinate of the Shape to translate to.
* @param {number} y - The y coordinate of the Shape to translate to.
* @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
* @param {number} x - The x coordinate of the Body to translate to.
* @param {number} y - The y coordinate of the Body to translate to.
* @param {number} angle - The angle of the Body to rotate to.
* @param {array} offset - The shape offset vector.
* @param {number} angle - The shape angle.
*/
renderShapeRectangle: function (x, y, bodyAngle, shape, offset, angle) {
@@ -1212,14 +1240,14 @@ Phaser.Utils.Debug.prototype = {
this.context.beginPath();
this.context.save();
this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1]));
this.context.translate(x + this.game.math.p2pxi(offset[0]), y + this.game.math.p2pxi(offset[1]));
this.context.rotate(bodyAngle + angle);
this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1]));
this.context.moveTo(this.game.math.p2pxi(points[0][0]), this.game.math.p2pxi(points[0][1]));
for (var i = 1; i &lt; points.length; i++)
{
this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1]));
this.context.lineTo(this.game.math.p2pxi(points[i][0]), this.game.math.p2pxi(points[i][1]));
}
this.context.closePath();
@@ -1229,12 +1257,15 @@ Phaser.Utils.Debug.prototype = {
},
/**
* @method Phaser.Utils.Debug#renderShape
* @param {number} x - The x coordinate of the Body to translate to.
* @param {number} y - The y coordinate of the Body to translate to.
* Renders a p2.Line shape. Do not call this directly - instead use Debug.renderPhysicsBody.
*
* @method Phaser.Utils.Debug#renderShapeLine
* @param {number} x - The x coordinate of the Shape to translate to.
* @param {number} y - The y coordinate of the Shape to translate to.
* @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
* @param {number} offset -
* @param {number} angle -
* @param {array} offset - The shape offset vector.
* @param {number} angle - The shape angle.
*/
renderShapeLine: function (x, y, bodyAngle, shape, offset, angle) {
@@ -1252,11 +1283,15 @@ Phaser.Utils.Debug.prototype = {
},
/**
* @method Phaser.Utils.Debug#renderShape
* Renders a convex shape. Do not call this directly - instead use Debug.renderPhysicsBody.
*
* @method Phaser.Utils.Debug#renderShapeConvex
* @param {number} x - The x coordinate of the Shape to translate to.
* @param {number} y - The y coordinate of the Shape to translate to.
* @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
* @param {number} x - The x coordinate of the Body to translate to.
* @param {number} y - The y coordinate of the Body to translate to.
* @param {number} angle - The angle of the Body to rotate to.
* @param {array} offset - The shape offset vector.
* @param {number} angle - The shape angle.
*/
renderShapeConvex: function (x, y, bodyAngle, shape, offset, angle) {
@@ -1264,16 +1299,41 @@ Phaser.Utils.Debug.prototype = {
this.context.beginPath();
this.context.save();
this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1]));
this.context.translate(x + this.game.math.p2pxi(offset[0]), y + this.game.math.p2pxi(offset[1]));
this.context.rotate(bodyAngle + angle);
this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1]));
this.context.moveTo(this.game.math.p2pxi(points[0][0]), this.game.math.p2pxi(points[0][1]));
for (var i = 1; i &lt; points.length; i++)
{
this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1]));
this.context.lineTo(this.game.math.p2pxi(points[i][0]), this.game.math.p2pxi(points[i][1]));
}
// this.context.arc(0, 0, this.game.math.p2px(shape.radius) , 0, Math.PI * 2);
this.context.closePath();
this.context.stroke();
this.context.restore();
},
/**
* Renders a p2.Circle shape. Do not call this directly - instead use Debug.renderPhysicsBody.
*
* @method Phaser.Utils.Debug#renderShapeCircle
* @param {number} x - The x coordinate of the Shape to translate to.
* @param {number} y - The y coordinate of the Shape to translate to.
* @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
* @param {array} offset - The shape offset vector.
* @param {number} angle - The shape angle.
*/
renderShapeCircle: function (x, y, bodyAngle, shape, offset, angle) {
this.context.beginPath();
this.context.save();
this.context.translate(x + this.game.math.p2pxi(offset[0]), y + this.game.math.p2pxi(offset[1]));
this.context.arc(0, 0, this.game.math.p2px(shape.radius) , 0, Math.PI * 2);
this.context.closePath();
this.context.stroke();
this.context.restore();
@@ -1304,7 +1364,7 @@ Phaser.Utils.Debug.prototype.constructor = Phaser.Utils.Debug;
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>