Adding docs.

This commit is contained in:
Richard Davey
2013-10-01 13:54:29 +01:00
parent fa15f8015d
commit 305b12d76b
64 changed files with 6268 additions and 2682 deletions
+96 -91
View File
@@ -1,48 +1,53 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Colors
*/
/**
* A collection of methods useful for manipulating and comparing colors.
*
* @class Color
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
* @module Phaser
* @class Phaser.Color
*/
Phaser.Color = {
/**
* Given an alpha and 3 color values this will return an integer representation of it
/**
* Given an alpha and 3 color values this will return an integer representation of it.
*
* @method getColor32
* @param {Number} alpha The Alpha value (between 0 and 255)
* @param {Number} red The Red channel value (between 0 and 255)
* @param {Number} green The Green channel value (between 0 and 255)
* @param {Number} blue The Blue channel value (between 0 and 255)
* @return {Number} A native color value integer (format: 0xAARRGGBB)
* @param {number} alpha - The Alpha value (between 0 and 255).
* @param {number} red - The Red channel value (between 0 and 255).
* @param {number} green - The Green channel value (between 0 and 255).
* @param {number} blue - The Blue channel value (between 0 and 255).
* @returns {number} A native color value integer (format: 0xAARRGGBB).
*/
getColor32: function (alpha, red, green, blue) {
return alpha << 24 | red << 16 | green << 8 | blue;
},
/**
/**
* Given 3 color values this will return an integer representation of it.
*
* @method getColor
* @param {Number} red The Red channel value (between 0 and 255)
* @param {Number} green The Green channel value (between 0 and 255)
* @param {Number} blue The Blue channel value (between 0 and 255)
* @return {Number} A native color value integer (format: 0xRRGGBB)
* @param {number} red - The Red channel value (between 0 and 255).
* @param {number} green - The Green channel value (between 0 and 255).
* @param {number} blue - The Blue channel value (between 0 and 255).
* @returns {number} A native color value integer (format: 0xRRGGBB).
*/
getColor: function (red, green, blue) {
return red << 16 | green << 8 | blue;
},
/**
/**
* Converts the given hex string into an object containing the RGB values.
*
* @method hexToRGB
* @param {String} The string hex color to convert.
* @return {Object} An object with 3 properties: r,g and b.
* @param {string}h - The string hex color to convert.
* @returns {object} An object with 3 properties: r,g and b.
*/
hexToRGB: function (h) {
@@ -55,13 +60,13 @@ Phaser.Color = {
},
/**
/**
* Returns a string containing handy information about the given color including string hex value,
* RGB format information and HSL information. Each section starts on a newline, 3 lines in total.
*
* @method getColorInfo
* @param {Number} color A color value in the format 0xAARRGGBB
* @return {String} string containing the 3 lines of information
* @param {number} color - A color value in the format 0xAARRGGBB.
* @returns {string}String containing the 3 lines of information.
*/
getColorInfo: function (color) {
var argb = Phaser.Color.getRGB(color);
@@ -75,36 +80,36 @@ Phaser.Color = {
return result;
},
/**
* Return a string representation of the color in the format 0xAARRGGBB
/**
* Return a string representation of the color in the format 0xAARRGGBB.
*
* @method RGBtoHexstring
* @param {Number} color The color to get the string representation for
* @return {String A string of length 10 characters in the format 0xAARRGGBB
* @param {number} color - The color to get the string representation for
* @returns {String A string of length 10 characters in the format 0xAARRGGBB
*/
RGBtoHexstring: function (color) {
var argb = Phaser.Color.getRGB(color);
return "0x" + Phaser.Color.colorToHexstring(argb.alpha) + Phaser.Color.colorToHexstring(argb.red) + Phaser.Color.colorToHexstring(argb.green) + Phaser.Color.colorToHexstring(argb.blue);
},
/**
* Return a string representation of the color in the format #RRGGBB
/**
* Return a string representation of the color in the format #RRGGBB.
*
* @method RGBtoWebstring
* @param {Number} color The color to get the string representation for
* @return {String} A string of length 10 characters in the format 0xAARRGGBB
* @param {number} color - The color to get the string representation for.
* @returns {string}A string of length 10 characters in the format 0xAARRGGBB.
*/
RGBtoWebstring: function (color) {
var argb = Phaser.Color.getRGB(color);
return "#" + Phaser.Color.colorToHexstring(argb.red) + Phaser.Color.colorToHexstring(argb.green) + Phaser.Color.colorToHexstring(argb.blue);
},
/**
* Return a string containing a hex representation of the given color
/**
* Return a string containing a hex representation of the given color.
*
* @method colorToHexstring
* @param {Number} color The color channel to get the hex value for, must be a value between 0 and 255)
* @return {String} A string of length 2 characters, i.e. 255 = FF, 0 = 00
* @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255).
* @returns {string}A string of length 2 characters, i.e. 255 = FF, 0 = 00.
*/
colorToHexstring: function (color) {
var digits = "0123456789ABCDEF";
@@ -114,15 +119,15 @@ Phaser.Color = {
return hexified;
},
/**
/**
* Interpolates the two given colours based on the supplied step and currentStep properties.
* @method interpolateColor
* @param {Number} color1
* @param {Number} color2
* @param {Number} steps
* @param {Number} currentStep
* @param {Number} alpha
* @return {Number} The interpolated color value.
* @param {number} color1 - Description.
* @param {number} color2 - Description.
* @param {number} steps - Description.
* @param {number} currentStep - Description.
* @param {number} alpha - Description.
* @returns {number} The interpolated color value.
*/
interpolateColor: function (color1, color2, steps, currentStep, alpha) {
if (typeof alpha === "undefined") { alpha = 255; }
@@ -134,16 +139,16 @@ Phaser.Color = {
return Phaser.Color.getColor32(alpha, r, g, b);
},
/**
/**
* Interpolates the two given colours based on the supplied step and currentStep properties.
* @method interpolateColorWithRGB
* @param {Number} color
* @param {Number} r
* @param {Number} g
* @param {Number} b
* @param {Number} steps
* @param {Number} currentStep
* @return {Number} The interpolated color value.
* @param {number} color - Description.
* @param {number} r - Description.
* @param {number} g - Description.
* @param {number} b - Description.
* @param {number} steps - Description.
* @param {number} currentStep - Description.
* @returns {number} The interpolated color value.
*/
interpolateColorWithRGB: function (color, r, g, b, steps, currentStep) {
var src = Phaser.Color.getRGB(color);
@@ -153,18 +158,18 @@ Phaser.Color = {
return Phaser.Color.getColor(or, og, ob);
},
/**
/**
* Interpolates the two given colours based on the supplied step and currentStep properties.
* @method interpolateRGB
* @param {Number} r1
* @param {Number} g1
* @param {Number} b1
* @param {Number} r2
* @param {Number} g2
* @param {Number} b2
* @param {Number} steps
* @param {Number} currentStep
* @return {Number} The interpolated color value.
* @param {number} r1 - Description.
* @param {number} g1 - Description.
* @param {number} b1 - Description.
* @param {number} r2 - Description.
* @param {number} g2 - Description.
* @param {number} b2 - Description.
* @param {number} steps - Description.
* @param {number} currentStep - Description.
* @returns {number} The interpolated color value.
*/
interpolateRGB: function (r1, g1, b1, r2, g2, b2, steps, currentStep) {
var r = (((r2 - r1) * currentStep) / steps) + r1;
@@ -173,16 +178,16 @@ Phaser.Color = {
return Phaser.Color.getColor(r, g, b);
},
/**
/**
* Returns a random color value between black and white
* <p>Set the min value to start each channel from the given offset.</p>
* <p>Set the max value to restrict the maximum color used per channel</p>
*
* @method getRandomColor
* @param {Number} min The lowest value to use for the color
* @param {Number} max The highest value to use for the color
* @param {Number} alpha The alpha value of the returning color (default 255 = fully opaque)
* @return {Number} 32-bit color value with alpha
* @param {number} min - The lowest value to use for the color.
* @param {number} max - The highest value to use for the color.
* @param {number} alpha - The alpha value of the returning color (default 255 = fully opaque).
* @returns {number} 32-bit color value with alpha.
*/
getRandomColor: function (min, max, alpha) {
if (typeof min === "undefined") { min = 0; }
@@ -201,14 +206,14 @@ Phaser.Color = {
return Phaser.Color.getColor32(alpha, red, green, blue);
},
/**
/**
* Return the component parts of a color as an Object with the properties alpha, red, green, blue
*
* <p>Alpha will only be set if it exist in the given color (0xAARRGGBB)</p>
*
* @method getRGB
* @param {Number} color in RGB (0xRRGGBB) or ARGB format (0xAARRGGBB)
* @return {Object} An Object with properties: alpha, red, green, blue
* @param {number} color - Color in RGB (0xRRGGBB) or ARGB format (0xAARRGGBB).
* @returns {object} An Object with properties: alpha, red, green, blue.
*/
getRGB: function (color) {
return {
@@ -219,11 +224,11 @@ Phaser.Color = {
};
},
/**
/**
* Returns a CSS friendly string value from the given color.
* @method getWebRGB
* @param {Number} color
* @return {String} A string in the format: 'rgba(r,g,b,a)'
* @param {number} color
* @returns {string}A string in the format: 'rgba(r,g,b,a)'
*/
getWebRGB: function (color) {
var alpha = (color >>> 24) / 255;
@@ -233,56 +238,56 @@ Phaser.Color = {
return 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ',' + alpha.toString() + ')';
},
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component, as a value between 0 and 255
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component, as a value between 0 and 255.
*
* @method getAlpha
* @param {Number} color In the format 0xAARRGGBB
* @return {Number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent))
* @param {number} color - In the format 0xAARRGGBB.
* @returns {number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent)).
*/
getAlpha: function (color) {
return color >>> 24;
},
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component as a value between 0 and 1
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component as a value between 0 and 1.
*
* @method getAlphaFloat
* @param {Number} color In the format 0xAARRGGBB
* @return {Number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent))
* @param {number} color - In the format 0xAARRGGBB.
* @returns {number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent)).
*/
getAlphaFloat: function (color) {
return (color >>> 24) / 255;
},
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Red component, as a value between 0 and 255
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Red component, as a value between 0 and 255.
*
* @method getRed
* @param {Number} color In the format 0xAARRGGBB
* @return {Number} The Red component of the color, will be between 0 and 255 (0 being no color, 255 full Red)
* @param {number} color In the format 0xAARRGGBB.
* @returns {number} The Red component of the color, will be between 0 and 255 (0 being no color, 255 full Red).
*/
getRed: function (color) {
return color >> 16 & 0xFF;
},
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Green component, as a value between 0 and 255
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Green component, as a value between 0 and 255.
*
* @method getGreen
* @param {Number} color In the format 0xAARRGGBB
* @return {Number} The Green component of the color, will be between 0 and 255 (0 being no color, 255 full Green)
* @param {number} color - In the format 0xAARRGGBB.
* @returns {number} The Green component of the color, will be between 0 and 255 (0 being no color, 255 full Green).
*/
getGreen: function (color) {
return color >> 8 & 0xFF;
},
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Blue component, as a value between 0 and 255
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Blue component, as a value between 0 and 255.
*
* @method getBlue
* @param {Number} color In the format 0xAARRGGBB
* @return {Number} The Blue component of the color, will be between 0 and 255 (0 being no color, 255 full Blue)
* @param {number} color - In the format 0xAARRGGBB.
* @returns {number} The Blue component of the color, will be between 0 and 255 (0 being no color, 255 full Blue).
*/
getBlue: function (color) {
return color & 0xFF;
+163 -33
View File
@@ -1,38 +1,73 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
* @module Phaser
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Debug
*/
/**
* A collection of methods for displaying debug information about game objects.
*
* @class DebugUtils
* @class Phaser.Utils.Debug
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
*/
Phaser.Utils.Debug = function (game) {
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
/**
* @property {Context} context - Description.
*/
this.context = game.context;
/**
* @property {string} font - Description.
* @default '14px Courier'
*/
this.font = '14px Courier';
/**
* @property {number} lineHeight - Description.
*/
this.lineHeight = 16;
/**
* @property {bool} renderShadow - Description.
*/
this.renderShadow = true;
/**
* @property {Context} currentX - Description.
* @default
*/
this.currentX = 0;
/**
* @property {number} currentY - Description.
* @default
*/
this.currentY = 0;
/**
* @property {number} currentAlpha - Description.
* @default
*/
this.currentAlpha = 1;
};
Phaser.Utils.Debug.prototype = {
/**
* Internal method that resets the debug output values.
* @method start
* @param {Number} x The X value the debug info will start from.
* @param {Number} y The Y value the debug info will start from.
* @param {String} color The color the debug info will drawn in.
* @param {number} x - The X value the debug info will start from.
* @param {number} y - The Y value the debug info will start from.
* @param {string} color - The color the debug info will drawn in.
*/
start: function (x, y, color) {
@@ -72,9 +107,9 @@ Phaser.Utils.Debug.prototype = {
/**
* Internal method that outputs a single line of text.
* @method line
* @param {String} text The line of text to draw.
* @param {Number} x The X value the debug info will start from.
* @param {Number} y The Y value the debug info will start from.
* @param {string} text - The line of text to draw.
* @param {number} x - The X value the debug info will start from.
* @param {number} y - The Y value the debug info will start from.
*/
line: function (text, x, y) {
@@ -106,6 +141,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderQuadTree
* @param {Description} quadtree - Description.
* @param {string} color - Description.
*/
renderQuadTree: function (quadtree, color) {
color = color || 'rgba(255,0,0,0.3)';
@@ -140,6 +181,14 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderSpriteCorners
* @param {Phaser.Sprite} sprite - The sprite to be rendered.
* @param {bool} showText - Description.
* @param {bool} showBounds - Description.
* @param {string} color - Description.
*/
renderSpriteCorners: function (sprite, showText, showBounds, color) {
if (this.context == null)
@@ -189,10 +238,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Render debug infos. (including id, position, rotation, scrolling factor, worldBounds and some other properties)
* @param x {number} X position of the debug info to be rendered.
* @param y {number} Y position of the debug info to be rendered.
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
* Render debug infos (including id, position, rotation, scrolling factor, worldBounds and some other properties).
* @method renderSoundInfo
* @param {Description} sound - Description.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - color of the debug info to be rendered. (format is css color string).
*/
renderSoundInfo: function (sound, x, y, color) {
@@ -225,9 +276,11 @@ Phaser.Utils.Debug.prototype = {
/**
* Render debug infos. (including id, position, rotation, scrolling factor, worldBounds and some other properties)
* @param x {number} X position of the debug info to be rendered.
* @param y {number} Y position of the debug info to be rendered.
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
* @method renderCameraInfo
* @param {Description} camera - Description.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - color of the debug info to be rendered (format is css color string)
*/
renderCameraInfo: function (camera, x, y, color) {
@@ -248,6 +301,11 @@ Phaser.Utils.Debug.prototype = {
/**
* Renders the Pointer.circle object onto the stage in green if down or red if up.
* @method renderDebug
* @param {Description} pointer - Description.
* @param {bool} hideIfUp - Description.
* @param {string} downColor - Description.
* @param {string} upColor - Description.
* @param {string} color - Description.
*/
renderPointer: function (pointer, hideIfUp, downColor, upColor, color) {
@@ -301,10 +359,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Render Sprite Input Debug information
* @param x {number} X position of the debug info to be rendered.
* @param y {number} Y position of the debug info to be rendered.
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
* Render Sprite Input Debug information.
* @method renderSpriteInputInfo
* @param {Phaser.Sprite} sprite - The sprite to be rendered.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - color of the debug info to be rendered (format is css color string).
*/
renderSpriteInputInfo: function (sprite, x, y, color) {
@@ -320,6 +380,14 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Render Sprite collision.
* @method renderSpriteCollision
* @param {Phaser.Sprite} sprite - The sprite to be rendered.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - color of the debug info to be rendered (format is css color string).
*/
renderSpriteCollision: function (sprite, x, y, color) {
color = color || 'rgb(255,255,255)';
@@ -338,9 +406,10 @@ Phaser.Utils.Debug.prototype = {
/**
* Render debug information about the Input object.
* @param x {number} X position of the debug info to be rendered.
* @param y {number} Y position of the debug info to be rendered.
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
* @method renderInputInfo
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - color of the debug info to be rendered. (format is css color string)
*/
renderInputInfo: function (x, y, color) {
@@ -362,10 +431,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Render debug infos. (including name, bounds info, position and some other properties)
* @param x {number} X position of the debug info to be rendered.
* @param y {number} Y position of the debug info to be rendered.
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
* Render debug infos (including name, bounds info, position and some other properties).
* @method renderSpriteInfo
* @param {Phaser.Sprite} sprite - Description.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
renderSpriteInfo: function (sprite, x, y, color) {
@@ -391,6 +462,7 @@ Phaser.Utils.Debug.prototype = {
// 4 = scaleY
// 5 = translateY
// this.line('id: ' + sprite._id);
// this.line('scale x: ' + sprite.worldTransform[0]);
// this.line('scale y: ' + sprite.worldTransform[4]);
@@ -407,6 +479,14 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Render debug infos (including name, bounds info, position and some other properties).
* @method renderWorldTransformInfo
* @param {Phaser.Sprite} sprite - Description.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
renderWorldTransformInfo: function (sprite, x, y, color) {
if (this.context == null)
@@ -428,6 +508,14 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderLocalTransformInfo
* @param {Phaser.Sprite} sprite - Description.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
renderLocalTransformInfo: function (sprite, x, y, color) {
if (this.context == null)
@@ -451,6 +539,14 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderPointInfo
* @param {Phaser.Sprite} sprite - Description.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
renderPointInfo: function (point, x, y, color) {
if (this.context == null)
@@ -466,7 +562,13 @@ Phaser.Utils.Debug.prototype = {
},
renderSpriteBody: function (sprite, color) {
/**
* Description.
* @method renderSpriteBounds
* @param {Phaser.Sprite} sprite - Description.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
renderSpriteBounds: function (sprite, color) {
if (this.context == null)
{
@@ -512,6 +614,13 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderPixel
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} fillStyle - Description.
*/
renderPixel: function (x, y, fillStyle) {
if (this.context == null)
@@ -528,6 +637,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderPoint
* @param {Description} point - Description.
* @param {string} fillStyle - Description.
*/
renderPoint: function (point, fillStyle) {
if (this.context == null)
@@ -544,6 +659,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderRectangle
* @param {Description} rect - Description.
* @param {string} fillStyle - Description.
*/
renderRectangle: function (rect, fillStyle) {
if (this.context == null)
@@ -560,6 +681,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Description.
* @method renderCircle
* @param {Description} circle - Description.
* @param {string} fillStyle - Description.
*/
renderCircle: function (circle, fillStyle) {
if (this.context == null)
@@ -580,10 +707,13 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Render text
* @param x {number} X position of the debug info to be rendered.
* @param y {number} Y position of the debug info to be rendered.
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
* Render text.
* @method renderText
* @param {string} text - The line of text to draw.
* @param{number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
* @param {string} font - The font of text to draw.
*/
renderText: function (text, x, y, color, font) {
+23 -17
View File
@@ -1,7 +1,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Utils
*/
@@ -13,15 +13,15 @@
Phaser.Utils = {
/**
* Javascript string pad
* http://www.webtoolkit.info/
* pad = the string to pad it out with (defaults to a space)
* Javascript string pad ({@link http://www.webtoolkit.info/})
* pad = the string to pad it out with (defaults to a space)<br>
* dir = 1 (left), 2 (right), 3 (both)
* @method pad
* @param {string} str the target string
* @param {number} pad the string to pad it out with (defaults to a space)
* @param {number} len
* @param {number} [dir=3] the direction dir = 1 (left), 2 (right), 3 (both)
* @param {string} str - The target string.
* @param {number} len - Description.
* @param {number} pad - the string to pad it out with (defaults to a space).
* @param {number} [dir=3] the direction dir = 1 (left), 2 (right), 3 (both).
* @return {string}
**/
pad: function (str, len, pad, dir) {
@@ -53,10 +53,11 @@ Phaser.Utils = {
},
/**
* This is a slightly modified version of jQuery.isPlainObject
/**
* This is a slightly modified version of jQuery.isPlainObject.
* @method isPlainObject
* @param {object} obj
* @param {object} obj - Description.
* @return {bool} - Description.
*/
isPlainObject: function (obj) {
@@ -87,12 +88,17 @@ Phaser.Utils = {
return true;
},
/**
* This is a slightly modified version of jQuery.extend (http://api.jquery.com/jQuery.extend/)
// deep, target, objects to copy to the target object
// This is a slightly modified version of {@link http://api.jquery.com/jQuery.extend/|jQuery.extend}
// deep (boolean)
// target (object to add to)
// objects ... (objects to recurse and copy from)
/**
* This is a slightly modified version of {@link http://api.jquery.com/jQuery.extend/|jQuery.extend}
* @method extend
* @param {bool} [deep] If true, the merge becomes recursive (aka. deep copy).
* @param {object} target The object to add to
* @param {object} objets Objects to recurse and copy from
* @return {Description} Description.
*/
extend: function () {
@@ -173,7 +179,7 @@ Phaser.Utils = {
* Converts a hex color number to an [R, G, B] array
*
* @method HEXtoRGB
* @param {Number} hex
* @param {number} hex
* @return {array}
*/
function HEXtoRGB(hex) {