+
@@ -250,7 +336,7 @@
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Phaser.Sprite} parent - A reference to the owner of this Animation.
* @param {string} name - The unique name for this animation, used in playback commands.
-* @param {Phaser.Animation.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
+* @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
* @param {(Array.<number>|Array.<string>)} frames - An array of numbers or strings indicating which frames to play in which order.
* @param {number} delay - The time between each frame of the animation, given in ms.
* @param {boolean} looped - Should this animation loop or play through once.
@@ -343,7 +429,7 @@ Phaser.Animation = function (game, parent, name, frameData, frames, delay, loope
this._frameSkip = 1;
/**
- * @property {Phaser.Animation.Frame} currentFrame - The currently displayed frame of the Animation.
+ * @property {Phaser.Frame} currentFrame - The currently displayed frame of the Animation.
*/
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
@@ -679,7 +765,7 @@ Phaser.Animation.generateFrameNames = function (prefix, min, max, suffix, zeroPa
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:41 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:44 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/AnimationManager.js.html b/Docs/out/AnimationManager.js.html
index b6cf1bc8..2bc72698 100644
--- a/Docs/out/AnimationManager.js.html
+++ b/Docs/out/AnimationManager.js.html
@@ -23,13 +23,13 @@
+
@@ -242,7 +328,6 @@
*/
/**
-*
* A Camera is your view into the game world. It has a position and size and renders only those objects within its field of view.
* The game automatically creates a single Stage sized camera on boot. Move the camera around the world with Phaser.Camera.x/y
*
@@ -608,7 +693,7 @@ Object.defineProperty(Phaser.Camera.prototype, "height", {
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:41 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:44 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Canvas.js.html b/Docs/out/Canvas.js.html
index 995fd165..331f0b84 100644
--- a/Docs/out/Canvas.js.html
+++ b/Docs/out/Canvas.js.html
@@ -23,13 +23,13 @@
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* A collection of methods useful for manipulating and comparing colors.
+*
+* @class Phaser.Color
+*/
+Phaser.Color = {
+
+ /**
+ * Given an alpha and 3 color values this will return an integer representation of it.
+ *
+ * @method Phaser.Color.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).
+ * @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 Phaser.Color.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).
+ * @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 Phaser.Color.hexToRGB
+ * @param {string} h - The string hex color to convert.
+ * @returns {object} An object with 3 properties: r,g and b.
+ */
+ hexToRGB: function (h) {
+
+ var hex16 = (h.charAt(0) == "#") ? h.substring(1, 7) : h;
+ var red = parseInt(hex16.substring(0, 2), 16);
+ var green = parseInt(hex16.substring(2, 4), 16);
+ var blue = parseInt(hex16.substring(4, 6), 16);
+
+ return red << 16 | green << 8 | blue;
+
+ },
+
+ /**
+ * 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 Phaser.Color.getColorInfo
+ * @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);
+ var hsl = Phaser.Color.RGBtoHSV(color);
+
+ // Hex format
+ var result = Phaser.Color.RGBtoHexstring(color) + "\n";
+
+ // RGB format
+ result = result.concat("Alpha: " + argb.alpha + " Red: " + argb.red + " Green: " + argb.green + " Blue: " + argb.blue) + "\n";
+
+ // HSL info
+ result = result.concat("Hue: " + hsl.hue + " Saturation: " + hsl.saturation + " Lightnes: " + hsl.lightness);
+
+ return result;
+
+ },
+
+ /**
+ * Return a string representation of the color in the format 0xAARRGGBB.
+ *
+ * @method Phaser.Color.RGBtoHexstring
+ * @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.
+ *
+ * @method Phaser.Color.RGBtoWebstring
+ * @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.
+ *
+ * @method Phaser.Color.colorToHexstring
+ * @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";
+ var lsd = color % 16;
+ var msd = (color - lsd) / 16;
+ var hexified = digits.charAt(msd) + digits.charAt(lsd);
+ return hexified;
+
+ },
+
+ /**
+ * Interpolates the two given colours based on the supplied step and currentStep properties.
+ * @method Phaser.Color.interpolateColor
+ * @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; }
+
+ var src1 = Phaser.Color.getRGB(color1);
+ var src2 = Phaser.Color.getRGB(color2);
+ var r = (((src2.red - src1.red) * currentStep) / steps) + src1.red;
+ var g = (((src2.green - src1.green) * currentStep) / steps) + src1.green;
+ var b = (((src2.blue - src1.blue) * currentStep) / steps) + src1.blue;
+
+ return Phaser.Color.getColor32(alpha, r, g, b);
+
+ },
+
+ /**
+ * Interpolates the two given colours based on the supplied step and currentStep properties.
+ * @method Phaser.Color.interpolateColorWithRGB
+ * @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);
+ var or = (((r - src.red) * currentStep) / steps) + src.red;
+ var og = (((g - src.green) * currentStep) / steps) + src.green;
+ var ob = (((b - src.blue) * currentStep) / steps) + src.blue;
+
+ return Phaser.Color.getColor(or, og, ob);
+
+ },
+
+ /**
+ * Interpolates the two given colours based on the supplied step and currentStep properties.
+ * @method Phaser.Color.interpolateRGB
+ * @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;
+ var g = (((g2 - g1) * currentStep) / steps) + g1;
+ var b = (((b2 - b1) * currentStep) / steps) + b1;
+
+ 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 Phaser.Color.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).
+ * @returns {number} 32-bit color value with alpha.
+ */
+ getRandomColor: function (min, max, alpha) {
+
+ if (typeof min === "undefined") { min = 0; }
+ if (typeof max === "undefined") { max = 255; }
+ if (typeof alpha === "undefined") { alpha = 255; }
+
+ // Sanity checks
+ if (max > 255) {
+ return Phaser.Color.getColor(255, 255, 255);
+ }
+
+ if (min > max) {
+ return Phaser.Color.getColor(255, 255, 255);
+ }
+
+ var red = min + Math.round(Math.random() * (max - min));
+ var green = min + Math.round(Math.random() * (max - min));
+ var blue = min + Math.round(Math.random() * (max - min));
+
+ 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 Phaser.Color.getRGB
+ * @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 {
+ alpha: color >>> 24,
+ red: color >> 16 & 0xFF,
+ green: color >> 8 & 0xFF,
+ blue: color & 0xFF
+ };
+
+ },
+
+ /**
+ * Returns a CSS friendly string value from the given color.
+ * @method Phaser.Color.getWebRGB
+ * @param {number} color
+ * @returns {string}A string in the format: 'rgba(r,g,b,a)'
+ */
+ getWebRGB: function (color) {
+
+ var alpha = (color >>> 24) / 255;
+ var red = color >> 16 & 0xFF;
+ var green = color >> 8 & 0xFF;
+ var blue = color & 0xFF;
+
+ 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.
+ *
+ * @method Phaser.Color.getAlpha
+ * @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.
+ *
+ * @method Phaser.Color.getAlphaFloat
+ * @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.
+ *
+ * @method Phaser.Color.getRed
+ * @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.
+ *
+ * @method Phaser.Color.getGreen
+ * @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.
+ *
+ * @method Phaser.Color.getBlue
+ * @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;
+ }
+
+};
+
+
@@ -244,7 +330,7 @@
/**
* A Frame is a single frame of an animation and is part of a FrameData collection.
*
-* @class Phaser.Animation.Frame
+* @class Phaser.Frame
* @constructor
* @param {number} index - The index of this Frame within the FrameData set it is being added to.
* @param {number} x - X position of the frame within the texture image.
@@ -254,7 +340,7 @@
* @param {string} name - The name of the frame. In Texture Atlas data this is usually set to the filename.
* @param {string} uuid - Internal UUID key.
*/
-Phaser.Animation.Frame = function (index, x, y, width, height, name, uuid) {
+Phaser.Frame = function (index, x, y, width, height, name, uuid) {
/**
* @property {number} index - The index of this Frame within the FrameData set it is being added to.
@@ -360,12 +446,12 @@ Phaser.Animation.Frame = function (index, x, y, width, height, name, uuid) {
};
-Phaser.Animation.Frame.prototype = {
+Phaser.Frame.prototype = {
/**
* If the frame was trimmed when added to the Texture Atlas this records the trim and source data.
*
- * @method Phaser.Animation.Frame#setTrim
+ * @method Phaser.Frame#setTrim
* @param {boolean} trimmed - If this frame was trimmed or not.
* @param {number} actualWidth - The width of the frame before being trimmed.
* @param {number} actualHeight - The height of the frame before being trimmed.
@@ -416,7 +502,7 @@ Phaser.Animation.Frame.prototype = {
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:41 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:44 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/FrameData.js.html b/Docs/out/FrameData.js.html
index 570a29a7..7651fbad 100644
--- a/Docs/out/FrameData.js.html
+++ b/Docs/out/FrameData.js.html
@@ -23,13 +23,13 @@
+
@@ -244,10 +330,10 @@
/**
* FrameData is a container for Frame objects, which are the internal representation of animation data in Phaser.
*
-* @class Phaser.Animation.FrameData
+* @class Phaser.FrameData
* @constructor
*/
-Phaser.Animation.FrameData = function () {
+Phaser.FrameData = function () {
/**
* @property {Array} _frames - Local array of frames.
@@ -264,14 +350,14 @@ Phaser.Animation.FrameData = function () {
};
-Phaser.Animation.FrameData.prototype = {
+Phaser.FrameData.prototype = {
/**
* Adds a new Frame to this FrameData collection. Typically called by the Animation.Parser and not directly.
*
- * @method Phaser.Animation.FrameData#addFrame
- * @param {Phaser.Animation.Frame} frame - The frame to add to this FrameData set.
- * @return {Phaser.Animation.Frame} The frame that was just added.
+ * @method Phaser.FrameData#addFrame
+ * @param {Phaser.Frame} frame - The frame to add to this FrameData set.
+ * @return {Phaser.Frame} The frame that was just added.
*/
addFrame: function (frame) {
@@ -291,9 +377,9 @@ Phaser.Animation.FrameData.prototype = {
/**
* Get a Frame by its numerical index.
*
- * @method Phaser.Animation.FrameData#getFrame
+ * @method Phaser.FrameData#getFrame
* @param {number} index - The index of the frame you want to get.
- * @return {Phaser.Animation.Frame} The frame, if found.
+ * @return {Phaser.Frame} The frame, if found.
*/
getFrame: function (index) {
@@ -309,9 +395,9 @@ Phaser.Animation.FrameData.prototype = {
/**
* Get a Frame by its frame name.
*
- * @method Phaser.Animation.FrameData#getFrameByName
+ * @method Phaser.FrameData#getFrameByName
* @param {string} name - The name of the frame you want to get.
- * @return {Phaser.Animation.Frame} The frame, if found.
+ * @return {Phaser.Frame} The frame, if found.
*/
getFrameByName: function (name) {
@@ -327,7 +413,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Check if there is a Frame with the given name.
*
- * @method Phaser.Animation.FrameData#checkFrameName
+ * @method Phaser.FrameData#checkFrameName
* @param {string} name - The name of the frame you want to check.
* @return {boolean} True if the frame is found, otherwise false.
*/
@@ -345,7 +431,7 @@ Phaser.Animation.FrameData.prototype = {
/**
* Returns a range of frames based on the given start and end frame indexes and returns them in an Array.
*
- * @method Phaser.Animation.FrameData#getFrameRange
+ * @method Phaser.FrameData#getFrameRange
* @param {number} start - The starting frame index.
* @param {number} end - The ending frame index.
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -368,7 +454,7 @@ Phaser.Animation.FrameData.prototype = {
* Returns all of the Frames in this FrameData set where the frame index is found in the input array.
* The frames are returned in the output array, or if none is provided in a new Array object.
*
- * @method Phaser.Animation.FrameData#getFrames
+ * @method Phaser.FrameData#getFrames
* @param {Array} frames - An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings? (false)
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -415,7 +501,7 @@ Phaser.Animation.FrameData.prototype = {
* Returns all of the Frame indexes in this FrameData set.
* The frames indexes are returned in the output array, or if none is provided in a new Array object.
*
- * @method Phaser.Animation.FrameData#getFrameIndexes
+ * @method Phaser.FrameData#getFrameIndexes
* @param {Array} frames - An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings? (false)
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -458,11 +544,11 @@ Phaser.Animation.FrameData.prototype = {
};
/**
-* @name Phaser.Animation.FrameData#total
+* @name Phaser.FrameData#total
* @property {number} total - The total number of frames in this FrameData set.
* @readonly
*/
-Object.defineProperty(Phaser.Animation.FrameData.prototype, "total", {
+Object.defineProperty(Phaser.FrameData.prototype, "total", {
get: function () {
return this._frames.length;
@@ -490,7 +576,7 @@ Object.defineProperty(Phaser.Animation.FrameData.prototype, "total", {
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:41 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:44 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Game.js.html b/Docs/out/Game.js.html
index 3e32bbe2..e1d8aa56 100644
--- a/Docs/out/Game.js.html
+++ b/Docs/out/Game.js.html
@@ -23,13 +23,13 @@
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* @overview
+*
+* Phaser - http://www.phaser.io
+*
+* v{version} - Built at: {buildDate}
+*
+* By Richard Davey http://www.photonstorm.com @photonstorm
+*
+* A feature-packed 2D HTML5 game framework born from the smouldering pits of Flixel and
+* constructed via plenty of blood, sweat, tears and coffee by Richard Davey (@photonstorm).
+*
+* Phaser uses Pixi.js for rendering, created by Mat Groves http://matgroves.com/ @Doormat23.
+*
+* Follow Phaser development progress at http://www.photonstorm.com
+*
+* Many thanks to Adam Saltsman (@ADAMATOMIC) for releasing Flixel, from both which Phaser
+* and my love of game development originate.
+*
+* "If you want your children to be intelligent, read them fairy tales."
+* "If you want them to be more intelligent, read them more fairy tales."
+* -- Albert Einstein
+*/
+
-
@@ -584,7 +659,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
-Phaser.Animation.Frame
+Phaser.Frame
@@ -2599,7 +2674,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:41 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:45 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.AnimationManager.html b/Docs/out/Phaser.AnimationManager.html
index 513b6d5c..92c33b28 100644
--- a/Docs/out/Phaser.AnimationManager.html
+++ b/Docs/out/Phaser.AnimationManager.html
@@ -23,13 +23,13 @@
@@ -430,7 +518,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
-Phaser.Animation.Frame
+Phaser.Frame
@@ -637,7 +725,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
-Phaser.Animation.FrameData
+Phaser.FrameData
@@ -2423,7 +2511,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:42 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:45 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.AnimationParser.html b/Docs/out/Phaser.AnimationParser.html
new file mode 100644
index 00000000..0b069c2f
--- /dev/null
+++ b/Docs/out/Phaser.AnimationParser.html
@@ -0,0 +1,1355 @@
+
+
+
+
+
+ Phaser Class: AnimationParser
+
+
+
+
+
+
+
+
+
+
+
@@ -6080,7 +6168,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:42 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:45 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Camera.html b/Docs/out/Phaser.Camera.html
index 6f2da9bc..629b1cc2 100644
--- a/Docs/out/Phaser.Camera.html
+++ b/Docs/out/Phaser.Camera.html
@@ -23,13 +23,13 @@
@@ -2850,7 +2938,7 @@ without having to use game.camera.x and game.camera.y.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:42 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:45 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Canvas.html b/Docs/out/Phaser.Canvas.html
index 094ea103..2718c62a 100644
--- a/Docs/out/Phaser.Canvas.html
+++ b/Docs/out/Phaser.Canvas.html
@@ -23,13 +23,13 @@
@@ -2320,7 +2408,7 @@ patchy on earlier browsers, especially on mobile.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:42 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:45 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Circle.html b/Docs/out/Phaser.Circle.html
index 03088d06..eee8dab7 100644
--- a/Docs/out/Phaser.Circle.html
+++ b/Docs/out/Phaser.Circle.html
@@ -23,13 +23,13 @@
@@ -4100,7 +4188,7 @@ This method checks the radius distances between the two Circle objects to see if
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:42 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:45 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Color.html b/Docs/out/Phaser.Color.html
new file mode 100644
index 00000000..98a6f65b
--- /dev/null
+++ b/Docs/out/Phaser.Color.html
@@ -0,0 +1,3564 @@
+
+
+
+
+
+ Phaser Class: Color
+
+
+
+
+
+
+
+
+
+
+
A native color value integer (format: 0xAARRGGBB).
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<static> getColorInfo(color) → {string}
+
+
+
+
+
+
+
+
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.
Returns all of the Frame indexes in this FrameData set.
+The frames indexes are returned in the output array, or if none is provided in a new Array object.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
frames
+
+
+
+
+
+Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
+
+
+
+
+
+
+
useNumericIndex
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
Are the given frames using numeric indexes (default) or strings? (false)
+
+
+
+
+
+
+
output
+
+
+
+
+
+Array
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
If given the results will be appended to the end of this array otherwise a new array will be created.
Returns all of the Frames in this FrameData set where the frame index is found in the input array.
+The frames are returned in the output array, or if none is provided in a new Array object.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
frames
+
+
+
+
+
+Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
+
+
+
+
+
+
+
useNumericIndex
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
Are the given frames using numeric indexes (default) or strings? (false)
+
+
+
+
+
+
+
output
+
+
+
+
+
+Array
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
If given the results will be appended to the end of this array otherwise a new array will be created.
@@ -1198,7 +1286,7 @@ providing quick access to common functions and handling the boot process.
-Phaser.Utils.Debug
+Phaser.Utils.Debug
@@ -3597,7 +3685,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
-Phaser.TweenManager
+Phaser.TweenManager
@@ -4287,7 +4375,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:42 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Group.html b/Docs/out/Phaser.Group.html
index 996aaf1e..d6c1443b 100644
--- a/Docs/out/Phaser.Group.html
+++ b/Docs/out/Phaser.Group.html
@@ -23,13 +23,13 @@
@@ -6213,7 +6301,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:43 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Input.html b/Docs/out/Phaser.Input.html
index a8a92d49..4db98bf2 100644
--- a/Docs/out/Phaser.Input.html
+++ b/Docs/out/Phaser.Input.html
@@ -23,13 +23,13 @@
@@ -7385,7 +7473,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:43 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.InputHandler.html b/Docs/out/Phaser.InputHandler.html
index 9282d52c..3c78611a 100644
--- a/Docs/out/Phaser.InputHandler.html
+++ b/Docs/out/Phaser.InputHandler.html
@@ -23,13 +23,13 @@
@@ -7301,7 +7389,7 @@ This value is only set when the pointer is over this Sprite.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:43 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Key.html b/Docs/out/Phaser.Key.html
index d4dc5b81..d457c4b8 100644
--- a/Docs/out/Phaser.Key.html
+++ b/Docs/out/Phaser.Key.html
@@ -23,13 +23,13 @@
@@ -2348,7 +2436,7 @@ If the key is up it holds the duration of the previous down session.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:43 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Keyboard.html b/Docs/out/Phaser.Keyboard.html
index c65f620c..353ab542 100644
--- a/Docs/out/Phaser.Keyboard.html
+++ b/Docs/out/Phaser.Keyboard.html
@@ -23,13 +23,13 @@
@@ -2683,7 +2771,7 @@ This is called automatically by Phaser.Input and should not normally be invoked
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:43 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.LinkedList.html b/Docs/out/Phaser.LinkedList.html
index 8e7030ef..05060e49 100644
--- a/Docs/out/Phaser.LinkedList.html
+++ b/Docs/out/Phaser.LinkedList.html
@@ -23,13 +23,13 @@
@@ -1267,7 +1355,7 @@ The function must exist on the member.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:43 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Loader.html b/Docs/out/Phaser.Loader.html
index ef2866eb..c566fd56 100644
--- a/Docs/out/Phaser.Loader.html
+++ b/Docs/out/Phaser.Loader.html
@@ -23,13 +23,13 @@
@@ -1532,7 +1620,7 @@ It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 a
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Math.html b/Docs/out/Phaser.Math.html
index a5321e5f..b7bac697 100644
--- a/Docs/out/Phaser.Math.html
+++ b/Docs/out/Phaser.Math.html
@@ -23,13 +23,13 @@
@@ -9811,7 +9899,7 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Mouse.html b/Docs/out/Phaser.Mouse.html
index b9d594f8..59e78675 100644
--- a/Docs/out/Phaser.Mouse.html
+++ b/Docs/out/Phaser.Mouse.html
@@ -23,13 +23,13 @@
@@ -2078,7 +2166,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Net.html b/Docs/out/Phaser.Net.html
index 2b23a9ec..2a6eeb0d 100644
--- a/Docs/out/Phaser.Net.html
+++ b/Docs/out/Phaser.Net.html
@@ -23,13 +23,13 @@
@@ -1157,7 +1245,7 @@ Optionally you can redirect to the new url, or just return it as a string.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Particles.Arcade.Emitter.html b/Docs/out/Phaser.Particles.Arcade.Emitter.html
index cdb70d11..ba5e1e19 100644
--- a/Docs/out/Phaser.Particles.Arcade.Emitter.html
+++ b/Docs/out/Phaser.Particles.Arcade.Emitter.html
@@ -23,13 +23,13 @@
+
@@ -10533,7 +10619,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Particles.html b/Docs/out/Phaser.Particles.html
index 69f7d173..bdc6602f 100644
--- a/Docs/out/Phaser.Particles.html
+++ b/Docs/out/Phaser.Particles.html
@@ -23,13 +23,13 @@
@@ -948,7 +1036,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Plugin.html b/Docs/out/Phaser.Plugin.html
index 41b946f0..23a58ab1 100644
--- a/Docs/out/Phaser.Plugin.html
+++ b/Docs/out/Phaser.Plugin.html
@@ -23,13 +23,13 @@
@@ -1619,7 +1707,7 @@ It is only called if active is set to true.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.PluginManager.html b/Docs/out/Phaser.PluginManager.html
index 8b21015f..c4e1f416 100644
--- a/Docs/out/Phaser.PluginManager.html
+++ b/Docs/out/Phaser.PluginManager.html
@@ -23,13 +23,13 @@
@@ -1249,7 +1337,7 @@ It only calls plugins who have active=true.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Point.html b/Docs/out/Phaser.Point.html
index 3b3896cd..ecfa3d57 100644
--- a/Docs/out/Phaser.Point.html
+++ b/Docs/out/Phaser.Point.html
@@ -23,13 +23,13 @@
@@ -4809,7 +4897,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:44 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Pointer.html b/Docs/out/Phaser.Pointer.html
index 48f5c24c..3fa406db 100644
--- a/Docs/out/Phaser.Pointer.html
+++ b/Docs/out/Phaser.Pointer.html
@@ -23,13 +23,13 @@
@@ -1118,7 +1206,7 @@ Split the node into 4 subnodes
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.RandomDataGenerator.html b/Docs/out/Phaser.RandomDataGenerator.html
index d47c2a65..2dfefa0a 100644
--- a/Docs/out/Phaser.RandomDataGenerator.html
+++ b/Docs/out/Phaser.RandomDataGenerator.html
@@ -23,13 +23,13 @@
@@ -1811,7 +1899,7 @@ Random number generator from
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Rectangle.html b/Docs/out/Phaser.Rectangle.html
index 6f55c154..ad97a39e 100644
--- a/Docs/out/Phaser.Rectangle.html
+++ b/Docs/out/Phaser.Rectangle.html
@@ -23,13 +23,13 @@
@@ -7150,7 +7238,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.RequestAnimationFrame.html b/Docs/out/Phaser.RequestAnimationFrame.html
index 50e66a68..662a17be 100644
--- a/Docs/out/Phaser.RequestAnimationFrame.html
+++ b/Docs/out/Phaser.RequestAnimationFrame.html
@@ -23,13 +23,13 @@
@@ -1121,7 +1209,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Signal.html b/Docs/out/Phaser.Signal.html
index a3238ac5..dc498ed8 100644
--- a/Docs/out/Phaser.Signal.html
+++ b/Docs/out/Phaser.Signal.html
@@ -23,13 +23,13 @@
@@ -5330,7 +5418,7 @@ This allows you to bundle multiple sounds together into a single audio file and
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.SoundManager.html b/Docs/out/Phaser.SoundManager.html
index ac46cabc..6e62d2b9 100644
--- a/Docs/out/Phaser.SoundManager.html
+++ b/Docs/out/Phaser.SoundManager.html
@@ -23,13 +23,13 @@
@@ -2238,7 +2326,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Stage.html b/Docs/out/Phaser.Stage.html
index 26c7bc91..ba75184b 100644
--- a/Docs/out/Phaser.Stage.html
+++ b/Docs/out/Phaser.Stage.html
@@ -23,13 +23,13 @@
@@ -1295,7 +1383,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.StageScaleMode.html b/Docs/out/Phaser.StageScaleMode.html
index e8b4ac7e..72c3c1eb 100644
--- a/Docs/out/Phaser.StageScaleMode.html
+++ b/Docs/out/Phaser.StageScaleMode.html
@@ -23,13 +23,13 @@
@@ -3632,7 +3720,7 @@ Please note that this needs to be supported by the web browser and isn't the sam
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:45 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.State.html b/Docs/out/Phaser.State.html
index 87b6e742..1885f076 100644
--- a/Docs/out/Phaser.State.html
+++ b/Docs/out/Phaser.State.html
@@ -23,13 +23,13 @@
@@ -1638,7 +1726,7 @@ It provides quick access to common functions such as the camera, cache, input, m
-Phaser.TweenManager
+Phaser.TweenManager
@@ -2386,7 +2474,7 @@ If you need to use the loader, you may need to use them here.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:46 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.StateManager.html b/Docs/out/Phaser.StateManager.html
index 34a49233..06fbce89 100644
--- a/Docs/out/Phaser.StateManager.html
+++ b/Docs/out/Phaser.StateManager.html
@@ -23,13 +23,13 @@
@@ -2358,7 +2446,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:46 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Tween.html b/Docs/out/Phaser.Tween.html
new file mode 100644
index 00000000..d017c164
--- /dev/null
+++ b/Docs/out/Phaser.Tween.html
@@ -0,0 +1,3199 @@
+
+
+
+
+
+ Phaser Class: Tween
+
+
+
+
+
+
+
+
+
+
+
You can chain tweens together by passing a reference to the chain function. This enables one tween to call another on completion.
+You can pass as many tweens as you like to this function, they will each be chained in sequence.
A tween that has yoyo set to true will run through from start to finish, then reverse from finish to start.
+Used in combination with repeat you can create endless loops.
Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated.
+Tweens are hooked into the game clock and pause system, adjusting based on the game state.
+
TweenManager is based heavily on tween.js by http://soledadpenades.com.
+The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object.
+It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors.
+Please see https://github.com/sole/tween.js for a full list of contributors.
A collection of methods for displaying debug information about game objects. Phaser.Debug requires a CANVAS game type in order to render, so if you've got
+your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL doesn't kick in, then the Debug functions will all display.
@@ -1956,7 +2044,7 @@ the world at world-based coordinates. By default a world is created the same siz
Documentation generated by JSDoc 3.2.0-dev
- on Thu Oct 03 2013 01:18:46 GMT+0100 (BST) using the DocStrap template.
+ on Thu Oct 03 2013 02:35:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.html b/Docs/out/Phaser.html
new file mode 100644
index 00000000..37f7c00c
--- /dev/null
+++ b/Docs/out/Phaser.html
@@ -0,0 +1,602 @@
+
+
+
+
+
+ Phaser Namespace: Phaser
+
+
+
+
+
+
+
+
+
+
+
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* Time constructor.
+*
+* @class Phaser.Time
+* @classdesc This is the core internal game clock. It manages the elapsed time and calculation of elapsed values, used for game object motion and tweens.
+* @constructor
+* @param {Phaser.Game} game A reference to the currently running game.
+*/
+Phaser.Time = function (game) {
+
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
+ this.game = game;
+
+ /**
+ * The time at which the Game instance started.
+ * @property {number} _started
+ * @private
+ * @default
+ */
+ this._started = 0;
+
+ /**
+ * The time (in ms) that the last second counter ticked over.
+ * @property {number} _timeLastSecond
+ * @private
+ * @default
+ */
+ this._timeLastSecond = 0;
+
+ /**
+ * The time the game started being paused.
+ * @property {number} _pauseStarted
+ * @private
+ * @default
+ */
+ this._pauseStarted = 0;
+
+ /**
+ * The elapsed time calculated for the physics motion updates.
+ * @property {number} physicsElapsed
+ * @default
+ */
+ this.physicsElapsed = 0;
+
+ /**
+ * Game time counter.
+ * @property {number} time
+ * @default
+ */
+ this.time = 0;
+
+ /**
+ * Records how long the game has been paused for. Is reset each time the game pauses.
+ * @property {number} pausedTime
+ * @default
+ */
+ this.pausedTime = 0;
+
+ /**
+ * The time right now.
+ * @property {number} now
+ * @default
+ */
+ this.now = 0;
+
+ /**
+ * Elapsed time since the last frame.
+ * @property {number} elapsed
+ * @default
+ */
+ this.elapsed = 0;
+
+ /**
+ * Frames per second.
+ * @property {number} fps
+ * @default
+ */
+ this.fps = 0;
+
+ /**
+ * The lowest rate the fps has dropped to.
+ * @property {number} fpsMin
+ * @default
+ */
+ this.fpsMin = 1000;
+
+ /**
+ * The highest rate the fps has reached (usually no higher than 60fps).
+ * @property {number} fpsMax
+ * @default
+ */
+ this.fpsMax = 0;
+
+ /**
+ * The minimum amount of time the game has taken between two frames.
+ * @property {number} msMin
+ * @default
+ */
+ this.msMin = 1000;
+
+ /**
+ * The maximum amount of time the game has taken between two frames.
+ * @property {number} msMax
+ * @default
+ */
+ this.msMax = 0;
+
+ /**
+ * The number of frames record in the last second.
+ * @property {number} frames
+ * @default
+ */
+ this.frames = 0;
+
+ /**
+ * Records how long the game was paused for in miliseconds.
+ * @property {number} pauseDuration
+ * @default
+ */
+ this.pauseDuration = 0;
+
+ /**
+ * The value that setTimeout needs to work out when to next update
+ * @property {number} timeToCall
+ * @default
+ */
+ this.timeToCall = 0;
+
+ /**
+ * Internal value used by timeToCall as part of the setTimeout loop
+ * @property {number} lastTime
+ * @default
+ */
+ this.lastTime = 0;
+
+ // Listen for game pause/resume events
+ this.game.onPause.add(this.gamePaused, this);
+ this.game.onResume.add(this.gameResumed, this);
+
+ /**
+ * Description.
+ * @property {boolean} _justResumed
+ * @default
+ */
+ this._justResumed = false;
+
+};
+
+Phaser.Time.prototype = {
+
+ /**
+ * The number of seconds that have elapsed since the game was started.
+ * @method Phaser.Time#totalElapsedSeconds
+ * @return {number}
+ */
+ totalElapsedSeconds: function() {
+ return (this.now - this._started) * 0.001;
+ },
+
+ /**
+ * Updates the game clock and calculate the fps. This is called automatically by Phaser.Game.
+ * @method Phaser.Time#update
+ * @param {number} time - The current timestamp, either performance.now or Date.now depending on the browser.
+ */
+ update: function (time) {
+
+ this.now = time;
+
+ if (this._justResumed)
+ {
+ this.time = this.now;
+ this._justResumed = false;
+ }
+
+ this.timeToCall = this.game.math.max(0, 16 - (time - this.lastTime));
+
+ this.elapsed = this.now - this.time;
+
+ this.msMin = this.game.math.min(this.msMin, this.elapsed);
+ this.msMax = this.game.math.max(this.msMax, this.elapsed);
+
+ this.frames++;
+
+ if (this.now > this._timeLastSecond + 1000)
+ {
+ this.fps = Math.round((this.frames * 1000) / (this.now - this._timeLastSecond));
+ this.fpsMin = this.game.math.min(this.fpsMin, this.fps);
+ this.fpsMax = this.game.math.max(this.fpsMax, this.fps);
+ this._timeLastSecond = this.now;
+ this.frames = 0;
+ }
+
+ this.time = this.now;
+ this.lastTime = time + this.timeToCall;
+ this.physicsElapsed = 1.0 * (this.elapsed / 1000);
+
+ // Paused?
+ if (this.game.paused)
+ {
+ this.pausedTime = this.now - this._pauseStarted;
+ }
+
+ },
+
+ /**
+ * Called when the game enters a paused state.
+ * @method Phaser.Time#gamePaused
+ * @private
+ */
+ gamePaused: function () {
+
+ this._pauseStarted = this.now;
+
+ },
+
+ /**
+ * Called when the game resumes from a paused state.
+ * @method Phaser.Time#gameResumed
+ * @private
+ */
+ gameResumed: function () {
+
+ // Level out the elapsed timer to avoid spikes
+ this.time = Date.now();
+ this.pauseDuration = this.pausedTime;
+ this._justResumed = true;
+
+ },
+
+ /**
+ * How long has passed since the given time.
+ * @method Phaser.Time#elapsedSince
+ * @param {number} since - The time you want to measure against.
+ * @return {number} The difference between the given time and now.
+ */
+ elapsedSince: function (since) {
+ return this.now - since;
+ },
+
+ /**
+ * How long has passed since the given time (in seconds).
+ * @method Phaser.Time#elapsedSecondsSince
+ * @param {number} since - The time you want to measure (in seconds).
+ * @return {number} Duration between given time and now (in seconds).
+ */
+ elapsedSecondsSince: function (since) {
+ return (this.now - since) * 0.001;
+ },
+
+ /**
+ * Resets the private _started value to now.
+ * @method Phaser.Time#reset
+ */
+ reset: function () {
+ this._started = this.now;
+ }
+
+};
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* Phaser - TweenManager
+*
+* @class Phaser.TweenManager
+* @classdesc
+* Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated.
+* Tweens are hooked into the game clock and pause system, adjusting based on the game state.
+*
+* TweenManager is based heavily on tween.js by http://soledadpenades.com.
+* The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object.
+* It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors.
+* Please see https://github.com/sole/tween.js for a full list of contributors.
+* @constructor
+*
+* @param {Phaser.Game} game - A reference to the currently running game.
+*/
+Phaser.TweenManager = function (game) {
+
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
+ this.game = game;
+
+ /**
+ * @property {array} _tweens - Description.
+ * @private
+ */
+ this._tweens = [];
+
+ /**
+ * @property {array} _add - Description.
+ * @private
+ */
+ this._add = [];
+
+ this.game.onPause.add(this.pauseAll, this);
+ this.game.onResume.add(this.resumeAll, this);
+
+};
+
+Phaser.TweenManager.prototype = {
+
+ /**
+ * Version number of this library.
+ * @property {string} REVISION
+ * @default
+ */
+ REVISION: '11dev',
+
+ /**
+ * Get all the tween objects in an array.
+ * @method Phaser.TweenManager#getAll
+ * @returns {Phaser.Tween[]} Array with all tween objects.
+ */
+ getAll: function () {
+
+ return this._tweens;
+
+ },
+
+ /**
+ * Remove all tween objects.
+ * @method Phaser.TweenManager#removeAll
+ */
+ removeAll: function () {
+
+ this._tweens = [];
+
+ },
+
+ /**
+ * Add a new tween into the TweenManager.
+ *
+ * @method Phaser.TweenManager#add
+ * @param {Phaser.Tween} tween - The tween object you want to add.
+ * @returns {Phaser.Tween} The tween object you added to the manager.
+ */
+ add: function ( tween ) {
+
+ this._add.push( tween );
+
+ },
+
+ /**
+ * Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
+ *
+ * @method Phaser.TweenManager#create
+ * @param {Object} object - Object the tween will be run on.
+ * @returns {Phaser.Tween} The newly created tween object.
+ */
+ create: function (object) {
+
+ return new Phaser.Tween(object, this.game);
+
+ },
+
+ /**
+ * Remove a tween from this manager.
+ *
+ * @method Phaser.TweenManager#remove
+ * @param {Phaser.Tween} tween - The tween object you want to remove.
+ */
+ remove: function ( tween ) {
+
+ var i = this._tweens.indexOf( tween );
+
+ if ( i !== -1 ) {
+
+ this._tweens[i].pendingDelete = true;
+
+ }
+
+ },
+
+ /**
+ * Update all the tween objects you added to this manager.
+ *
+ * @method Phaser.TweenManager#update
+ * @returns {boolean} Return false if there's no tween to update, otherwise return true.
+ */
+ update: function () {
+
+ if ( this._tweens.length === 0 && this._add.length === 0 ) return false;
+
+ var i = 0;
+ var numTweens = this._tweens.length;
+
+ while ( i < numTweens ) {
+
+ if ( this._tweens[ i ].update( this.game.time.now ) ) {
+
+ i++;
+
+ } else {
+
+ this._tweens.splice( i, 1 );
+
+ numTweens--;
+
+ }
+
+ }
+
+ // If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
+ if (this._add.length > 0)
+ {
+ this._tweens = this._tweens.concat(this._add);
+ this._add.length = 0;
+ }
+
+ return true;
+
+ },
+
+ /**
+ * Pauses all currently running tweens.
+ *
+ * @method Phaser.TweenManager#update
+ */
+ pauseAll: function () {
+
+ for (var i = this._tweens.length - 1; i >= 0; i--) {
+ this._tweens[i].pause();
+ };
+
+ },
+
+ /**
+ * Pauses all currently paused tweens.
+ *
+ * @method Phaser.TweenManager#resumeAll
+ */
+ resumeAll: function () {
+
+ for (var i = this._tweens.length - 1; i >= 0; i--) {
+ this._tweens[i].resume();
+ };
+
+ }
+
+};
A feature-packed 2D HTML5 game framework born from the smouldering pits of Flixel and
+constructed via plenty of blood, sweat, tears and coffee by Richard Davey (@photonstorm).
+
Phaser uses Pixi.js for rendering, created by Mat Groves http://matgroves.com/ @Doormat23.
Many thanks to Adam Saltsman (@ADAMATOMIC) for releasing Flixel, from both which Phaser
+and my love of game development originate.
+
"If you want your children to be intelligent, read them fairy tales."
+"If you want them to be more intelligent, read them more fairy tales."
+ -- Albert Einstein
Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated.
+Tweens are hooked into the game clock and pause system, adjusting based on the game state.
+
TweenManager is based heavily on tween.js by http://soledadpenades.com.
+The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object.
+It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors.
+Please see https://github.com/sole/tween.js for a full list of contributors.
Set the min value to start each channel from the given offset.
*
Set the max value to restrict the maximum color used per channel
*
- * @method getRandomColor
+ * @method Phaser.Color.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).
* @returns {number} 32-bit color value with alpha.
*/
getRandomColor: function (min, max, alpha) {
+
if (typeof min === "undefined") { min = 0; }
if (typeof max === "undefined") { max = 255; }
if (typeof alpha === "undefined") { alpha = 255; }
+
// Sanity checks
if (max > 255) {
return Phaser.Color.getColor(255, 255, 255);
}
+
if (min > max) {
return Phaser.Color.getColor(255, 255, 255);
}
+
var red = min + Math.round(Math.random() * (max - min));
var green = min + Math.round(Math.random() * (max - min));
var blue = min + Math.round(Math.random() * (max - min));
+
return Phaser.Color.getColor32(alpha, red, green, blue);
+
},
/**
@@ -211,37 +237,42 @@ Phaser.Color = {
*
*
Alpha will only be set if it exist in the given color (0xAARRGGBB)
*
- * @method getRGB
+ * @method Phaser.Color.getRGB
* @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 {
alpha: color >>> 24,
red: color >> 16 & 0xFF,
green: color >> 8 & 0xFF,
blue: color & 0xFF
};
+
},
/**
* Returns a CSS friendly string value from the given color.
- * @method getWebRGB
+ * @method Phaser.Color.getWebRGB
* @param {number} color
* @returns {string}A string in the format: 'rgba(r,g,b,a)'
*/
getWebRGB: function (color) {
+
var alpha = (color >>> 24) / 255;
var red = color >> 16 & 0xFF;
var green = color >> 8 & 0xFF;
var blue = color & 0xFF;
+
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.
*
- * @method getAlpha
+ * @method Phaser.Color.getAlpha
* @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)).
*/
@@ -252,7 +283,7 @@ Phaser.Color = {
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component as a value between 0 and 1.
*
- * @method getAlphaFloat
+ * @method Phaser.Color.getAlphaFloat
* @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)).
*/
@@ -263,7 +294,7 @@ Phaser.Color = {
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Red component, as a value between 0 and 255.
*
- * @method getRed
+ * @method Phaser.Color.getRed
* @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).
*/
@@ -274,7 +305,7 @@ Phaser.Color = {
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Green component, as a value between 0 and 255.
*
- * @method getGreen
+ * @method Phaser.Color.getGreen
* @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).
*/
@@ -285,7 +316,7 @@ Phaser.Color = {
/**
* Given a native color value (in the format 0xAARRGGBB) this will return the Blue component, as a value between 0 and 255.
*
- * @method getBlue
+ * @method Phaser.Color.getBlue
* @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).
*/
diff --git a/src/utils/Debug.js b/src/utils/Debug.js
index 2b9ae089..60a6ece5 100644
--- a/src/utils/Debug.js
+++ b/src/utils/Debug.js
@@ -2,11 +2,11 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @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.
+* A collection of methods for displaying debug information about game objects. Phaser.Debug requires a CANVAS game type in order to render, so if you've got
+* your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL doesn't kick in, then the Debug functions will all display.
*
* @class Phaser.Utils.Debug
* @constructor
@@ -20,40 +20,40 @@ Phaser.Utils.Debug = function (game) {
this.game = game;
/**
- * @property {Context} context - Description.
+ * @property {Context} context - The canvas context on which to render the debug information.
*/
this.context = game.context;
/**
- * @property {string} font - Description.
+ * @property {string} font - The font that the debug information is rendered in.
* @default '14px Courier'
*/
this.font = '14px Courier';
/**
- * @property {number} lineHeight - Description.
+ * @property {number} lineHeight - The line height between the debug text.
*/
this.lineHeight = 16;
/**
- * @property {boolean} renderShadow - Description.
+ * @property {boolean} renderShadow - Should the text be rendered with a slight shadow? Makes it easier to read on different types of background.
*/
this.renderShadow = true;
/**
- * @property {Context} currentX - Description.
+ * @property {Context} currentX - The current X position the debug information will be rendered at.
* @default
*/
this.currentX = 0;
/**
- * @property {number} currentY - Description.
+ * @property {number} currentY - The current Y position the debug information will be rendered at.
* @default
*/
this.currentY = 0;
/**
- * @property {number} currentAlpha - Description.
+ * @property {number} currentAlpha - The current alpha the debug information will be rendered at.
* @default
*/
this.currentAlpha = 1;
@@ -63,8 +63,8 @@ Phaser.Utils.Debug = function (game) {
Phaser.Utils.Debug.prototype = {
/**
- * Internal method that resets the debug output values.
- * @method start
+ * Internal method that resets and starts the debug output values.
+ * @method Phaser.Utils.Debug#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.
@@ -97,6 +97,10 @@ Phaser.Utils.Debug.prototype = {
},
+ /**
+ * Internal method that stops the debug output.
+ * @method Phaser.Utils.Debug#stop
+ */
stop: function () {
this.context.restore();
@@ -106,7 +110,7 @@ Phaser.Utils.Debug.prototype = {
/**
* Internal method that outputs a single line of text.
- * @method line
+ * @method Phaser.Utils.Debug#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.
@@ -142,11 +146,11 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
- * @method renderQuadTree
- * @param {Description} quadtree - Description.
- * @param {string} color - Description.
- */
+ * 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)';
@@ -182,12 +186,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
- * @method renderSpriteCorners
+ * Renders the corners and point information of the given Sprite.
+ * @method Phaser.Utils.Debug#renderSpriteCorners
* @param {Phaser.Sprite} sprite - The sprite to be rendered.
- * @param {boolean} showText - Description.
- * @param {boolean} showBounds - Description.
- * @param {string} color - Description.
+ * @param {boolean} [showText=false] - If true the x/y coordinates of each point will be rendered.
+ * @param {boolean} [showBounds=false] - If true the bounds will be rendered over the top of the sprite.
+ * @param {string} [color='rgb(255,0,255)'] - The color the text is rendered in.
*/
renderSpriteCorners: function (sprite, showText, showBounds, color) {
@@ -238,12 +242,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Render debug infos (including id, position, rotation, scrolling factor, worldBounds and some other properties).
- * @method renderSoundInfo
- * @param {Description} sound - Description.
+ * Render Sound information, including decoded state, duration, volume and more.
+ * @method Phaser.Utils.Debug#renderSoundInfo
+ * @param {Phaser.Sound} sound - The sound object to debug.
* @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} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderSoundInfo: function (sound, x, y, color) {
@@ -275,12 +279,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Render debug infos. (including id, position, rotation, scrolling factor, worldBounds and some other properties)
- * @method renderCameraInfo
- * @param {Description} camera - Description.
+ * Render camera information including dimensions and location.
+ * @method Phaser.Utils.Debug#renderCameraInfo
+ * @param {Phaser.Camera} 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)
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderCameraInfo: function (camera, x, y, color) {
@@ -289,7 +293,7 @@ Phaser.Utils.Debug.prototype = {
return;
}
- color = color || 'rgb(255,255,0)';
+ color = color || 'rgb(255,255,255)';
this.start(x, y, color);
this.line('Camera (' + camera.width + ' x ' + camera.height + ')');
@@ -299,13 +303,13 @@ 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 {boolean} hideIfUp - Description.
- * @param {string} downColor - Description.
- * @param {string} upColor - Description.
- * @param {string} color - Description.
+ * Renders the Pointer.circle object onto the stage in green if down or red if up along with debug text.
+ * @method Phaser.Utils.Debug#renderDebug
+ * @param {Phaser.Pointer} pointer - Description.
+ * @param {boolean} [hideIfUp=false] - Doesn't render the circle if the pointer is up.
+ * @param {string} [downColor='rgba(0,255,0,0.5)'] - The color the circle is rendered in if down.
+ * @param {string} [upColor='rgba(255,0,0,0.5)'] - The color the circle is rendered in if up (and hideIfUp is false).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderPointer: function (pointer, hideIfUp, downColor, upColor, color) {
@@ -314,7 +318,7 @@ Phaser.Utils.Debug.prototype = {
return;
}
- hideIfUp = hideIfUp || false;
+ if (typeof hideIfUp === 'undefined') { hideIfUp = false; }
downColor = downColor || 'rgba(0,255,0,0.5)';
upColor = upColor || 'rgba(255,0,0,0.5)';
color = color || 'rgb(255,255,255)';
@@ -360,11 +364,11 @@ Phaser.Utils.Debug.prototype = {
/**
* Render Sprite Input Debug information.
- * @method renderSpriteInputInfo
+ * @method Phaser.Utils.Debug#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).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderSpriteInputInfo: function (sprite, x, y, color) {
@@ -382,11 +386,11 @@ Phaser.Utils.Debug.prototype = {
/**
* Render Sprite collision.
- * @method renderSpriteCollision
+ * @method Phaser.Utils.Debug#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).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderSpriteCollision: function (sprite, x, y, color) {
@@ -406,10 +410,10 @@ Phaser.Utils.Debug.prototype = {
/**
* Render debug information about the Input object.
- * @method renderInputInfo
+ * @method Phaser.Utils.Debug#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)
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderInputInfo: function (x, y, color) {
@@ -431,12 +435,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Render debug infos (including name, bounds info, position and some other properties).
- * @method renderSpriteInfo
+ * Render debug infos (including name, bounds info, position and some other properties) about the Sprite.
+ * @method Phaser.Utils.Debug#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).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderSpriteInfo: function (sprite, x, y, color) {
@@ -480,12 +484,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Render debug infos (including name, bounds info, position and some other properties).
- * @method renderWorldTransformInfo
+ * Render the World Transform information of the given Sprite.
+ * @method Phaser.Utils.Debug#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).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderWorldTransformInfo: function (sprite, x, y, color) {
@@ -509,12 +513,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
- * @method renderLocalTransformInfo
+ * Render the Local Transform information of the given Sprite.
+ * @method Phaser.Utils.Debug#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).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderLocalTransformInfo: function (sprite, x, y, color) {
@@ -540,12 +544,12 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
- * @method renderPointInfo
- * @param {Phaser.Sprite} sprite - Description.
+ * Renders Point coordinates in the given color.
+ * @method Phaser.Utils.Debug#renderPointInfo
+ * @param {Phaser.Point} 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).
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
renderPointInfo: function (point, x, y, color) {
@@ -563,8 +567,8 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
- * @method renderSpriteBounds
+ * Renders just the Sprite.body bounds.
+ * @method Phaser.Utils.Debug#renderSpriteBody
* @param {Phaser.Sprite} sprite - Description.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
@@ -587,6 +591,13 @@ Phaser.Utils.Debug.prototype = {
},
+ /**
+ * Renders just the full Sprite bounds.
+ * @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} [fill=false] - If false the bounds outline is rendered, if true the whole rectangle is rendered.
+ */
renderSpriteBounds: function (sprite, color, fill) {
if (this.context == null)
@@ -596,6 +607,8 @@ Phaser.Utils.Debug.prototype = {
color = color || 'rgb(255,0,255)';
+ if (typeof fill === 'undefined') { fill = false; }
+
this.start(0, 0, color);
if (fill)
@@ -615,90 +628,90 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
- * @method renderPixel
+ * Renders a single pixel.
+ * @method Phaser.Utils.Debug#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.
+ * @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
- renderPixel: function (x, y, fillStyle) {
+ renderPixel: function (x, y, color) {
if (this.context == null)
{
return;
}
- fillStyle = fillStyle || 'rgba(0,255,0,1)';
+ color = color || 'rgba(0,255,0,1)';
this.start();
- this.context.fillStyle = fillStyle;
+ this.context.fillStyle = color;
this.context.fillRect(x, y, 2, 2);
this.stop();
},
/**
- * Description.
- * @method renderPoint
- * @param {Description} point - Description.
- * @param {string} fillStyle - Description.
- */
- renderPoint: function (point, fillStyle) {
+ * Renders a Point object.
+ * @method Phaser.Utils.Debug#renderPoint
+ * @param {Phaser.Point} point - The Point to render.
+ * @param {string} [color] - Color of the debug info to be rendered (format is css color string).
+ */
+ renderPoint: function (point, color) {
if (this.context == null)
{
return;
}
- fillStyle = fillStyle || 'rgba(0,255,0,1)';
+ color = color || 'rgba(0,255,0,1)';
this.start();
- this.context.fillStyle = fillStyle;
+ this.context.fillStyle = color;
this.context.fillRect(point.x, point.y, 4, 4);
this.stop();
},
/**
- * Description.
- * @method renderRectangle
- * @param {Description} rect - Description.
- * @param {string} fillStyle - Description.
+ * Renders a Rectangle.
+ * @method Phaser.Utils.Debug#renderRectangle
+ * @param {Phaser.Rectangle} rect - The Rectangle to render.
+ * @param {string} [color] - Color of the debug info to be rendered (format is css color string).
*/
- renderRectangle: function (rect, fillStyle) {
+ renderRectangle: function (rect, color) {
if (this.context == null)
{
return;
}
- fillStyle = fillStyle || 'rgba(0,255,0,0.3)';
+ color = color || 'rgba(0,255,0,0.3)';
this.start();
- this.context.fillStyle = fillStyle;
+ this.context.fillStyle = color;
this.context.fillRect(rect.x, rect.y, rect.width, rect.height);
this.stop();
},
/**
- * Description.
- * @method renderCircle
- * @param {Description} circle - Description.
- * @param {string} fillStyle - Description.
- */
- renderCircle: function (circle, fillStyle) {
+ * Renders a Circle.
+ * @method Phaser.Utils.Debug#renderCircle
+ * @param {Phaser.Circle} circle - The Circle to render.
+ * @param {string} [color] - Color of the debug info to be rendered (format is css color string).
+ */
+ renderCircle: function (circle, color) {
if (this.context == null)
{
return;
}
- fillStyle = fillStyle || 'rgba(0,255,0,0.3)';
+ color = color || 'rgba(0,255,0,0.3)';
this.start();
this.context.beginPath();
- this.context.fillStyle = fillStyle;
+ this.context.fillStyle = color;
this.context.arc(circle.x, circle.y, circle.radius, 0, Math.PI * 2, false);
this.context.fill();
this.context.closePath();
@@ -708,9 +721,9 @@ Phaser.Utils.Debug.prototype = {
/**
* Render text.
- * @method renderText
+ * @method Phaser.Utils.Debug#renderText
* @param {string} text - The line of text to draw.
- * @param{number} x - X position of the debug info 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).
* @param {string} font - The font of text to draw.
@@ -734,9 +747,10 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Description.
+ * Dumps the Linked List to the console.
*
- * @method Phaser.LinkedList#dump
+ * @method Phaser.Utils.Debug#Phaser.LinkedList#dump
+ * @param {Phaser.LinkedList} list - The LinkedList to dump.
*/
dumpLinkedList: function (list) {
diff --git a/src/utils/Utils.js b/src/utils/Utils.js
index f47441ef..7aeb7df4 100644
--- a/src/utils/Utils.js
+++ b/src/utils/Utils.js
@@ -2,27 +2,25 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Utils
*/
/**
-*
-* @class Utils
+* @class Phaser.Utils
* @static
*/
Phaser.Utils = {
/**
- * Javascript string pad ({@link http://www.webtoolkit.info/})
+ * Javascript string pad http://www.webtoolkit.info/.
* pad = the string to pad it out with (defaults to a space)
* dir = 1 (left), 2 (right), 3 (both)
- * @method pad
+ * @method Phaser.Utils.pad
* @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) {
if (typeof(len) == "undefined") { var len = 0; }
@@ -54,10 +52,10 @@ Phaser.Utils = {
},
/**
- * This is a slightly modified version of jQuery.isPlainObject.
- * @method isPlainObject
- * @param {object} obj - Description.
- * @return {boolean} - Description.
+ * This is a slightly modified version of jQuery.isPlainObject. A plain object is an object whose internal class property is [object Object].
+ * @method Phaser.Utils.isPlainObject
+ * @param {object} obj - The object to inspect.
+ * @return {boolean} - true if the object is plain, otherwise false.
*/
isPlainObject: function (obj) {
@@ -96,9 +94,9 @@ Phaser.Utils = {
// 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
- * @return {Description} Description.
+ * This is a slightly modified version of http://api.jquery.com/jQuery.extend/
+ * @method Phaser.Utils.extend
+ * @return {object} The extended object.
*/
extend: function () {
@@ -178,7 +176,6 @@ Phaser.Utils = {
/**
* Converts a hex color number to an [R, G, B] array
*
- * @method HEXtoRGB
* @param {number} hex
* @return {array}
*/
@@ -188,8 +185,6 @@ function HEXtoRGB(hex) {
/**
* A polyfill for Function.prototype.bind
- *
- * @method bind
*/
if (typeof Function.prototype.bind != 'function') {
Function.prototype.bind = (function () {