@@ -229,8 +277,9 @@ Phaser.Input.prototype = {
/**
* A vector object representing the previous position of the Pointer.
* @property {Vec2} vector
+ * @private
* @default
- **/
+ */
_oldPosition: null,
/**
@@ -265,31 +314,31 @@ Phaser.Input.prototype = {
/**
* A vector object representing the current position of the Pointer.
- * @property {Vec2} position
+ * @property {Phaser.Point} position
* @default
- **/
+ */
position: null,
/**
* A vector object representing the speed of the Pointer. Only really useful in single Pointer games,
* otherwise see the Pointer objects directly.
- * @property {Vec2} speed
+ * @property {Phaser.Point} speed
* @default
- **/
+ */
speed: null,
/**
* A Circle object centered on the x/y screen coordinates of the Input.
- * Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
- * @property {Circle} circle
+ * Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything.
+ * @property {Phaser.Circle} circle
* @default
- **/
+ */
circle: null,
/**
* The scale by which all input coordinates are multiplied, calculated by the StageScaleMode.
* In an un-scaled game the values will be x: 1 and y: 1.
- * @property {Vec2} scale
+ * @property {Phaser.Point} scale
* @default
*/
scale: null,
@@ -313,35 +362,35 @@ Phaser.Input.prototype = {
* The number of milliseconds that the Pointer has to be pressed down and then released to be considered a tap or clicke
* @property {number} tapRate
* @default
- **/
+ */
tapRate: 200,
/**
* The number of milliseconds between taps of the same Pointer for it to be considered a double tap / click
* @property {number} doubleTapRate
* @default
- **/
+ */
doubleTapRate: 300,
/**
* The number of milliseconds that the Pointer has to be pressed down for it to fire a onHold event
* @property {number} holdRate
* @default
- **/
+ */
holdRate: 2000,
/**
* The number of milliseconds below which the Pointer is considered justPressed
* @property {number} justPressedRate
* @default
- **/
+ */
justPressedRate: 200,
/**
* The number of milliseconds below which the Pointer is considered justReleased
* @property {number} justReleasedRate
* @default
- **/
+ */
justReleasedRate: 200,
/**
@@ -350,7 +399,7 @@ Phaser.Input.prototype = {
* The history is updated at the rate specified in Input.pollRate
* @property {boolean} recordPointerHistory
* @default
- **/
+ */
recordPointerHistory: false,
/**
@@ -370,143 +419,146 @@ Phaser.Input.prototype = {
/**
* A Pointer object
- * @property {Pointer} pointer1
- **/
+ * @property {Phaser.Pointer} pointer1
+ */
pointer1: null,
/**
* A Pointer object
- * @property {Pointer} pointer2
- **/
+ * @property {Phaser.Pointer} pointer2
+ */
pointer2: null,
/**
* A Pointer object
- * @property {Pointer} pointer3
- **/
+ * @property {Phaser.Pointer} pointer3
+ */
pointer3: null,
/**
* A Pointer object
- * @property {Pointer} pointer4
- **/
+ * @property {Phaser.Pointer} pointer4
+ */
pointer4: null,
/**
* A Pointer object
- * @property {Pointer} pointer5
- **/
+ * @property {Phaser.Pointer} pointer5
+ */
pointer5: null,
/**
* A Pointer object
- * @property {Pointer} pointer6
- **/
+ * @property {Phaser.Pointer} pointer6
+ */
pointer6: null,
/**
* A Pointer object
- * @property {Pointer} pointer7
- **/
+ * @property {Phaser.Pointer} pointer7
+ */
pointer7: null,
/**
* A Pointer object
- * @property {Pointer} pointer8
- **/
+ * @property {Phaser.Pointer} pointer8
+ */
pointer8: null,
/**
* A Pointer object
- * @property {Pointer} pointer9
- **/
+ * @property {Phaser.Pointer} pointer9
+ */
pointer9: null,
/**
* A Pointer object.
- * @property {Pointer} pointer10
- **/
+ * @property {Phaser.Pointer} pointer10
+ */
pointer10: null,
/**
* The most recently active Pointer object.
* When you've limited max pointers to 1 this will accurately be either the first finger touched or mouse.
- * @property {Pointer} activePointer
+ * @property {Phaser.Pointer} activePointer
* @default
- **/
+ */
activePointer: null,
/**
- * Description.
+ * The mouse has its own unique Phaser.Pointer object which you can use if making a desktop specific game.
* @property {Pointer} mousePointer
* @default
- **/
+ */
mousePointer: null,
/**
- * Description.
- * @property {Description} mouse
+ * The Mouse Input manager.
+ * @property {Phaser.Mouse} mouse - The Mouse Input manager.
* @default
- **/
+ */
mouse: null,
/**
- * Description.
- * @property {Description} keyboard
+ * The Keyboard Input manager.
+ * @property {Phaser.Keyboard} keyboard - The Keyboard Input manager.
* @default
- **/
+ */
keyboard: null,
/**
- * Description.
- * @property {Description} touch
+ * The Touch Input manager.
+ * @property {Phaser.Touch} touch - the Touch Input manager.
* @default
- **/
+ */
touch: null,
/**
- * Description.
- * @property {Description} mspointer
+ * The MSPointer Input manager.
+ * @property {Phaser.MSPointer} mspointer - The MSPointer Input manager.
* @default
- **/
+ */
mspointer: null,
/**
- * Description.
- * @property {Description} onDown
+ * A Signal that is dispatched each time a pointer is pressed down.
+ * @property {Phaser.Signal} onDown
* @default
- **/
+ */
onDown: null,
/**
- * Description.
- * @property {Description} onUp
+ * A Signal that is dispatched each time a pointer is released.
+ * @property {Phaser.Signal} onUp
* @default
- **/
+ */
onUp: null,
/**
- * Description.
- * @property {Description} onTap
+ * A Signal that is dispatched each time a pointer is tapped.
+ * @property {Phaser.Signal} onTap
* @default
- **/
+ */
onTap: null,
/**
- * Description.
- * @property {Description} onHold
+ * A Signal that is dispatched each time a pointer is held down.
+ * @property {Phaser.Signal} onHold
* @default
- **/
+ */
onHold: null,
- // A linked list of interactive objects, the InputHandler components (belong to Sprites) register themselves with this
+ /**
+ * A linked list of interactive objects, the InputHandler components (belonging to Sprites) register themselves with this.
+ * @property {Phaser.LinkedList} interactiveItems
+ */
interactiveItems: new Phaser.LinkedList(),
/**
* Starts the Input Manager running.
* @method Phaser.Input#boot
* @protected
- **/
+ */
boot: function () {
this.mousePointer = new Phaser.Pointer(this.game, 0);
@@ -547,11 +599,11 @@ Phaser.Input.prototype = {
},
/**
- * Add a new Pointer object to the Input Manager. By default Input creates 2 pointer objects for you. If you need more
- * use this to create a new one, up to a maximum of 10.
+ * Add a new Pointer object to the Input Manager. By default Input creates 3 pointer objects: mousePointer, pointer1 and pointer2.
+ * If you need more then use this to create a new one, up to a maximum of 10.
* @method Phaser.Input#addPointer
- * @return {Pointer} A reference to the new Pointer object.
- **/
+ * @return {Phaser.Pointer} A reference to the new Pointer object that was created.
+ */
addPointer: function () {
var next = 0;
@@ -581,7 +633,7 @@ Phaser.Input.prototype = {
* Updates the Input Manager. Called by the core Game loop.
* @method Phaser.Input#update
* @protected
- **/
+ */
update: function () {
if (this.pollRate > 0 && this._pollCounter < this.pollRate)
@@ -614,8 +666,8 @@ Phaser.Input.prototype = {
/**
* Reset all of the Pointers and Input states
* @method Phaser.Input#reset
- * @param {boolean} hard - A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
- **/
+ * @param {boolean} hard - A soft reset (hard = false) won't reset any Signals that might be bound. A hard reset will.
+ */
reset: function (hard) {
if (this.game.isBooted == false)
@@ -662,7 +714,7 @@ Phaser.Input.prototype = {
* @method Phaser.Input#resetSpeed
* @param {number} x - Sets the oldPosition.x value.
* @param {number} y - Sets the oldPosition.y value.
- **/
+ */
resetSpeed: function (x, y) {
this._oldPosition.setTo(x, y);
@@ -671,11 +723,11 @@ Phaser.Input.prototype = {
},
/**
- * Find the first free Pointer object and start it, passing in the event data.
+ * Find the first free Pointer object and start it, passing in the event data. This is called automatically by Phaser.Touch and Phaser.MSPointer.
* @method Phaser.Input#startPointer
* @param {Any} event - The event data from the Touch event.
* @return {Phaser.Pointer} The Pointer object that was started or null if no Pointer object is available.
- **/
+ */
startPointer: function (event) {
if (this.maxPointers < 10 && this.totalActivePointers == this.maxPointers)
@@ -707,7 +759,7 @@ Phaser.Input.prototype = {
},
/**
- * Updates the matching Pointer object, passing in the event data.
+ * Updates the matching Pointer object, passing in the event data. This is called automatically and should not normally need to be invoked.
* @method Phaser.Input#updatePointer
* @param {Any} event - The event data from the Touch event.
* @return {Phaser.Pointer} The Pointer object that was updated or null if no Pointer object is available.
@@ -856,8 +908,6 @@ Phaser.Input.prototype = {
};
-// Getters / Setters
-
/**
* The X coordinate of the most recently active pointer. This value takes game scaling into account automatically. See Pointer.screenX/clientX for source values.
* @name Phaser.Input#x
@@ -991,7 +1041,7 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", {
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:47 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/InputHandler.js.html b/Docs/out/InputHandler.js.html
new file mode 100644
index 00000000..83cdbd0e
--- /dev/null
+++ b/Docs/out/InputHandler.js.html
@@ -0,0 +1,1315 @@
+
+
+
+
+
+ Phaser Source: input/InputHandler.js
+
+
+
+
+
+
+
+
+
+
+
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* @class Phaser.Key
+* @classdesc If you need more fine-grained control over the handling of specific keys you can create and use Phaser.Key objects.
+* @constructor
+* @param {Phaser.Game} game - Current game instance.
+* @param {number} keycode - The key code this Key is responsible for.
+*/
+Phaser.Key = function (game, keycode) {
+
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running game.
+ */
+ this.game = game;
+
+ /**
+ * @property {boolean} isDown - The "down" state of the key.
+ * @default
+ */
+ this.isDown = false;
+
+ /**
+ * @property {boolean} isUp - The "up" state of the key.
+ * @default
+ */
+ this.isUp = false;
+
+ /**
+ * @property {boolean} altKey - The down state of the ALT key, if pressed at the same time as this key.
+ * @default
+ */
+ this.altKey = false;
+
+ /**
+ * @property {boolean} ctrlKey - The down state of the CTRL key, if pressed at the same time as this key.
+ * @default
+ */
+ this.ctrlKey = false;
+
+ /**
+ * @property {boolean} shiftKey - The down state of the SHIFT key, if pressed at the same time as this key.
+ * @default
+ */
+ this.shiftKey = false;
+
+ /**
+ * @property {number} timeDown - The timestamp when the key was last pressed down.
+ * @default
+ */
+ this.timeDown = 0;
+
+ /**
+ * If the key is down this value holds the duration of that key press and is constantly updated.
+ * If the key is up it holds the duration of the previous down session.
+ * @property {number} duration - The number of milliseconds this key has been held down for.
+ * @default
+ */
+ this.duration = 0;
+
+ /**
+ * @property {number} timeUp - The timestamp when the key was last released.
+ * @default
+ */
+ this.timeUp = 0;
+
+ /**
+ * @property {number} repeats - If a key is held down this holds down the number of times the key has 'repeated'.
+ * @default
+ */
+ this.repeats = 0;
+
+ /**
+ * @property {number} keyCode - The keycode of this key.
+ */
+ this.keyCode = keycode;
+
+ /**
+ * @property {Phaser.Signal} onDown - This Signal is dispatched every time this Key is pressed down. It is only dispatched once (until the key is released again).
+ */
+ this.onDown = new Phaser.Signal();
+
+ /**
+ * @property {Phaser.Signal} onUp - This Signal is dispatched every time this Key is pressed down. It is only dispatched once (until the key is released again).
+ */
+ this.onUp = new Phaser.Signal();
+
+};
+
+Phaser.Key.prototype = {
+
+ /**
+ * Called automatically by Phaser.Keyboard.
+ * @method Phaser.Key#processKeyDown
+ * @param {KeyboardEvent} event.
+ * @protected
+ */
+ processKeyDown: function (event) {
+
+ this.altKey = event.altKey;
+ this.ctrlKey = event.ctrlKey;
+ this.shiftKey = event.shiftKey;
+
+ if (this.isDown)
+ {
+ // Key was already held down, this must be a repeat rate based event
+ this.duration = event.timeStamp - this.timeDown;
+ this.repeats++;
+ }
+ else
+ {
+ this.isDown = true;
+ this.isUp = false;
+ this.timeDown = event.timeStamp;
+ this.duration = 0;
+ this.repeats = 0;
+
+ this.onDown.dispatch(this);
+ }
+
+ },
+
+ /**
+ * Called automatically by Phaser.Keyboard.
+ * @method Phaser.Key#processKeyUp
+ * @param {KeyboardEvent} event.
+ * @protected
+ */
+ processKeyUp: function (event) {
+
+ this.isDown = false;
+ this.isUp = true;
+ this.timeUp = event.timeStamp;
+
+ this.onUp.dispatch(this);
+
+ },
+
+ /**
+ * Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given (default 250ms)
+ * @method Phaser.Key#justPressed
+ * @param {number} [duration=250] - The duration below which the key is considered as being just pressed.
+ * @return {boolean} True if the key is just pressed otherwise false.
+ */
+ justPressed: function (duration) {
+
+ if (typeof duration === "undefined") { duration = 250; }
+
+ return (this.isDown && this.duration < duration);
+
+ },
+
+ /**
+ * Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given (default 250ms)
+ * @method Phaser.Key#justPressed
+ * @param {number} [duration=250] - The duration below which the key is considered as being just released.
+ * @return {boolean} True if the key is just released otherwise false.
+ */
+ justReleased: function (duration) {
+
+ if (typeof duration === "undefined") { duration = 250; }
+
+ return (this.isDown == false && (this.game.time.now - this.timeUp < duration));
+
+ }
+
+};
+
/**
+* @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 mathematical methods.
+*
+* @class Phaser.Math
+*/
+Phaser.Math = {
+
+ /**
+ * = 2 π
+ * @method Phaser.Math#PI2
+ */
+ PI2: Math.PI * 2,
+
+ /**
+ * Two number are fuzzyEqual if their difference is less than ε.
+ * @method Phaser.Math#fuzzyEqual
+ * @param {number} a
+ * @param {number} b
+ * @param {number} epsilon
+ * @return {boolean} True if |a-b|<ε
+ */
+ fuzzyEqual: function (a, b, epsilon) {
+ if (typeof epsilon === "undefined") { epsilon = 0.0001; }
+ return Math.abs(a - b) < epsilon;
+ },
+
+ /**
+ * a is fuzzyLessThan b if it is less than b + ε.
+ * @method Phaser.Math#fuzzyEqual
+ * @param {number} a
+ * @param {number} b
+ * @param {number} epsilon
+ * @return {boolean} True if a<b+ε
+ */
+ fuzzyLessThan: function (a, b, epsilon) {
+ if (typeof epsilon === "undefined") { epsilon = 0.0001; }
+ return a < b + epsilon;
+ },
+
+ /**
+ * a is fuzzyGreaterThan b if it is more than b - ε.
+ * @method Phaser.Math#fuzzyGreaterThan
+ * @param {number} a
+ * @param {number} b
+ * @param {number} epsilon
+ * @return {boolean} True if a>b+ε
+ */
+ fuzzyGreaterThan: function (a, b, epsilon) {
+ if (typeof epsilon === "undefined") { epsilon = 0.0001; }
+ return a > b - epsilon;
+ },
+
+ /**
+ * @method Phaser.Math#fuzzyCeil
+ * @param {number} val
+ * @param {number} epsilon
+ * @return {boolean} ceiling(val-ε)
+ */
+ fuzzyCeil: function (val, epsilon) {
+ if (typeof epsilon === "undefined") { epsilon = 0.0001; }
+ return Math.ceil(val - epsilon);
+ },
+
+ /**
+ * @method Phaser.Math#fuzzyFloor
+ * @param {number} val
+ * @param {number} epsilon
+ * @return {boolean} floor(val-ε)
+ */
+ fuzzyFloor: function (val, epsilon) {
+ if (typeof epsilon === "undefined") { epsilon = 0.0001; }
+ return Math.floor(val + epsilon);
+ },
+
+ /**
+ * Averages all values passed to the function and returns the result. You can pass as many parameters as you like.
+ * @method Phaser.Math#average
+ * @return {number} The average of all given values.
+ */
+ average: function () {
+
+ var args = [];
+
+ for (var _i = 0; _i < (arguments.length - 0); _i++) {
+ args[_i] = arguments[_i + 0];
+ }
+
+ var avg = 0;
+
+ for (var i = 0; i < args.length; i++) {
+ avg += args[i];
+ }
+
+ return avg / args.length;
+
+ },
+
+ /**
+ * @method Phaser.Math#truncate
+ * @param {number} n
+ * @return {number}
+ */
+ truncate: function (n) {
+ return (n > 0) ? Math.floor(n) : Math.ceil(n);
+ },
+
+ /**
+ * @method Phaser.Math#shear
+ * @param {number} n
+ * @return {number} n mod 1
+ */
+ shear: function (n) {
+ return n % 1;
+ },
+
+ /**
+ * Snap a value to nearest grid slice, using rounding.
+ *
+ * Example: if you have an interval gap of 5 and a position of 12... you will snap to 10 whereas 14 will snap to 15.
+ *
+ * @method Phaser.Math#snapTo
+ * @param {number} input - The value to snap.
+ * @param {number} gap - The interval gap of the grid.
+ * @param {number} [start] - Optional starting offset for gap.
+ * @return {number}
+ */
+ snapTo: function (input, gap, start) {
+
+ if (typeof start === "undefined") { start = 0; }
+
+ if (gap == 0) {
+ return input;
+ }
+
+ input -= start;
+ input = gap * Math.round(input / gap);
+
+ return start + input;
+
+ },
+
+ /**
+ * Snap a value to nearest grid slice, using floor.
+ *
+ * Example: if you have an interval gap of 5 and a position of 12... you will snap to 10. As will 14 snap to 10... but 16 will snap to 15
+ *
+ * @method Phaser.Math#snapToFloor
+ * @param {number} input - The value to snap.
+ * @param {number} gap - The interval gap of the grid.
+ * @param {number} [start] - Optional starting offset for gap.
+ * @return {number}
+ */
+ snapToFloor: function (input, gap, start) {
+
+ if (typeof start === "undefined") { start = 0; }
+
+ if (gap == 0) {
+ return input;
+ }
+
+ input -= start;
+ input = gap * Math.floor(input / gap);
+
+ return start + input;
+
+ },
+
+ /**
+ * Snap a value to nearest grid slice, using ceil.
+ *
+ * Example: if you have an interval gap of 5 and a position of 12... you will snap to 15. As will 14 will snap to 15... but 16 will snap to 20.
+ *
+ * @method Phaser.Math#snapToCeil
+ * @param {number} input - The value to snap.
+ * @param {number} gap - The interval gap of the grid.
+ * @param {number} [start] - Optional starting offset for gap.
+ * @return {number}
+ */
+ snapToCeil: function (input, gap, start) {
+
+ if (typeof start === "undefined") { start = 0; }
+
+ if (gap == 0) {
+ return input;
+ }
+
+ input -= start;
+ input = gap * Math.ceil(input / gap);
+
+ return start + input;
+
+ },
+
+
+ /**
+ * Snaps a value to the nearest value in an array.
+ * @method Phaser.Math#snapToInArray
+ * @param {number} input
+ * @param {array} arr
+ * @param {boolean} sort - True if the array needs to be sorted.
+ * @return {number}
+ */
+ snapToInArray: function (input, arr, sort) {
+
+ if (typeof sort === "undefined") { sort = true; }
+
+ if (sort) {
+ arr.sort();
+ }
+
+ if (input < arr[0]) {
+ return arr[0];
+ }
+
+ var i = 1;
+
+ while (arr[i] < input) {
+ i++;
+ }
+
+ var low = arr[i - 1];
+ var high = (i < arr.length) ? arr[i] : Number.POSITIVE_INFINITY;
+
+ return ((high - input) <= (input - low)) ? high : low;
+
+ },
+
+ /**
+ * Round to some place comparative to a 'base', default is 10 for decimal place.
+ *
+ * 'place' is represented by the power applied to 'base' to get that place
+ * e.g.
+ * 2000/7 ~= 285.714285714285714285714 ~= (bin)100011101.1011011011011011
+ *
+ * roundTo(2000/7,3) == 0
+ * roundTo(2000/7,2) == 300
+ * roundTo(2000/7,1) == 290
+ * roundTo(2000/7,0) == 286
+ * roundTo(2000/7,-1) == 285.7
+ * roundTo(2000/7,-2) == 285.71
+ * roundTo(2000/7,-3) == 285.714
+ * roundTo(2000/7,-4) == 285.7143
+ * roundTo(2000/7,-5) == 285.71429
+ *
+ * roundTo(2000/7,3,2) == 288 -- 100100000
+ * roundTo(2000/7,2,2) == 284 -- 100011100
+ * roundTo(2000/7,1,2) == 286 -- 100011110
+ * roundTo(2000/7,0,2) == 286 -- 100011110
+ * roundTo(2000/7,-1,2) == 285.5 -- 100011101.1
+ * roundTo(2000/7,-2,2) == 285.75 -- 100011101.11
+ * roundTo(2000/7,-3,2) == 285.75 -- 100011101.11
+ * roundTo(2000/7,-4,2) == 285.6875 -- 100011101.1011
+ * roundTo(2000/7,-5,2) == 285.71875 -- 100011101.10111
+ *
+ * Note what occurs when we round to the 3rd space (8ths place), 100100000, this is to be assumed
+ * because we are rounding 100011.1011011011011011 which rounds up.
+ *
+ * @method Phaser.Math#roundTo
+ * @param {number} value - The value to round.
+ * @param {number} place - The place to round to.
+ * @param {number} base - The base to round in... default is 10 for decimal.
+ * @return {number}
+ */
+ roundTo: function (value, place, base) {
+
+ if (typeof place === "undefined") { place = 0; }
+ if (typeof base === "undefined") { base = 10; }
+
+ var p = Math.pow(base, -place);
+
+ return Math.round(value * p) / p;
+
+ },
+
+ /**
+ * @method Phaser.Math#floorTo
+ * @param {number} value - The value to round.
+ * @param {number} place - The place to round to.
+ * @param {number} base - The base to round in... default is 10 for decimal.
+ * @return {number}
+ */
+ floorTo: function (value, place, base) {
+
+ if (typeof place === "undefined") { place = 0; }
+ if (typeof base === "undefined") { base = 10; }
+
+ var p = Math.pow(base, -place);
+
+ return Math.floor(value * p) / p;
+
+ },
+
+ /**
+ * @method Phaser.Math#ceilTo
+ * @param {number} value - The value to round.
+ * @param {number} place - The place to round to.
+ * @param {number} base - The base to round in... default is 10 for decimal.
+ * @return {number}
+ */
+ ceilTo: function (value, place, base) {
+
+ if (typeof place === "undefined") { place = 0; }
+ if (typeof base === "undefined") { base = 10; }
+
+ var p = Math.pow(base, -place);
+
+ return Math.ceil(value * p) / p;
+
+ },
+
+ /**
+ * A one dimensional linear interpolation of a value.
+ * @method Phaser.Math#interpolateFloat
+ * @param {number} a
+ * @param {number} b
+ * @param {number} weight
+ * @return {number}
+ */
+ interpolateFloat: function (a, b, weight) {
+ return (b - a) * weight + a;
+ },
+
+ /**
+ * Find the angle of a segment from (x1, y1) -> (x2, y2 ).
+ * @method Phaser.Math#angleBetween
+ * @param {number} x1
+ * @param {number} y1
+ * @param {number} x2
+ * @param {number} y2
+ * @return {number}
+ */
+ angleBetween: function (x1, y1, x2, y2) {
+ return Math.atan2(y2 - y1, x2 - x1);
+ },
+
+ /**
+ * Set an angle within the bounds of -π toπ.
+ * @method Phaser.Math#normalizeAngle
+ * @param {number} angle
+ * @param {boolean} radians - True if angle size is expressed in radians.
+ * @return {number}
+ */
+ normalizeAngle: function (angle, radians) {
+
+ if (typeof radians === "undefined") { radians = true; }
+
+ var rd = (radians) ? GameMath.PI : 180;
+ return this.wrap(angle, rd, -rd);
+
+ },
+
+ /**
+ * Closest angle between two angles from a1 to a2
+ * absolute value the return for exact angle
+ * @method Phaser.Math#nearestAngleBetween
+ * @param {number} a1
+ * @param {number} a2
+ * @param {boolean} radians - True if angle sizes are expressed in radians.
+ * @return {number}
+ */
+ nearestAngleBetween: function (a1, a2, radians) {
+
+ if (typeof radians === "undefined") { radians = true; }
+
+ var rd = (radians) ? Math.PI : 180;
+ a1 = this.normalizeAngle(a1, radians);
+ a2 = this.normalizeAngle(a2, radians);
+
+ if (a1 < -rd / 2 && a2 > rd / 2)
+ {
+ a1 += rd * 2;
+ }
+
+ if (a2 < -rd / 2 && a1 > rd / 2)
+ {
+ a2 += rd * 2;
+ }
+
+ return a2 - a1;
+
+ },
+
+ /**
+ * Interpolate across the shortest arc between two angles.
+ * @method Phaser.Math#interpolateAngles
+ * @param {number} a1 - Description.
+ * @param {number} a2 - Description.
+ * @param {number} weight - Description.
+ * @param {boolean} radians - True if angle sizes are expressed in radians.
+ * @param {Description} ease - Description.
+ * @return {number}
+ */
+ interpolateAngles: function (a1, a2, weight, radians, ease) {
+
+ if (typeof radians === "undefined") { radians = true; }
+ if (typeof ease === "undefined") { ease = null; }
+
+ a1 = this.normalizeAngle(a1, radians);
+ a2 = this.normalizeAngleToAnother(a2, a1, radians);
+
+ return (typeof ease === 'function') ? ease(weight, a1, a2 - a1, 1) : this.interpolateFloat(a1, a2, weight);
+
+ },
+
+ /**
+ * Generate a random bool result based on the chance value.
+ * <p>
+ * Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
+ * of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.
+ * </p>
+ * @method Phaser.Math#chanceRoll
+ * @param {number} chance - The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).
+ * @return {boolean} True if the roll passed, or false otherwise.
+ */
+ chanceRoll: function (chance) {
+
+ if (typeof chance === "undefined") { chance = 50; }
+
+ if (chance <= 0)
+ {
+ return false;
+ }
+ else if (chance >= 100)
+ {
+ return true;
+ }
+ else
+ {
+ if (Math.random() * 100 >= chance)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ },
+
+ /**
+ * Returns an Array containing the numbers from min to max (inclusive).
+ *
+ * @method Phaser.Math#numberArray
+ * @param {number} min - The minimum value the array starts with.
+ * @param {number} max - The maximum value the array contains.
+ * @return {array} The array of number values.
+ */
+ numberArray: function (min, max) {
+
+ var result = [];
+
+ for (var i = min; i <= max; i++)
+ {
+ result.push(i);
+ }
+
+ return result;
+
+ },
+
+ /**
+ * Adds the given amount to the value, but never lets the value go over the specified maximum.
+ *
+ * @method Phaser.Math#maxAdd
+ * @param {number} value - The value to add the amount to.
+ * @param {number} amount - The amount to add to the value.
+ * @param {number} max- The maximum the value is allowed to be.
+ * @return {number}
+ */
+ maxAdd: function (value, amount, max) {
+
+ value += amount;
+
+ if (value > max)
+ {
+ value = max;
+ }
+
+ return value;
+
+ },
+
+ /**
+ * Subtracts the given amount from the value, but never lets the value go below the specified minimum.
+ *
+ * @method Phaser.Math#minSub
+ * @param {number} value - The base value.
+ * @param {number} amount - The amount to subtract from the base value.
+ * @param {number} min - The minimum the value is allowed to be.
+ * @return {number} The new value.
+ */
+ minSub: function (value, amount, min) {
+
+ value -= amount;
+
+ if (value < min)
+ {
+ value = min;
+ }
+
+ return value;
+
+ },
+
+ /**
+ * Ensures that the value always stays between min and max, by wrapping the value around.
+ * <p>max should be larger than min, or the function will return 0</p>
+ *
+ * @method Phaser.Math#wrap
+ * @param value The value to wrap
+ * @param min The minimum the value is allowed to be
+ * @param max The maximum the value is allowed to be
+ * @return {number} The wrapped value
+ */
+ wrap: function (value, min, max) {
+
+ var range = max - min;
+ if (range <= 0)
+ {
+ return 0;
+ }
+ var result = (value - min) % range;
+ if (result < 0)
+ {
+ result += range;
+ }
+ return result + min;
+ },
+
+ /**
+ * Adds value to amount and ensures that the result always stays between 0 and max, by wrapping the value around.
+ * <p>Values must be positive integers, and are passed through Math.abs</p>
+ *
+ * @method Phaser.Math#wrapValue
+ * @param {number} value - The value to add the amount to.
+ * @param {number} amount - The amount to add to the value.
+ * @param {number} max - The maximum the value is allowed to be.
+ * @return {number} The wrapped value.
+ */
+ wrapValue: function (value, amount, max) {
+
+ var diff;
+ value = Math.abs(value);
+ amount = Math.abs(amount);
+ max = Math.abs(max);
+ diff = (value + amount) % max;
+
+ return diff;
+
+ },
+
+ /**
+ * Randomly returns either a 1 or -1.
+ *
+ * @method Phaser.Math#randomSign
+ * @return {number} 1 or -1
+ */
+ randomSign: function () {
+ return (Math.random() > 0.5) ? 1 : -1;
+ },
+
+ /**
+ * Returns true if the number given is odd.
+ *
+ * @method Phaser.Math#isOdd
+ * @param {number} n - The number to check.
+ * @return {boolean} True if the given number is odd. False if the given number is even.
+ */
+ isOdd: function (n) {
+
+ return (n & 1);
+
+ },
+
+ /**
+ * Returns true if the number given is even.
+ *
+ * @method Phaser.Math#isEven
+ * @param {number} n - The number to check.
+ * @return {boolean} True if the given number is even. False if the given number is odd.
+ */
+ isEven: function (n) {
+
+ if (n & 1)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+
+ },
+
+ /**
+ * Significantly faster version of Math.max
+ * See http://jsperf.com/math-s-min-max-vs-homemade/5
+ *
+ * @method Phaser.Math#max
+ * @return {number} The highest value from those given.
+ */
+ max: function () {
+
+ for (var i = 1, max = 0, len = arguments.length; i < len; i++)
+ {
+ if (arguments[max] < arguments[i])
+ {
+ max = i;
+ }
+ }
+
+ return arguments[max];
+
+ },
+
+ /**
+ * Significantly faster version of Math.min
+ * See http://jsperf.com/math-s-min-max-vs-homemade/5
+ *
+ * @method Phaser.Math#min
+ * @return {number} The lowest value from those given.
+ */
+ min: function () {
+
+ for (var i =1 , min = 0, len = arguments.length; i < len; i++)
+ {
+ if (arguments[i] < arguments[min])
+ {
+ min = i;
+ }
+ }
+
+ return arguments[min];
+
+ },
+
+ /**
+ * Keeps an angle value between -180 and +180<br>
+ * Should be called whenever the angle is updated on the Sprite to stop it from going insane.
+ *
+ * @method Phaser.Math#wrapAngle
+ * @param {number} angle - The angle value to check
+ * @return {number} The new angle value, returns the same as the input angle if it was within bounds.
+ */
+ wrapAngle: function (angle) {
+
+ var result = angle;
+
+ // Nothing needs to change
+ if (angle >= -180 && angle <= 180)
+ {
+ return angle;
+ }
+
+ // Else normalise it to -180, 180
+ result = (angle + 180) % 360;
+
+ if (result < 0)
+ {
+ result += 360;
+ }
+
+ return result - 180;
+
+ },
+
+ /**
+ * Keeps an angle value between the given min and max values.
+ *
+ * @method Phaser.Math#angleLimit
+ * @param {number} angle - The angle value to check. Must be between -180 and +180.
+ * @param {number} min - The minimum angle that is allowed (must be -180 or greater).
+ * @param {number} max - The maximum angle that is allowed (must be 180 or less).
+ *
+ * @return {number} The new angle value, returns the same as the input angle if it was within bounds
+ */
+ angleLimit: function (angle, min, max) {
+ var result = angle;
+ if (angle > max) {
+ result = max;
+ } else if (angle < min) {
+ result = min;
+ }
+ return result;
+ },
+
+ /**
+ * Description.
+ * @method Phaser.Math#linearInterpolation
+ * @param {number} v
+ * @param {number} k
+ * @return {number}
+ */
+ linearInterpolation: function (v, k) {
+ var m = v.length - 1;
+ var f = m * k;
+ var i = Math.floor(f);
+ if (k < 0) {
+ return this.linear(v[0], v[1], f);
+ }
+ if (k > 1) {
+ return this.linear(v[m], v[m - 1], m - f);
+ }
+ return this.linear(v[i], v[i + 1 > m ? m : i + 1], f - i);
+ },
+
+ /**
+ * Description.
+ * @method Phaser.Math#bezierInterpolation
+ * @param {number} v
+ * @param {number} k
+ * @return {number}
+ */
+ bezierInterpolation: function (v, k) {
+ var b = 0;
+ var n = v.length - 1;
+ for (var i = 0; i <= n; i++) {
+ b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * this.bernstein(n, i);
+ }
+ return b;
+ },
+
+ /**
+ * Description.
+ * @method Phaser.Math#catmullRomInterpolation
+ * @param {number} v
+ * @param {number} k
+ * @return {number}
+ */
+ catmullRomInterpolation: function (v, k) {
+
+ var m = v.length - 1;
+ var f = m * k;
+ var i = Math.floor(f);
+
+ if (v[0] === v[m]) {
+ if (k < 0) {
+ i = Math.floor(f = m * (1 + k));
+ }
+ return this.catmullRom(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
+ } else {
+ if (k < 0) {
+ return v[0] - (this.catmullRom(v[0], v[0], v[1], v[1], -f) - v[0]);
+ }
+ if (k > 1) {
+ return v[m] - (this.catmullRom(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
+ }
+ return this.catmullRom(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
+ }
+ },
+
+ /**
+ * Description.
+ * @method Phaser.Math#Linear
+ * @param {number} p0
+ * @param {number} p1
+ * @param {number} t
+ * @return {number}
+ */
+ linear: function (p0, p1, t) {
+ return (p1 - p0) * t + p0;
+ },
+
+ /**
+ * @method Phaser.Math#bernstein
+ * @param {number} n
+ * @param {number} i
+ * @return {number}
+ */
+ bernstein: function (n, i) {
+ return this.factorial(n) / this.factorial(i) / this.factorial(n - i);
+ },
+
+ /**
+ * Description.
+ * @method Phaser.Math#catmullRom
+ * @param {number} p0
+ * @param {number} p1
+ * @param {number} p2
+ * @param {number} p3
+ * @param {number} t
+ * @return {number}
+ */
+ catmullRom: function (p0, p1, p2, p3, t) {
+ var v0 = (p2 - p0) * 0.5, v1 = (p3 - p1) * 0.5, t2 = t * t, t3 = t * t2;
+ return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
+ },
+
+ /**
+ * @method Phaser.Math#difference
+ * @param {number} a
+ * @param {number} b
+ * @return {number}
+ */
+ difference: function (a, b) {
+ return Math.abs(a - b);
+ },
+
+ /**
+ * Fetch a random entry from the given array.
+ * Will return null if random selection is missing, or array has no entries.
+ *
+ * @method Phaser.Math#getRandom
+ * @param {array} objects - An array of objects.
+ * @param {number} startIndex - Optional offset off the front of the array. Default value is 0, or the beginning of the array.
+ * @param {number} length - Optional restriction on the number of values you want to randomly select from.
+ * @return {object} The random object that was selected.
+ */
+ getRandom: function (objects, startIndex, length) {
+
+ if (typeof startIndex === "undefined") { startIndex = 0; }
+ if (typeof length === "undefined") { length = 0; }
+
+ if (objects != null) {
+
+ var l = length;
+
+ if ((l == 0) || (l > objects.length - startIndex))
+ {
+ l = objects.length - startIndex;
+ }
+
+ if (l > 0)
+ {
+ return objects[startIndex + Math.floor(Math.random() * l)];
+ }
+ }
+
+ return null;
+
+ },
+
+ /**
+ * Round down to the next whole number. E.g. floor(1.7) == 1, and floor(-2.7) == -2.
+ *
+ * @method Phaser.Math#floor
+ * @param {number} Value Any number.
+ * @return {number} The rounded value of that number.
+ */
+ floor: function (value) {
+
+ var n = value | 0;
+
+ return (value > 0) ? (n) : ((n != value) ? (n - 1) : (n));
+
+ },
+
+ /**
+ * Round up to the next whole number. E.g. ceil(1.3) == 2, and ceil(-2.3) == -3.
+ *
+ * @method Phaser.Math#ceil
+ * @param {number} value - Any number.
+ * @return {number} The rounded value of that number.
+ */
+ ceil: function (value) {
+ var n = value | 0;
+ return (value > 0) ? ((n != value) ? (n + 1) : (n)) : (n);
+ },
+
+ /**
+ * Generate a sine and cosine table simultaneously and extremely quickly. Based on research by Franky of scene.at
+ * <p>
+ * The parameters allow you to specify the length, amplitude and frequency of the wave. Once you have called this function
+ * you should get the results via getSinTable() and getCosTable(). This generator is fast enough to be used in real-time.
+ * </p>
+ * @method Phaser.Math#sinCosGenerator
+ * @param {number} length - The length of the wave
+ * @param {number} sinAmplitude - The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
+ * @param {number} cosAmplitude - The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
+ * @param {number} frequency - The frequency of the sine and cosine table data
+ * @return {Array} Returns the sine table
+ */
+ sinCosGenerator: function (length, sinAmplitude, cosAmplitude, frequency) {
+
+ if (typeof sinAmplitude === "undefined") { sinAmplitude = 1.0; }
+ if (typeof cosAmplitude === "undefined") { cosAmplitude = 1.0; }
+ if (typeof frequency === "undefined") { frequency = 1.0; }
+
+ var sin = sinAmplitude;
+ var cos = cosAmplitude;
+ var frq = frequency * Math.PI / length;
+
+ var cosTable = [];
+ var sinTable = [];
+
+ for (var c = 0; c < length; c++) {
+
+ cos -= sin * frq;
+ sin += cos * frq;
+
+ cosTable[c] = cos;
+ sinTable[c] = sin;
+
+ }
+
+ return { sin: sinTable, cos: cosTable };
+
+ },
+
+ /**
+ * Removes the top element from the stack and re-inserts it onto the bottom, then returns it.
+ * The original stack is modified in the process. This effectively moves the position of the data from the start to the end of the table.
+ *
+ * @method Phaser.Math#shift
+ * @param {array} stack - The array to shift.
+ * @return {any} The shifted value.
+ */
+ shift: function (stack) {
+
+ var s = stack.shift();
+ stack.push(s);
+
+ return s;
+
+ },
+
+ /**
+ * Shuffles the data in the given array into a new order
+ * @method Phaser.Math#shuffleArray
+ * @param {array} array - The array to shuffle
+ * @return {array} The array
+ */
+ shuffleArray: function (array) {
+
+ for (var i = array.length - 1; i > 0; i--) {
+
+ var j = Math.floor(Math.random() * (i + 1));
+ var temp = array[i];
+ array[i] = array[j];
+ array[j] = temp;
+ }
+
+ return array;
+
+ },
+
+ /**
+ * Returns the distance between the two given set of coordinates.
+ *
+ * @method Phaser.Math#distance
+ * @param {number} x1
+ * @param {number} y1
+ * @param {number} x2
+ * @param {number} y2
+ * @return {number} The distance between this Point object and the destination Point object.
+ **/
+ distance: function (x1, y1, x2, y2) {
+
+ var dx = x1 - x2;
+ var dy = y1 - y2;
+
+ return Math.sqrt(dx * dx + dy * dy);
+
+ },
+
+ /**
+ * Returns the rounded distance between the two given set of coordinates.
+ *
+ * @method Phaser.Math#distanceRounded
+ * @param {number} x1
+ * @param {number} y1
+ * @param {number} x2
+ * @param {number} y2
+ * @return {number} The distance between this Point object and the destination Point object.
+ **/
+ distanceRounded: function (x1, y1, x2, y2) {
+
+ return Math.round(Phaser.Math.distance(x1, y1, x2, y2));
+
+ },
+
+ /**
+ * Force a value within the boundaries of two values.
+ * Clamp value to range <a, b>
+ *
+ * @method Phaser.Math#clamp
+ * @param {number} x
+ * @param {number} a
+ * @param {number} b
+ * @return {number}
+ */
+ clamp: function ( x, a, b ) {
+
+ return ( x < a ) ? a : ( ( x > b ) ? b : x );
+
+ },
+
+ /**
+ * Clamp value to range <a, inf).
+ *
+ * @method Phaser.Math#clampBottom
+ * @param {number} x
+ * @param {number} a
+ * @return {number}
+ */
+ clampBottom: function ( x, a ) {
+
+ return x < a ? a : x;
+
+ },
+
+ /**
+ * Linear mapping from range <a1, a2> to range <b1, b2>
+ *
+ * @method Phaser.Math#mapLinear
+ * @param {number} x
+ * @param {number} a1
+ * @param {number} a1
+ * @param {number} a2
+ * @param {number} b1
+ * @param {number} b2
+ * @return {number}
+ */
+ mapLinear: function ( x, a1, a2, b1, b2 ) {
+
+ return b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );
+
+ },
+
+ /**
+ * Smoothstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
+ *
+ * @method Phaser.Math#smoothstep
+ * @param {number} x
+ * @param {number} min
+ * @param {number} max
+ * @return {number}
+ */
+ smoothstep: function ( x, min, max ) {
+
+ if ( x <= min ) return 0;
+ if ( x >= max ) return 1;
+
+ x = ( x - min )/( max - min );
+
+ return x*x*(3 - 2*x);
+
+ },
+
+ /**
+ * Smootherstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
+ *
+ * @method Phaser.Math#smootherstep
+ * @param {number} x
+ * @param {number} min
+ * @param {number} max
+ * @return {number}
+ */
+ smootherstep: function ( x, min, max ) {
+
+ if ( x <= min ) return 0;
+ if ( x >= max ) return 1;
+
+ x = ( x - min )/( max - min );
+
+ return x*x*x*(x*(x*6 - 15) + 10);
+
+ },
+
+ /**
+ * A value representing the sign of the value.
+ * -1 for negative, +1 for positive, 0 if value is 0
+ *
+ * @method Phaser.Math#sign
+ * @param {number} x
+ * @return {number}
+ */
+ sign: function ( x ) {
+
+ return ( x < 0 ) ? -1 : ( ( x > 0 ) ? 1 : 0 );
+
+ },
+
+ /**
+ * Convert degrees to radians.
+ *
+ * @method Phaser.Math#degToRad
+ * @return {function}
+ */
+ degToRad: function() {
+
+ var degreeToRadiansFactor = Math.PI / 180;
+
+ return function ( degrees ) {
+
+ return degrees * degreeToRadiansFactor;
+
+ };
+
+ }(),
+
+ /**
+ * Convert degrees to radians.
+ *
+ * @method Phaser.Math#radToDeg
+ * @return {function}
+ */
+ radToDeg: function() {
+
+ var radianToDegreesFactor = 180 / Math.PI;
+
+ return function ( radians ) {
+
+ return radians * radianToDegreesFactor;
+
+ };
+
+ }()
+
+};
+
@@ -1631,7 +1679,7 @@ The frames are returned in the output array, or if none is provided in a new Arr
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Animation.Parser.html b/Docs/out/Phaser.Animation.Parser.html
index 1623b480..caef70a4 100644
--- a/Docs/out/Phaser.Animation.Parser.html
+++ b/Docs/out/Phaser.Animation.Parser.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -2515,7 +2563,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.AnimationManager.html b/Docs/out/Phaser.AnimationManager.html
index afe768a5..c5283576 100644
--- a/Docs/out/Phaser.AnimationManager.html
+++ b/Docs/out/Phaser.AnimationManager.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -2339,7 +2387,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Cache.html b/Docs/out/Phaser.Cache.html
new file mode 100644
index 00000000..4e47de0b
--- /dev/null
+++ b/Docs/out/Phaser.Cache.html
@@ -0,0 +1,6091 @@
+
+
+
+
+
+ Phaser Class: Cache
+
+
+
+
+
+
+
+
+
+
+
A game only has one instance of a Cache and it is used to store all externally loaded assets such
+as images, sounds and data files as a result of Loader calls. Cache items use string based keys for look-up.
@@ -2766,7 +2814,7 @@ without having to use game.camera.x and game.camera.y.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Circle.html b/Docs/out/Phaser.Circle.html
index 1c986106..7e121a29 100644
--- a/Docs/out/Phaser.Circle.html
+++ b/Docs/out/Phaser.Circle.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -4016,7 +4064,7 @@ This method checks the radius distances between the two Circle objects to see if
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Game.html b/Docs/out/Phaser.Game.html
index 1e1b1cee..21059ca9 100644
--- a/Docs/out/Phaser.Game.html
+++ b/Docs/out/Phaser.Game.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -694,7 +742,7 @@ providing quick access to common functions and handling the boot process.
-Phaser.Cache
+Phaser.Cache
@@ -1843,7 +1891,7 @@ providing quick access to common functions and handling the boot process.
-Phaser.Loader
+Phaser.Loader
@@ -2889,7 +2937,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
-Phaser.RandomDataGenerator
+Phaser.RandomDataGenerator
@@ -4203,7 +4251,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 Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Group.html b/Docs/out/Phaser.Group.html
index 5e40e3ca..a21d562c 100644
--- a/Docs/out/Phaser.Group.html
+++ b/Docs/out/Phaser.Group.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -6129,7 +6177,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Input.html b/Docs/out/Phaser.Input.html
index e220408a..40477488 100644
--- a/Docs/out/Phaser.Input.html
+++ b/Docs/out/Phaser.Input.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -708,7 +647,7 @@ When you've limited max pointers to 1 this will accurately be either the first f
A Circle object centered on the x/y screen coordinates of the Input.
-Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
+Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything.
@@ -750,7 +689,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
-Circle
+Phaser.Circle
@@ -792,7 +731,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
@@ -5766,8 +5811,8 @@ otherwise see the Pointer objects directly.
-
Add a new Pointer object to the Input Manager. By default Input creates 2 pointer objects for you. If you need more
-use this to create a new one, up to a maximum of 10.
+
Add a new Pointer object to the Input Manager. By default Input creates 3 pointer objects: mousePointer, pointer1 and pointer2.
+If you need more then use this to create a new one, up to a maximum of 10.
@@ -5800,7 +5845,7 @@ use this to create a new one, up to a maximum of 10.
@@ -7304,7 +7349,7 @@ use this to create a new one, up to a maximum of 10.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.InputHandler.html b/Docs/out/Phaser.InputHandler.html
new file mode 100644
index 00000000..694217dd
--- /dev/null
+++ b/Docs/out/Phaser.InputHandler.html
@@ -0,0 +1,7312 @@
+
+
+
+
+
+ Phaser Class: InputHandler
+
+
+
+
+
+
+
+
+
+
+
If this object is set to consume the pointer event then it will stop all propogation from this object on.
+For example if you had a stack of 6 sprites with the same priority IDs and one consumed the event, none of the others would receive it.
Stops this sprite from being able to be dragged. If it is currently the target of an active drag it will be stopped immediately. Also disables any set callbacks.
Make this Sprite snap to the given grid either during drag or when it's released.
+For example 16x16 as the snapX and snapY would make the sprite snap to every 16 pixels.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
snapX
+
+
+
+
+
+
+
+
+
+
+
The width of the grid cell in pixels
+
+
+
+
+
+
+
snapY
+
+
+
+
+
+
+
+
+
+
+
The height of the grid cell in pixels
+
+
+
+
+
+
+
onDrag
+
+
+
+
+
+
+
+
+
+
+
If true the sprite will snap to the grid while being dragged
+
+
+
+
+
+
+
onRelease
+
+
+
+
+
+
+
+
+
+
+
If true the sprite will snap to the grid when released
If the key is down this value holds the duration of that key press and is constantly updated.
+If the key is up it holds the duration of the previous down session.
+
+
+
+
+
+
+
+
+
+
Properties:
+
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The number of milliseconds this key has been held down for.
Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given (default 250ms)
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+
The duration below which the key is considered as being just released.
If you need more fine-grained control over a Key you can create a new Phaser.Key object via this method.
+The Key object can then be polled, have events attached to it, etc.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
keycode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
By default when a key is pressed Phaser will not stop the event from propagating up to the browser.
+There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll.
+You can use addKeyCapture to consume the keyboard event for specific keys so it doesn't bubble up to the the browser.
+Pass in either a single keycode or an array/hash of keycodes.
Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given (default 250ms)
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
keycode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+
+
+
+
+
+
+
duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+
The duration below which the key is considered as being just released.
Starts the Keyboard event listeners running (keydown and keyup). They are attached to the document.body.
+This is called automatically by Phaser.Input and should not normally be invoked directly.
@@ -1183,7 +1231,7 @@ The function must exist on the member.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Loader.Parser.html b/Docs/out/Phaser.Loader.Parser.html
new file mode 100644
index 00000000..d57061cc
--- /dev/null
+++ b/Docs/out/Phaser.Loader.Parser.html
@@ -0,0 +1,512 @@
+
+
+
+
+
+ Phaser Class: Parser
+
+
+
+
+
+
+
+
+
+
+
The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.
+It uses a combination of Image() loading and xhr and provides progress and completion callbacks.
+
+
+
+
+
+
+
+
+
+
+
new Loader(game)
+
+
+
+
+
+
+
+
Phaser loader constructor.
+The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.
+It uses a combination of Image() loading and xhr and provides progress and completion callbacks.
If you want to append a URL before the path of any asset you can set this here.
+Useful if you need to allow an asset url to be configured outside of the game code.
+MUST have / on the end of it!
An array containing the URLs of the audio files, i.e.: [ 'jump.mp3', 'jump.ogg', 'jump.m4a' ].
+
+
+
+
+
+
+
autoDecode
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
When using Web Audio the audio files can either be decoded at load time or run-time. They can't be played until they are decoded, but this let's you control when that happens. Decoding is a non-blocking async process.
You can set a Sprite to be a "preload" sprite by passing it to this method.
+A "preload" sprite will have its width or height crop adjusted based on the percentage of the loader in real-time.
+This allows you to easily make loading bars for games.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
sprite
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The sprite that will be cropped during the load.
+
+
+
+
+
+
+
direction
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
A value of zero means the sprite width will be cropped, a value of 1 means its height will be cropped.
The MSPointer class handles touch interactions with the game and the resulting Pointer objects.
+It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 apps using JavaScript.
+http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
Generate a random bool result based on the chance value.
+
<p>
+Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
+of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.
+</p>
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
chance
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).
Note what occurs when we round to the 3rd space (8ths place), 100100000, this is to be assumed
+because we are rounding 100011.1011011011011011 which rounds up.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
value
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The value to round.
+
+
+
+
+
+
+
place
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The place to round to.
+
+
+
+
+
+
+
base
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The base to round in... default is 10 for decimal.
Removes the top element from the stack and re-inserts it onto the bottom, then returns it.
+The original stack is modified in the process. This effectively moves the position of the data from the start to the end of the table.
Generate a sine and cosine table simultaneously and extremely quickly. Based on research by Franky of scene.at
+
<p>
+The parameters allow you to specify the length, amplitude and frequency of the wave. Once you have called this function
+you should get the results via getSinTable() and getCosTable(). This generator is fast enough to be used in real-time.
+</p>
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The length of the wave
+
+
+
+
+
+
+
sinAmplitude
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
+
+
+
+
+
+
+
cosAmplitude
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
@@ -1535,7 +1583,7 @@ It is only called if active is set to true.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.PluginManager.html b/Docs/out/Phaser.PluginManager.html
new file mode 100644
index 00000000..d8d8fa6d
--- /dev/null
+++ b/Docs/out/Phaser.PluginManager.html
@@ -0,0 +1,1260 @@
+
+
+
+
+
+ Phaser Class: PluginManager
+
+
+
+
+
+
+
+
+
+
+
Pre-update is called at the very start of the update cycle, before any other subsystems have been updated (including Physics).
+It only calls plugins who have active=true.
Update is called after all the core subsystems (Input, Tweens, Sound, etc) and the State have updated, but before the render.
+It only calls plugins who have active=true.
A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
+it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result. Original version at https://github.com/timohausmann/quadtree-js/
+
+
+
+
+
+
+
+
+
+
+
new QuadTree(physicsManager, x, y, width, height, maxObjects, maxLevels, level)
@@ -7066,7 +7114,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.Signal.html b/Docs/out/Phaser.Signal.html
index ef0ec898..36759985 100644
--- a/Docs/out/Phaser.Signal.html
+++ b/Docs/out/Phaser.Signal.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -1211,7 +1259,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.State.html b/Docs/out/Phaser.State.html
index fb816582..b56a03ab 100644
--- a/Docs/out/Phaser.State.html
+++ b/Docs/out/Phaser.State.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -402,7 +450,7 @@ It provides quick access to common functions such as the camera, cache, input, m
-Phaser.Cache
+Phaser.Cache
@@ -819,7 +867,7 @@ It provides quick access to common functions such as the camera, cache, input, m
-Phaser.Loader
+Phaser.Loader
@@ -2302,7 +2350,7 @@ If you need to use the loader, you may need to use them here.
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.StateManager.html b/Docs/out/Phaser.StateManager.html
index ac9ffc8a..13118bc9 100644
--- a/Docs/out/Phaser.StateManager.html
+++ b/Docs/out/Phaser.StateManager.html
@@ -32,10 +32,6 @@
Phaser
-
Touch cancel - touches that were disrupted (perhaps by moving into a plugin or browser chrome).
+Occurs for example on iOS when you put down 4 fingers and the app selector UI appears.
For touch enter and leave its a list of the touch points that have entered or left the target.
+Doesn't appear to be supported by most browsers on a canvas element yet.
For touch enter and leave its a list of the touch points that have entered or left the target.
+Doesn't appear to be supported by most browsers on a canvas element yet.
@@ -1872,7 +1920,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 Wed Oct 02 2013 12:28:27 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:51 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/Phaser.js.html b/Docs/out/Phaser.js.html
index bbfde5f5..434ababc 100644
--- a/Docs/out/Phaser.js.html
+++ b/Docs/out/Phaser.js.html
@@ -32,10 +32,6 @@
Phaser
-
@@ -287,7 +335,7 @@ Phaser.Plugin.prototype = {
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/PluginManager-Phaser.PluginManager.html b/Docs/out/PluginManager-Phaser.PluginManager.html
index 5e6d6eec..d899654c 100644
--- a/Docs/out/PluginManager-Phaser.PluginManager.html
+++ b/Docs/out/PluginManager-Phaser.PluginManager.html
@@ -82,10 +82,6 @@
Group
-
@@ -552,7 +552,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:26 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 13:35:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/Docs/out/PluginManager.html b/Docs/out/PluginManager.html
index 6084a8d3..62067e01 100644
--- a/Docs/out/PluginManager.html
+++ b/Docs/out/PluginManager.html
@@ -82,10 +82,6 @@
Group
-
@@ -302,7 +389,7 @@
Documentation generated by JSDoc 3.2.0-dev
- on Wed Oct 02 2013 12:28:25 GMT+0100 (BST) using the DocStrap template.
+ on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template.
diff --git a/src/core/PluginManager.js b/src/core/PluginManager.js
index 083489fd..29e49fd6 100644
--- a/src/core/PluginManager.js
+++ b/src/core/PluginManager.js
@@ -2,14 +2,13 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.PluginManager
*/
/**
* Description.
*
* @class Phaser.PluginManager
-* @classdesc PPhaser - PluginManager
+* @classdesc Phaser - PluginManager
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Description} parent - Description.
diff --git a/src/input/InputHandler.js b/src/input/InputHandler.js
index 28cb6f03..b08d2acd 100644
--- a/src/input/InputHandler.js
+++ b/src/input/InputHandler.js
@@ -2,7 +2,6 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.InputHandler
*/
/**
@@ -14,16 +13,16 @@
*/
Phaser.InputHandler = function (sprite) {
- /**
- * @property {Phaser.Game} game - A reference to the currently running game.
- */
- this.game = sprite.game;
-
/**
* @property {Phaser.Sprite} sprite - Description.
*/
this.sprite = sprite;
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running game.
+ */
+ this.game = sprite.game;
+
/**
* @property {boolean} enabled - Description.
* @default
@@ -195,7 +194,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method start
+ * @method Phaser.InputHandler#start
* @param {number} priority - Description.
* @param {boolean} useHandCursor - Description.
* @return {Phaser.Sprite} Description.
@@ -253,7 +252,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method reset
+ * @method Phaser.InputHandler#reset
*/
reset: function () {
@@ -281,7 +280,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method stop
+ * @method Phaser.InputHandler#stop
*/
stop: function () {
@@ -301,7 +300,7 @@ Phaser.InputHandler.prototype = {
/**
* Clean up memory.
- * @method destroy
+ * @method Phaser.InputHandler#destroy
*/
destroy: function () {
@@ -317,7 +316,7 @@ Phaser.InputHandler.prototype = {
/**
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
* This value is only set when the pointer is over this Sprite.
- * @method pointerX
+ * @method Phaser.InputHandler#pointerX
* @param {Pointer} pointer
* @return {number} The x coordinate of the Input pointer.
*/
@@ -332,7 +331,7 @@ Phaser.InputHandler.prototype = {
/**
* The y coordinate of the Input pointer, relative to the top-left of the parent Sprite
* This value is only set when the pointer is over this Sprite.
- * @method pointerY
+ * @method Phaser.InputHandler#pointerY
* @param {Pointer} pointer
* @return {number} The y coordinate of the Input pointer.
*/
@@ -346,7 +345,7 @@ Phaser.InputHandler.prototype = {
/**
* If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.
- * @method pointerDown
+ * @method Phaser.InputHandler#pointerDown
* @param {Pointer} pointer
* @return {boolean}
*/
@@ -360,7 +359,7 @@ Phaser.InputHandler.prototype = {
/**
* If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true
- * @method pointerUp
+ * @method Phaser.InputHandler#pointerUp
* @param {Pointer} pointer
* @return {boolean}
*/
@@ -374,7 +373,7 @@ Phaser.InputHandler.prototype = {
/**
* A timestamp representing when the Pointer first touched the touchscreen.
- * @method pointerTimeDown
+ * @method Phaser.InputHandler#pointerTimeDown
* @param {Pointer} pointer
* @return {number}
*/
@@ -388,7 +387,7 @@ Phaser.InputHandler.prototype = {
/**
* A timestamp representing when the Pointer left the touchscreen.
- * @method pointerTimeUp
+ * @method Phaser.InputHandler#pointerTimeUp
* @param {Pointer} pointer
* @return {number}
*/
@@ -402,7 +401,7 @@ Phaser.InputHandler.prototype = {
/**
* Is the Pointer over this Sprite?
- * @method pointerOver
+ * @method Phaser.InputHandler#pointerOver
* @param {Pointer} pointer
* @return {bool
*/
@@ -416,7 +415,7 @@ Phaser.InputHandler.prototype = {
/**
* Is the Pointer outside of this Sprite?
- * @method pointerOut
+ * @method Phaser.InputHandler#pointerOut
* @param {Pointer} pointer
* @return {boolean}
*/
@@ -430,7 +429,7 @@ Phaser.InputHandler.prototype = {
/**
* A timestamp representing when the Pointer first touched the touchscreen.
- * @method pointerTimeOver
+ * @method Phaser.InputHandler#pointerTimeOver
* @param {Pointer} pointer
* @return {number}
*/
@@ -444,7 +443,7 @@ Phaser.InputHandler.prototype = {
/**
* A timestamp representing when the Pointer left the touchscreen.
- * @method pointerTimeOut
+ * @method Phaser.InputHandler#pointerTimeOut
* @param {Pointer} pointer
* @return {number}
*/
@@ -458,7 +457,7 @@ Phaser.InputHandler.prototype = {
/**
* Is this sprite being dragged by the mouse or not?
- * @method pointerTimeOut
+ * @method Phaser.InputHandler#pointerTimeOut
* @param {Pointer} pointer
* @return {number}
*/
@@ -472,7 +471,7 @@ Phaser.InputHandler.prototype = {
/**
* Checks if the given pointer is over this Sprite.
- * @method checkPointerOver
+ * @method Phaser.InputHandler#checkPointerOver
* @param {Pointer} pointer
* @return {boolean}
*/
@@ -510,7 +509,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method checkPixel
+ * @method Phaser.InputHandler#checkPixel
* @param {Description} x - Description.
* @param {Description} y - Description.
* @return {boolean}
@@ -543,7 +542,7 @@ Phaser.InputHandler.prototype = {
/**
* Update.
- * @method update
+ * @method Phaser.InputHandler#update
* @param {Pointer} pointer
*/
update: function (pointer) {
@@ -576,7 +575,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method _pointerOverHandler
+ * @method Phaser.InputHandler#_pointerOverHandler
* @private
* @param {Pointer} pointer
*/
@@ -601,7 +600,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method _pointerOutHandler
+ * @method Phaser.InputHandler#_pointerOutHandler
* @private
* @param {Pointer} pointer
*/
@@ -622,7 +621,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method _touchedHandler
+ * @method Phaser.InputHandler#_touchedHandler
* @private
* @param {Pointer} pointer
*/
@@ -654,7 +653,7 @@ Phaser.InputHandler.prototype = {
/**
* Description.
- * @method _releasedHandler
+ * @method Phaser.InputHandler#_releasedHandler
* @private
* @param {Pointer} pointer
*/
@@ -694,7 +693,7 @@ Phaser.InputHandler.prototype = {
/**
* Updates the Pointer drag on this Sprite.
- * @method updateDrag
+ * @method Phaser.InputHandler#updateDrag
* @param {Pointer} pointer
* @return {boolean}
*/
@@ -738,7 +737,7 @@ Phaser.InputHandler.prototype = {
/**
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
- * @method justOver
+ * @method Phaser.InputHandler#justOver
* @param {Pointer} pointer
* @param {number} delay - The time below which the pointer is considered as just over.
* @return {boolean}
@@ -754,7 +753,7 @@ Phaser.InputHandler.prototype = {
/**
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
- * @method justOut
+ * @method Phaser.InputHandler#justOut
* @param {Pointer} pointer
* @param {number} delay - The time below which the pointer is considered as just out.
* @return {boolean}
@@ -770,7 +769,7 @@ Phaser.InputHandler.prototype = {
/**
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
- * @method justPressed
+ * @method Phaser.InputHandler#justPressed
* @param {Pointer} pointer
* @param {number} delay - The time below which the pointer is considered as just over.
* @return {boolean}
@@ -786,7 +785,7 @@ Phaser.InputHandler.prototype = {
/**
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
- * @method justReleased
+ * @method Phaser.InputHandler#justReleased
* @param {Pointer} pointer
* @param {number} delay - The time below which the pointer is considered as just out.
* @return {boolean}
@@ -802,7 +801,7 @@ Phaser.InputHandler.prototype = {
/**
* If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
- * @method overDuration
+ * @method Phaser.InputHandler#overDuration
* @param {Pointer} pointer
* @return {number} The number of milliseconds the pointer has been over the Sprite, or -1 if not over.
*/
@@ -821,7 +820,7 @@ Phaser.InputHandler.prototype = {
/**
* If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
- * @method downDuration
+ * @method Phaser.InputHandler#downDuration
* @param {Pointer} pointer
* @return {number} The number of milliseconds the pointer has been pressed down on the Sprite, or -1 if not over.
*/
@@ -840,7 +839,7 @@ Phaser.InputHandler.prototype = {
/**
* Make this Sprite draggable by the mouse. You can also optionally set mouseStartDragCallback and mouseStopDragCallback
- * @method enableDrag
+ * @method Phaser.InputHandler#enableDrag
* @param lockCenter If false the Sprite will drag from where you click it minus the dragOffset. If true it will center itself to the tip of the mouse pointer.
* @param bringToTop If true the Sprite will be bought to the top of the rendering list in its current Group.
* @param pixelPerfect If true it will use a pixel perfect test to see if you clicked the Sprite. False uses the bounding box.
@@ -881,7 +880,7 @@ Phaser.InputHandler.prototype = {
/**
* Stops this sprite from being able to be dragged. If it is currently the target of an active drag it will be stopped immediately. Also disables any set callbacks.
- * @method disableDrag
+ * @method Phaser.InputHandler#disableDrag
*/
disableDrag: function () {
@@ -901,7 +900,7 @@ Phaser.InputHandler.prototype = {
/**
* Called by Pointer when drag starts on this Sprite. Should not usually be called directly.
- * @method startDrag
+ * @method Phaser.InputHandler#startDrag
*/
startDrag: function (pointer) {
@@ -932,7 +931,7 @@ Phaser.InputHandler.prototype = {
/**
* Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
- * @method stopDrag
+ * @method Phaser.InputHandler#stopDrag
*/
stopDrag: function (pointer) {
@@ -953,7 +952,7 @@ Phaser.InputHandler.prototype = {
/**
* Restricts this sprite to drag movement only on the given axis. Note: If both are set to false the sprite will never move!
- * @method setDragLock
+ * @method Phaser.InputHandler#setDragLock
* @param allowHorizontal To enable the sprite to be dragged horizontally set to true, otherwise false
* @param allowVertical To enable the sprite to be dragged vertically set to true, otherwise false
*/
@@ -970,7 +969,7 @@ Phaser.InputHandler.prototype = {
/**
* Make this Sprite snap to the given grid either during drag or when it's released.
* For example 16x16 as the snapX and snapY would make the sprite snap to every 16 pixels.
- * @method enableSnap
+ * @method Phaser.InputHandler#enableSnap
* @param snapX The width of the grid cell in pixels
* @param snapY The height of the grid cell in pixels
* @param onDrag If true the sprite will snap to the grid while being dragged
@@ -990,7 +989,7 @@ Phaser.InputHandler.prototype = {
/**
* Stops the sprite from snapping to a grid during drag or release.
- * @method disableSnap
+ * @method Phaser.InputHandler#disableSnap
*/
disableSnap: function () {
@@ -1001,7 +1000,7 @@ Phaser.InputHandler.prototype = {
/**
* Bounds Rect check for the sprite drag
- * @method checkBoundsRect
+ * @method Phaser.InputHandler#checkBoundsRect
*/
checkBoundsRect: function () {
@@ -1027,7 +1026,7 @@ Phaser.InputHandler.prototype = {
/**
* Parent Sprite Bounds check for the sprite drag.
- * @method checkBoundsSprite
+ * @method Phaser.InputHandler#checkBoundsSprite
*/
checkBoundsSprite: function () {
diff --git a/src/input/Keyboard.js b/src/input/Keyboard.js
index 3bc94e5b..19bacb9e 100644
--- a/src/input/Keyboard.js
+++ b/src/input/Keyboard.js
@@ -42,21 +42,21 @@ Phaser.Keyboard = function (game) {
* @property {boolean} disabled - The disabled state of the Keyboard.
* @default
*/
- disabled: false,
+ this.disabled = false;
/**
* @property {function} _onKeyDown
* @private
* @default
*/
- _onKeyDown: null,
+ this._onKeyDown = null;
/**
* @property {function} _onKeyUp
* @private
* @default
*/
- _onKeyUp: null,
+ this._onKeyUp = null;
/**
* @property {Object} callbackContext - The context under which the callbacks are run.
diff --git a/src/input/MSPointer.js b/src/input/MSPointer.js
index 17f43d73..e24399f9 100644
--- a/src/input/MSPointer.js
+++ b/src/input/MSPointer.js
@@ -2,10 +2,8 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.MSPointer
*/
-
/**
* Phaser - MSPointer constructor.
*
@@ -46,48 +44,43 @@ Phaser.MSPointer = function (game) {
*/
this.mouseUpCallback = null;
+ /**
+ * You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
+ * @property {boolean} disabled
+ */
+ this.disabled = false;
+
+ /**
+ * Description.
+ * @property {Description} _onMSPointerDown
+ * @private
+ * @default
+ */
+ this._onMSPointerDown = null;
+
+ /**
+ * Description.
+ * @property {Description} _onMSPointerMove
+ * @private
+ * @default
+ */
+ this._onMSPointerMove = null;
+
+ /**
+ * Description.
+ * @property {Description} _onMSPointerUp
+ * @private
+ * @default
+ */
+ this._onMSPointerUp = null;
+
};
Phaser.MSPointer.prototype = {
- /**
- * @property {Phaser.Game} game - Local reference to game.
- */
- game: null,
-
- /**
- * You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
- * @property {boolean} disabled
- */
- disabled: false,
-
- /**
- * Description.
- * @property {Description} _onMSPointerDown
- * @private
- * @default
- */
- _onMSPointerDown: null,
-
- /**
- * Description.
- * @property {Description} _onMSPointerMove
- * @private
- * @default
- */
- _onMSPointerMove: null,
-
- /**
- * Description.
- * @property {Description} _onMSPointerUp
- * @private
- * @default
- */
- _onMSPointerUp: null,
-
/**
* Starts the event listeners running.
- * @method start
+ * @method Phaser.MSPointer#start
*/
start: function () {
@@ -120,7 +113,7 @@ Phaser.MSPointer.prototype = {
/**
* Description.
- * @method onPointerDown
+ * @method Phaser.MSPointer#onPointerDown
* @param {Any} event
**/
onPointerDown: function (event) {
@@ -139,7 +132,7 @@ Phaser.MSPointer.prototype = {
/**
* Description.
- * @method onPointerMove
+ * @method Phaser.MSPointer#onPointerMove
* @param {Any} event
**/
onPointerMove: function (event) {
@@ -158,7 +151,7 @@ Phaser.MSPointer.prototype = {
/**
* Description.
- * @method onPointerUp
+ * @method Phaser.MSPointer#onPointerUp
* @param {Any} event
**/
onPointerUp: function (event) {
@@ -177,7 +170,7 @@ Phaser.MSPointer.prototype = {
/**
* Stop the event listeners.
- * @method stop
+ * @method Phaser.MSPointer#stop
*/
stop: function () {
diff --git a/src/input/Mouse.js b/src/input/Mouse.js
index f1008091..cf44e993 100644
--- a/src/input/Mouse.js
+++ b/src/input/Mouse.js
@@ -2,10 +2,8 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Mouse
*/
-
/**
* Phaser - Mouse constructor.
*
@@ -22,7 +20,7 @@ Phaser.Mouse = function (game) {
this.game = game;
/**
- * @property {Phaser.Game} callbackContext - Description.
+ * @property {Object} callbackContext - Description.
*/
this.callbackContext = this.game;
@@ -44,36 +42,45 @@ Phaser.Mouse = function (game) {
*/
this.mouseUpCallback = null;
-};
-
-Phaser.Mouse.LEFT_BUTTON = 0;
-Phaser.Mouse.MIDDLE_BUTTON = 1;
-Phaser.Mouse.RIGHT_BUTTON = 2;
-
-Phaser.Mouse.prototype = {
-
- /**
- * @property {Phaser.Game} game - Local reference to game.
- */
- game: null,
-
/**
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
* @property {boolean} disabled
* @default
*/
- disabled: false,
+ this.disabled = false;
/**
* If the mouse has been Pointer Locked successfully this will be set to true.
* @property {boolean} locked
* @default
*/
- locked: false,
+ this.locked = false;
+
+};
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Mouse.LEFT_BUTTON = 0;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Mouse.MIDDLE_BUTTON = 1;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Mouse.RIGHT_BUTTON = 2;
+
+Phaser.Mouse.prototype = {
/**
* Starts the event listeners running.
- * @method start
+ * @method Phaser.Mouse#start
*/
start: function () {
@@ -105,7 +112,7 @@ Phaser.Mouse.prototype = {
/**
* Description.
- * @method onMouseDown
+ * @method Phaser.Mouse#onMouseDown
* @param {MouseEvent} event
*/
onMouseDown: function (event) {
@@ -128,7 +135,7 @@ Phaser.Mouse.prototype = {
/**
* Description
- * @method onMouseMove
+ * @method Phaser.Mouse#onMouseMove
* @param {MouseEvent} event
*/
onMouseMove: function (event) {
@@ -151,7 +158,7 @@ Phaser.Mouse.prototype = {
/**
* Description.
- * @method onMouseUp
+ * @method Phaser.Mouse#onMouseUp
* @param {MouseEvent} event
*/
onMouseUp: function (event) {
@@ -174,7 +181,7 @@ Phaser.Mouse.prototype = {
/**
* Description.
- * @method requestPointerLock
+ * @method Phaser.Mouse#requestPointerLock
*/
requestPointerLock: function () {
@@ -201,7 +208,7 @@ Phaser.Mouse.prototype = {
/**
* Description.
- * @method pointerLockChange
+ * @method Phaser.Mouse#pointerLockChange
* @param {MouseEvent} event
*/
pointerLockChange: function (event) {
@@ -223,7 +230,7 @@ Phaser.Mouse.prototype = {
/**
* Description.
- * @method releasePointerLock
+ * @method Phaser.Mouse#releasePointerLock
*/
releasePointerLock: function () {
@@ -239,7 +246,7 @@ Phaser.Mouse.prototype = {
/**
* Stop the event listeners.
- * @method stop
+ * @method Phaser.Mouse#stop
*/
stop: function () {
diff --git a/src/input/Pointer.js b/src/input/Pointer.js
index f753af48..d745b93c 100644
--- a/src/input/Pointer.js
+++ b/src/input/Pointer.js
@@ -2,7 +2,6 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Pointer
*/
/**
@@ -16,6 +15,16 @@
*/
Phaser.Pointer = function (game, id) {
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
+ this.game = game;
+
+ /**
+ * @property {Description} id - Description.
+ */
+ this.id = id;
+
/**
* Local private variable to store the status of dispatching a hold event.
* @property {boolean} _holdSent
@@ -194,16 +203,6 @@ Phaser.Pointer = function (game, id) {
*/
this.targetObject = null;
- /**
- * @property {Phaser.Game} game - Local reference to game.
- */
- this.game = game;
-
- /**
- * @property {Description} id - Description.
- */
- this.id = id;
-
/**
* Description.
* @property {boolean} isDown - Description.
@@ -240,7 +239,7 @@ Phaser.Pointer.prototype = {
/**
* Called when the Pointer is pressed onto the touchscreen.
- * @method start
+ * @method Phaser.Pointer#start
* @param {Any} event
*/
start: function (event) {
@@ -305,7 +304,7 @@ Phaser.Pointer.prototype = {
/**
* Description.
- * @method update
+ * @method Phaser.Pointer#update
*/
update: function () {
@@ -342,7 +341,7 @@ Phaser.Pointer.prototype = {
/**
* Called when the Pointer is moved
- * @method move
+ * @method Phaser.Pointer#move
* @param {Any} event
*/
move: function (event) {
@@ -482,7 +481,7 @@ Phaser.Pointer.prototype = {
/**
* Called when the Pointer leaves the target area.
- * @method leave
+ * @method Phaser.Pointer#leave
* @param {Any} event
*/
leave: function (event) {
@@ -494,7 +493,7 @@ Phaser.Pointer.prototype = {
/**
* Called when the Pointer leaves the touchscreen.
- * @method stop
+ * @method Phaser.Pointer#stop
* @param {Any} event
*/
stop: function (event) {
@@ -573,7 +572,7 @@ Phaser.Pointer.prototype = {
/**
* The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate.
- * @method justPressed
+ * @method Phaser.Pointer#justPressed
* @param {number} [duration]
* @return {boolean}
*/
@@ -587,7 +586,7 @@ Phaser.Pointer.prototype = {
/**
* The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate.
- * @method justReleased
+ * @method Phaser.Pointer#justReleased
* @param {number} [duration]
* @return {boolean}
*/
@@ -601,7 +600,7 @@ Phaser.Pointer.prototype = {
/**
* Resets the Pointer properties. Called by InputManager.reset when you perform a State change.
- * @method reset
+ * @method Phaser.Pointer#reset
*/
reset: function () {
@@ -629,7 +628,7 @@ Phaser.Pointer.prototype = {
/**
* Returns a string representation of this object.
- * @method toString
+ * @method Phaser.Pointer#toString
* @return {string} A string representation of the instance.
**/
toString: function () {
@@ -640,7 +639,9 @@ Phaser.Pointer.prototype = {
/**
* How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
-* @return {number}
+* @name Phaser.Pointer#duration
+* @property {number} duration - How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
+* @readonly
*/
Object.defineProperty(Phaser.Pointer.prototype, "duration", {
@@ -658,9 +659,11 @@ Object.defineProperty(Phaser.Pointer.prototype, "duration", {
});
/**
- * Gets the X value of this Pointer in world coordinates based on the given camera.
- * @return {Description}
- */
+* Gets the X value of this Pointer in world coordinates based on the world camera.
+* @name Phaser.Pointer#worldX
+* @property {number} duration - The X value of this Pointer in world coordinates based on the world camera.
+* @readonly
+*/
Object.defineProperty(Phaser.Pointer.prototype, "worldX", {
get: function () {
@@ -672,9 +675,11 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldX", {
});
/**
- * Gets the Y value of this Pointer in world coordinates based on the given camera.
- * @return {Description}
- */
+* Gets the Y value of this Pointer in world coordinates based on the world camera.
+* @name Phaser.Pointer#worldY
+* @property {number} duration - The Y value of this Pointer in world coordinates based on the world camera.
+* @readonly
+*/
Object.defineProperty(Phaser.Pointer.prototype, "worldY", {
get: function () {
diff --git a/src/input/Touch.js b/src/input/Touch.js
index 6d4e6c27..1cf58659 100644
--- a/src/input/Touch.js
+++ b/src/input/Touch.js
@@ -2,100 +2,92 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Touch
*/
/**
-* Phaser - Touch
+* Phaser.Touch handles touch events with your game. Note: Android 2.x only supports 1 touch event at once, no multi-touch.
*
-* @class
-*
+* @class Phaser.Touch
* @classdesc The Touch class handles touch interactions with the game and the resulting Pointer objects.
-* {@link http://www.w3.org/TR/touch-events/}
-* {@link https://developer.mozilla.org/en-US/docs/DOM/TouchList}
-* {@link http://www.html5rocks.com/en/mobile/touchandmouse/}
-*
Note: Android 2.x only supports 1 touch event at once, no multi-touch.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
*/
Phaser.Touch = function (game) {
- /**
+ /**
* @property {Phaser.Game} game - Local reference to game.
- */
- this.game = game;
-
- /**
- * @property {Phaser.Game} callbackContext - Description.
+ */
+ this.game = game;
+
+ /**
+ * You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
+ * @method Phaser.Touch#disabled
+ * @return {boolean}
+ */
+ this.disabled = false;
+
+ /**
+ * @property {Phaser.Game} callbackContext - Description.
*/
this.callbackContext = this.game;
- /**
- * @property {Phaser.Game} touchStartCallback - Description.
- * @default
+ /**
+ * @property {Phaser.Game} touchStartCallback - Description.
+ * @default
*/
this.touchStartCallback = null;
- /**
- * @property {Phaser.Game} touchMoveCallback - Description.
- * @default
+ /**
+ * @property {Phaser.Game} touchMoveCallback - Description.
+ * @default
*/
this.touchMoveCallback = null;
- /**
- * @property {Phaser.Game} touchEndCallback - Description.
- * @default
+ /**
+ * @property {Phaser.Game} touchEndCallback - Description.
+ * @default
*/
this.touchEndCallback = null;
- /**
- * @property {Phaser.Game} touchEnterCallback - Description.
- * @default
+ /**
+ * @property {Phaser.Game} touchEnterCallback - Description.
+ * @default
*/
this.touchEnterCallback = null;
- /**
- * @property {Phaser.Game} touchLeaveCallback - Description.
- * @default
+ /**
+ * @property {Phaser.Game} touchLeaveCallback - Description.
+ * @default
*/
this.touchLeaveCallback = null;
- /**
- * @property {Description} touchCancelCallback - Description.
- * @default
+ /**
+ * @property {Description} touchCancelCallback - Description.
+ * @default
*/
this.touchCancelCallback = null;
- /**
- * @property {boolean} preventDefault - Description.
- * @default
+ /**
+ * @property {boolean} preventDefault - Description.
+ * @default
*/
this.preventDefault = true;
+ this._onTouchStart = null;
+ this._onTouchMove = null;
+ this._onTouchEnd = null;
+ this._onTouchEnter = null;
+ this._onTouchLeave = null;
+ this._onTouchCancel = null;
+ this._onTouchMove = null;
+
};
Phaser.Touch.prototype = {
- game: null,
-
/**
- * You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
- * @method disabled
- * @return {boolean}
- */
- disabled: false,
-
- _onTouchStart: null,
- _onTouchMove: null,
- _onTouchEnd: null,
- _onTouchEnter: null,
- _onTouchLeave: null,
- _onTouchCancel: null,
- _onTouchMove: null,
-
- /**
* Starts the event listeners running.
- * @method start
+ * @method Phaser.Touch#start
*/
start: function () {
@@ -139,8 +131,8 @@ Phaser.Touch.prototype = {
/**
* Consumes all touchmove events on the document (only enable this if you know you need it!).
- * @method consumeTouchMove
- **/
+ * @method Phaser.Touch#consumeTouchMove
+ */
consumeDocumentTouches: function () {
this._documentTouchMove = function (event) {
@@ -151,11 +143,11 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* Description.
- * @method onTouchStart
+ * @method Phaser.Touch#onTouchStart
* @param {Any} event
- **/
+ */
onTouchStart: function (event) {
if (this.touchStartCallback)
@@ -183,12 +175,12 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* Touch cancel - touches that were disrupted (perhaps by moving into a plugin or browser chrome).
* Occurs for example on iOS when you put down 4 fingers and the app selector UI appears.
- * @method onTouchCancel
+ * @method Phaser.Touch#onTouchCancel
* @param {Any} event
- **/
+ */
onTouchCancel: function (event) {
if (this.touchCancelCallback)
@@ -215,12 +207,12 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* For touch enter and leave its a list of the touch points that have entered or left the target.
* Doesn't appear to be supported by most browsers on a canvas element yet.
- * @method onTouchEnter
+ * @method Phaser.Touch#onTouchEnter
* @param {Any} event
- **/
+ */
onTouchEnter: function (event) {
if (this.touchEnterCallback)
@@ -245,12 +237,12 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* For touch enter and leave its a list of the touch points that have entered or left the target.
* Doesn't appear to be supported by most browsers on a canvas element yet.
- * @method onTouchLeave
+ * @method Phaser.Touch#onTouchLeave
* @param {Any} event
- **/
+ */
onTouchLeave: function (event) {
if (this.touchLeaveCallback)
@@ -270,11 +262,11 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* Description.
- * @method onTouchMove
+ * @method Phaser.Touch#onTouchMove
* @param {Any} event
- **/
+ */
onTouchMove: function (event) {
if (this.touchMoveCallback)
@@ -294,11 +286,11 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* Description.
- * @method onTouchEnd
+ * @method Phaser.Touch#onTouchEnd
* @param {Any} event
- **/
+ */
onTouchEnd: function (event) {
if (this.touchEndCallback)
@@ -321,9 +313,9 @@ Phaser.Touch.prototype = {
},
- /**
+ /**
* Stop the event listeners.
- * @method stop
+ * @method Phaser.Touch#stop
*/
stop: function () {
diff --git a/src/loader/Cache.js b/src/loader/Cache.js
index 6e736c40..312cecaa 100644
--- a/src/loader/Cache.js
+++ b/src/loader/Cache.js
@@ -2,7 +2,6 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Cache
*/
/**
@@ -70,11 +69,12 @@ Phaser.Cache = function (game) {
Phaser.Cache.prototype = {
/**
- * Add a new canvas.
- * @param {string} key - Asset key for this canvas.
- * @param {HTMLCanvasElement} canvas - Canvas DOM element.
- * @param {CanvasRenderingContext2D} context - Render context of this canvas.
- */
+ * Add a new canvas object in to the cache.
+ * @method Phaser.Cache#addCanvas
+ * @param {string} key - Asset key for this canvas.
+ * @param {HTMLCanvasElement} canvas - Canvas DOM element.
+ * @param {CanvasRenderingContext2D} context - Render context of this canvas.
+ */
addCanvas: function (key, canvas, context) {
this._canvases[key] = { canvas: canvas, context: context };
@@ -82,10 +82,12 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new canvas.
- * @param key {string} Asset key for this canvas.
- * @param canvas {RenderTexture} A RenderTexture.
- */
+ * Add a new Phaser.RenderTexture in to the cache.
+ *
+ * @method Phaser.Cache#addRenderTexture
+ * @param {string} key - The unique key by which you will reference this object.
+ * @param {Phaser.Texture} textue - The texture to use as the base of the RenderTexture.
+ */
addRenderTexture: function (key, texture) {
var frame = new Phaser.Animation.Frame(0, 0, 0, texture.width, texture.height, '', '');
@@ -95,14 +97,16 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new sprite sheet.
- * @param {string} key - Asset key for the sprite sheet.
- * @param {string} url - URL of this sprite sheet file.
- * @param {object} data - Extra sprite sheet data.
- * @param {number} frameWidth - Width of the sprite sheet.
- * @param {number} frameHeight - Height of the sprite sheet.
- * @param {number} frameMax - How many frames stored in the sprite sheet.
- */
+ * Add a new sprite sheet in to the cache.
+ *
+ * @method Phaser.Cache#addSpriteSheet
+ * @param {string} key - The unique key by which you will reference this object.
+ * @param {string} url - URL of this sprite sheet file.
+ * @param {object} data - Extra sprite sheet data.
+ * @param {number} frameWidth - Width of the sprite sheet.
+ * @param {number} frameHeight - Height of the sprite sheet.
+ * @param {number} frameMax - How many frames stored in the sprite sheet.
+ */
addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax) {
this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight };
@@ -115,12 +119,15 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new tilemap.
- * @param {string} key - Asset key for the texture atlas.
- * @param {string} url - URL of this texture atlas file.
- * @param {object} data - Extra texture atlas data.
- * @param {object} atlasData - Texture atlas frames data.
- */
+ * Add a new tilemap.
+ *
+ * @method Phaser.Cache#addTilemap
+ * @param {string} key - The unique key by which you will reference this object.
+ * @param {string} url - URL of the tilemap image.
+ * @param {object} data - Tilemap data.
+ * @param {object} mapData - The tilemap data object.
+ * @param {number} format - The format of the tilemap data.
+ */
addTilemap: function (key, url, data, mapData, format) {
this._tilemaps[key] = { url: url, data: data, spriteSheet: true, mapData: mapData, format: format };
@@ -131,13 +138,15 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new texture atlas.
- * @param {string} key - Asset key for the texture atlas.
- * @param {string} url - URL of this texture atlas file.
- * @param {object} data - Extra texture atlas data.
- * @param {object} atlasData - Texture atlas frames data.
- * @param {Description} format - Description.
- */
+ * Add a new texture atlas.
+ *
+ * @method Phaser.Cache#addTextureAtlas
+ * @param {string} key - The unique key by which you will reference this object.
+ * @param {string} url - URL of this texture atlas file.
+ * @param {object} data - Extra texture atlas data.
+ * @param {object} atlasData - Texture atlas frames data.
+ * @param {number} format - The format of the texture atlas.
+ */
addTextureAtlas: function (key, url, data, atlasData, format) {
this._images[key] = { url: url, data: data, spriteSheet: true };
@@ -161,12 +170,14 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new Bitmap Font.
- * @param {string} key - Asset key for the font texture.
- * @param {string} url - URL of this font xml file.
- * @param {object} data - Extra font data.
- * @param xmlData {object} Texture atlas frames data.
- */
+ * Add a new Bitmap Font.
+ *
+ * @method Phaser.Cache#addBitmapFont
+ * @param {string} key - The unique key by which you will reference this object.
+ * @param {string} url - URL of this font xml file.
+ * @param {object} data - Extra font data.
+ * @param xmlData {object} Texture atlas frames data.
+ */
addBitmapFont: function (key, url, data, xmlData) {
this._images[key] = { url: url, data: data, spriteSheet: true };
@@ -180,10 +191,10 @@ Phaser.Cache.prototype = {
},
/**
- * Adds a default image to be used when a key is wrong / missing.
- * Is mapped to the key __default
- * @method addDefaultImage
- */
+ * Adds a default image to be used when a key is wrong / missing. Is mapped to the key __default.
+ *
+ * @method Phaser.Cache#addDefaultImage
+ */
addDefaultImage: function () {
this._images['__default'] = { url: null, data: null, spriteSheet: false };
@@ -200,12 +211,13 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new image.
- * @method addImage
- * @param {string} key - Asset key for the image.
- * @param {string} url - URL of this image file.
- * @param {object} data - Extra image data.
- */
+ * Add a new image.
+ *
+ * @method Phaser.Cache#addImage
+ * @param {string} key - The unique key by which you will reference this object.
+ * @param {string} url - URL of this image file.
+ * @param {object} data - Extra image data.
+ */
addImage: function (key, url, data) {
this._images[key] = { url: url, data: data, spriteSheet: false };
@@ -217,12 +229,15 @@ Phaser.Cache.prototype = {
},
/**
- * Add a new sound.
- * @method addSound
- * @param {string} key - Asset key for the sound.
- * @param {string} url - URL of this sound file.
- * @param {object} data - Extra sound data.
- */
+ * Add a new sound.
+ *
+ * @method Phaser.Cache#addSound
+ * @param {string} key - Asset key for the sound.
+ * @param {string} url - URL of this sound file.
+ * @param {object} data - Extra sound data.
+ * @param {boolean} webAudio - True if the file is using web audio.
+ * @param {boolean} audioTag - True if the file is using legacy HTML audio.
+ */
addSound: function (key, url, data, webAudio, audioTag) {
webAudio = webAudio || true;
@@ -241,10 +256,10 @@ Phaser.Cache.prototype = {
},
/**
- * Reload a sound.
- * @method reloadSound
- * @param {string} key - Asset key for the sound.
- */
+ * Reload a sound.
+ * @method Phaser.Cache#reloadSound
+ * @param {string} key - Asset key for the sound.
+ */
reloadSound: function (key) {
var _this = this;
@@ -262,10 +277,10 @@ Phaser.Cache.prototype = {
},
/**
- * Description.
- * @method reloadSoundComplete
- * @param {string} key - Asset key for the sound.
- */
+ * Description.
+ * @method Phaser.Cache#reloadSoundComplete
+ * @param {string} key - Asset key for the sound.
+ */
reloadSoundComplete: function (key) {
if (this._sounds[key])
@@ -277,10 +292,10 @@ Phaser.Cache.prototype = {
},
/**
- * Description.
- * @method updateSound
- * @param {string} key - Asset key for the sound.
- */
+ * Description.
+ * @method Phaser.Cache#updateSound
+ * @param {string} key - Asset key for the sound.
+ */
updateSound: function (key, property, value) {
if (this._sounds[key])
@@ -292,6 +307,8 @@ Phaser.Cache.prototype = {
/**
* Add a new decoded sound.
+ *
+ * @method Phaser.Cache#decodedSound
* @param {string} key - Asset key for the sound.
* @param {object} data - Extra sound data.
*/
@@ -305,6 +322,8 @@ Phaser.Cache.prototype = {
/**
* Add a new text data.
+ *
+ * @method Phaser.Cache#addText
* @param {string} key - Asset key for the text data.
* @param {string} url - URL of this text data file.
* @param {object} data - Extra text data.
@@ -319,7 +338,9 @@ Phaser.Cache.prototype = {
},
/**
- * Get canvas by key.
+ * Get acanvas object from the cache by its key.
+ *
+ * @method Phaser.Cache#getCanvas
* @param {string} key - Asset key of the canvas you want.
* @return {object} The canvas you want.
*/
@@ -335,6 +356,8 @@ Phaser.Cache.prototype = {
/**
* Checks if an image key exists.
+ *
+ * @method Phaser.Cache#checkImageKey
* @param {string} key - Asset key of the image you want.
* @return {boolean} True if the key exists, otherwise false.
*/
@@ -351,6 +374,8 @@ Phaser.Cache.prototype = {
/**
* Get image data by key.
+ *
+ * @method Phaser.Cache#getImage
* @param {string} key - Asset key of the image you want.
* @return {object} The image data you want.
*/
@@ -366,8 +391,10 @@ Phaser.Cache.prototype = {
/**
* Get tilemap data by key.
+ *
+ * @method Phaser.Cache#getTilemap
* @param {string} key - Asset key of the tilemap you want.
- * @return {object} The tilemap data. The tileset image is in the data property, the map data in mapData.
+ * @return {Phaser.Tilemap} The tilemap data. The tileset image is in the data property, the map data in mapData.
*/
getTilemap: function (key) {
@@ -381,8 +408,10 @@ Phaser.Cache.prototype = {
/**
* Get frame data by key.
+ *
+ * @method Phaser.Cache#getFrameData
* @param {string} key - Asset key of the frame data you want.
- * @return {object} The frame data you want.
+ * @return {Phaser.Animation.FrameData} The frame data you want.
*/
getFrameData: function (key) {
@@ -396,8 +425,10 @@ Phaser.Cache.prototype = {
/**
* Get a single frame out of a frameData set by key.
+ *
+ * @method Phaser.Cache#getFrameByIndex
* @param {string} key - Asset key of the frame data you want.
- * @return {object} The frame data you want.
+ * @return {Phaser.Animation.Frame} The frame data you want.
*/
getFrameByIndex: function (key, frame) {
@@ -411,8 +442,10 @@ Phaser.Cache.prototype = {
/**
* Get a single frame out of a frameData set by key.
+ *
+ * @method Phaser.Cache#getFrameByName
* @param {string} key - Asset key of the frame data you want.
- * @return {object} The frame data you want.
+ * @return {Phaser.Animation.Frame} The frame data you want.
*/
getFrameByName: function (key, frame) {
@@ -426,8 +459,10 @@ Phaser.Cache.prototype = {
/**
* Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
+ *
+ * @method Phaser.Cache#getFrame
* @param {string} key - Asset key of the frame data you want.
- * @return {object} The frame data you want.
+ * @return {Phaser.Animation.Frame} The frame data you want.
*/
getFrame: function (key) {
@@ -441,8 +476,10 @@ Phaser.Cache.prototype = {
/**
* Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
+ *
+ * @method Phaser.Cache#getTextureFrame
* @param {string} key - Asset key of the frame data you want.
- * @return {object} The frame data you want.
+ * @return {Phaser.Animation.Frame} The frame data you want.
*/
getTextureFrame: function (key) {
@@ -456,8 +493,10 @@ Phaser.Cache.prototype = {
/**
* Get a RenderTexture by key.
+ *
+ * @method Phaser.Cache#getTexture
* @param {string} key - Asset key of the RenderTexture you want.
- * @return {object} The RenderTexture you want.
+ * @return {Phaser.RenderTexture} The RenderTexture you want.
*/
getTexture: function (key) {
@@ -472,8 +511,10 @@ Phaser.Cache.prototype = {
/**
* Get sound by key.
+ *
+ * @method Phaser.Cache#getSound
* @param {string} key - Asset key of the sound you want.
- * @return {object} The sound you want.
+ * @return {Phaser.Sound} The sound you want.
*/
getSound: function (key) {
@@ -488,6 +529,8 @@ Phaser.Cache.prototype = {
/**
* Get sound data by key.
+ *
+ * @method Phaser.Cache#getSoundData
* @param {string} key - Asset key of the sound you want.
* @return {object} The sound data you want.
*/
@@ -503,9 +546,11 @@ Phaser.Cache.prototype = {
},
/**
- * Check whether an asset is decoded sound.
+ * Check if the given sound has finished decoding.
+ *
+ * @method Phaser.Cache#isSoundDecoded
* @param {string} key - Asset key of the sound you want.
- * @return {object} The sound data you want.
+ * @return {boolean} The decoded state of the Sound object.
*/
isSoundDecoded: function (key) {
@@ -517,9 +562,11 @@ Phaser.Cache.prototype = {
},
/**
- * Check whether an asset is decoded sound.
+ * Check if the given sound is ready for playback. A sound is considered ready when it has finished decoding and the device is no longer touch locked.
+ *
+ * @method Phaser.Cache#isSoundReady
* @param {string} key - Asset key of the sound you want.
- * @return {object} The sound data you want.
+ * @return {boolean} True if the sound is decoded and the device is not touch locked.
*/
isSoundReady: function (key) {
@@ -528,9 +575,11 @@ Phaser.Cache.prototype = {
},
/**
- * Check whether an asset is sprite sheet.
+ * Check whether an image asset is sprite sheet or not.
+ *
+ * @method Phaser.Cache#isSpriteSheet
* @param {string} key - Asset key of the sprite sheet you want.
- * @return {object} The sprite sheet data you want.
+ * @return {boolean} True if the image is a sprite sheet.
*/
isSpriteSheet: function (key) {
@@ -545,6 +594,8 @@ Phaser.Cache.prototype = {
/**
* Get text data by key.
+ *
+ * @method Phaser.Cache#getText
* @param {string} key - Asset key of the text data you want.
* @return {object} The text data you want.
*/
@@ -559,6 +610,14 @@ Phaser.Cache.prototype = {
},
+ /**
+ * Get the cache keys from a given array of objects.
+ * Normally you don't call this directly but instead use getImageKeys, getSoundKeys, etc.
+ *
+ * @method Phaser.Cache#getKeys
+ * @param {Array} array - An array of items to return the keys for.
+ * @return {Array} The array of item keys.
+ */
getKeys: function (array) {
var output = [];
@@ -577,6 +636,8 @@ Phaser.Cache.prototype = {
/**
* Returns an array containing all of the keys of Images in the Cache.
+ *
+ * @method Phaser.Cache#getImageKeys
* @return {Array} The string based keys in the Cache.
*/
getImageKeys: function () {
@@ -585,6 +646,8 @@ Phaser.Cache.prototype = {
/**
* Returns an array containing all of the keys of Sounds in the Cache.
+ *
+ * @method Phaser.Cache#getSoundKeys
* @return {Array} The string based keys in the Cache.
*/
getSoundKeys: function () {
@@ -593,6 +656,8 @@ Phaser.Cache.prototype = {
/**
* Returns an array containing all of the keys of Text Files in the Cache.
+ *
+ * @method Phaser.Cache#getTextKeys
* @return {Array} The string based keys in the Cache.
*/
getTextKeys: function () {
@@ -600,40 +665,49 @@ Phaser.Cache.prototype = {
},
/**
- * Description.
- * @method removeCanvas
+ * Removes a canvas from the cache.
+ *
+ * @method Phaser.Cache#removeCanvas
+ * @param {string} key - Key of the asset you want to remove.
*/
removeCanvas: function (key) {
delete this._canvases[key];
},
- /**
- * Description.
- * @method removeImage
- */
+ /**
+ * Removes an image from the cache.
+ *
+ * @method Phaser.Cache#removeImage
+ * @param {string} key - Key of the asset you want to remove.
+ */
removeImage: function (key) {
delete this._images[key];
},
- /**
- * Description.
- * @method removeSound
- */
+ /**
+ * Removes a sound from the cache.
+ *
+ * @method Phaser.Cache#removeSound
+ * @param {string} key - Key of the asset you want to remove.
+ */
removeSound: function (key) {
delete this._sounds[key];
},
- /**
- * Description.
- * @method removeText
- */
+ /**
+ * Removes a text from the cache.
+ *
+ * @method Phaser.Cache#removeText
+ * @param {string} key - Key of the asset you want to remove.
+ */
removeText: function (key) {
delete this._text[key];
},
/**
- * Clean up cache memory.
- * @method destroy
+ * Clears the cache. Removes every local cache object reference.
+ *
+ * @method Phaser.Cache#destroy
*/
destroy: function () {
diff --git a/src/loader/Loader.js b/src/loader/Loader.js
index 630ef484..adcf1d91 100644
--- a/src/loader/Loader.js
+++ b/src/loader/Loader.js
@@ -2,7 +2,6 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Loader
*/
/**
@@ -116,19 +115,33 @@ Phaser.Loader = function (game) {
};
/**
- * TextureAtlas data format constants
- */
+* @constant
+* @type {number}
+*/
Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY = 0;
+
+/**
+* @constant
+* @type {number}
+*/
Phaser.Loader.TEXTURE_ATLAS_JSON_HASH = 1;
+
+/**
+* @constant
+* @type {number}
+*/
Phaser.Loader.TEXTURE_ATLAS_XML_STARLING = 2;
Phaser.Loader.prototype = {
+
/**
- * Description.
+ * You can set a Sprite to be a "preload" sprite by passing it to this method.
+ * A "preload" sprite will have its width or height crop adjusted based on the percentage of the loader in real-time.
+ * This allows you to easily make loading bars for games.
*
- * @method setPreloadSprite
- * @param {Phaser.Sprite} sprite - Description.
- * @param {number} direction - Description.
+ * @method Phaser.Loader#setPreloadSprite
+ * @param {Phaser.Sprite} sprite - The sprite that will be cropped during the load.
+ * @param {number} [direction=0] - A value of zero means the sprite width will be cropped, a value of 1 means its height will be cropped.
*/
setPreloadSprite: function (sprite, direction) {
@@ -153,7 +166,8 @@ Phaser.Loader.prototype = {
/**
* Check whether asset exists with a specific key.
- * @method checkKeyExists
+ *
+ * @method Phaser.Loader#checkKeyExists
* @param {string} key - Key of the asset you want to check.
* @return {boolean} Return true if exists, otherwise return false.
*/
@@ -172,7 +186,8 @@ Phaser.Loader.prototype = {
/**
* Reset loader, this will remove all loaded assets.
- * @method reset
+ *
+ * @method Phaser.Loader#reset
*/
reset: function () {
@@ -183,12 +198,14 @@ Phaser.Loader.prototype = {
},
/**
- * Internal function that adds a new entry to the file list.
- * @method addToFileList
+ * Internal function that adds a new entry to the file list. Do not call directly.
+ *
+ * @method Phaser.Loader#addToFileList
* @param {Description} type - Description.
* @param {string} key - Description.
* @param {string} url - URL of Description.
* @param {Description} properties - Description.
+ * @protected
*/
addToFileList: function (type, key, url, properties) {
@@ -219,7 +236,8 @@ Phaser.Loader.prototype = {
/**
* Add an image to the Loader.
- * @method image
+ *
+ * @method Phaser.Loader#image
* @param {string} key - Unique asset key of this image file.
* @param {string} url - URL of image file.
* @param {boolean} overwrite - If an entry with a matching key already exists this will over-write it
@@ -237,7 +255,8 @@ Phaser.Loader.prototype = {
/**
* Add a text file to the Loader.
- * @method text
+ *
+ * @method Phaser.Loader#text
* @param {string} key - Unique asset key of the text file.
* @param {string} url - URL of the text file.
* @param {boolean} overwrite - True if Description.
@@ -254,8 +273,9 @@ Phaser.Loader.prototype = {
},
/**
- * Add a new sprite sheet loading request.
- * @method spritesheet
+ * Add a new sprite sheet to the loader.
+ *
+ * @method Phaser.Loader#spritesheet
* @param {string} key - Unique asset key of the sheet file.
* @param {string} url - URL of the sheet file.
* @param {number} frameWidth - Width of each single frame.
@@ -274,8 +294,9 @@ Phaser.Loader.prototype = {
},
/**
- * Add a new audio file loading request.
- * @method audio
+ * Add a new audio file to the loader.
+ *
+ * @method Phaser.Loader#audio
* @param {string} key - Unique asset key of the audio file.
* @param {Array} urls - An array containing the URLs of the audio files, i.e.: [ 'jump.mp3', 'jump.ogg', 'jump.m4a' ].
* @param {boolean} autoDecode - When using Web Audio the audio files can either be decoded at load time or run-time. They can't be played until they are decoded, but this let's you control when that happens. Decoding is a non-blocking async process.
@@ -293,7 +314,8 @@ Phaser.Loader.prototype = {
/**
* Add a new tilemap loading request.
- * @method tilemap
+ *
+ * @method Phaser.Loader#tilemap
* @param {string} key - Unique asset key of the tilemap data.
* @param {string} tilesetURL - The url of the tile set image file.
* @param {string} [mapDataURL] - The url of the map data file (csv/json)
@@ -340,7 +362,8 @@ Phaser.Loader.prototype = {
/**
* Add a new bitmap font loading request.
- * @method bitmapFont
+ *
+ * @method Phaser.Loader#bitmapFont
* @param {string} key - Unique asset key of the bitmap font.
* @param {string} textureURL - The url of the font image file.
* @param {string} [xmlURL] - The url of the font data file (xml/fnt)
@@ -398,8 +421,9 @@ Phaser.Loader.prototype = {
},
/**
- * Description.
- * @method atlasJSONArray
+ * Add a new texture atlas to the loader. This atlas uses the JSON Array data format.
+ *
+ * @method Phaser.Loader#atlasJSONArray
* @param {string} key - Unique asset key of the bitmap font.
* @param {Description} atlasURL - The url of the Description.
* @param {Description} atlasData - Description.
@@ -411,8 +435,9 @@ Phaser.Loader.prototype = {
},
/**
- * Description.
- * @method atlasJSONHash
+ * Add a new texture atlas to the loader. This atlas uses the JSON Hash data format.
+ *
+ * @method Phaser.Loader#atlasJSONHash
* @param {string} key - Unique asset key of the bitmap font.
* @param {Description} atlasURL - The url of the Description.
* @param {Description} atlasData - Description.
@@ -424,8 +449,9 @@ Phaser.Loader.prototype = {
},
/**
- * Description.
- * @method atlasXML
+ * Add a new texture atlas to the loader. This atlas uses the Starling XML data format.
+ *
+ * @method Phaser.Loader#atlasXML
* @param {string} key - Unique asset key of the bitmap font.
* @param {Description} atlasURL - The url of the Description.
* @param {Description} atlasData - Description.
@@ -437,13 +463,14 @@ Phaser.Loader.prototype = {
},
/**
- * Add a new texture atlas loading request.
- * @method atlas
+ * Add a new texture atlas to the loader.
+ *
+ * @method Phaser.Loader#atlas
* @param {string} key - Unique asset key of the texture atlas file.
* @param {string} textureURL - The url of the texture atlas image file.
- * @param {string} [atlasURL] - The url of the texture atlas data file (json/xml)
- * @param {object} [atlasData] - A JSON or XML data object.
- * @param {number} [format] - A value describing the format of the data.
+ * @param {string} [atlasURL] - The url of the texture atlas data file (json/xml). You don't need this if you are passing an atlasData object instead.
+ * @param {object} [atlasData] - A JSON or XML data object. You don't need this if the data is being loaded from a URL.
+ * @param {number} [format] - A value describing the format of the data, the default is Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY.
*/
atlas: function (key, textureURL, atlasURL, atlasData, format) {
@@ -517,10 +544,11 @@ Phaser.Loader.prototype = {
},
/**
- * Remove loading request of a file.
- * @method removeFile
- * @param key {string} Key of the file you want to remove.
- */
+ * Remove loading request of a file.
+ *
+ * @method Phaser.Loader#removeFile
+ * @param key {string} Key of the file you want to remove.
+ */
removeFile: function (key) {
delete this._fileList[key];
@@ -528,9 +556,10 @@ Phaser.Loader.prototype = {
},
/**
- * Remove all file loading requests.
- * @method removeAll
- */
+ * Remove all file loading requests.
+ *
+ * @method Phaser.Loader#removeAll
+ */
removeAll: function () {
this._fileList = {};
@@ -538,9 +567,10 @@ Phaser.Loader.prototype = {
},
/**
- * Load assets.
- * @method start
- */
+ * Start loading the assets. Normally you don't need to call this yourself as the StateManager will do so.
+ *
+ * @method Phaser.Loader#start
+ */
start: function () {
if (this.isLoading)
@@ -570,7 +600,8 @@ Phaser.Loader.prototype = {
/**
* Load files. Private method ONLY used by loader.
- * @method loadFile
+ *
+ * @method Phaser.Loader#loadFile
* @private
*/
loadFile: function () {
@@ -664,9 +695,10 @@ Phaser.Loader.prototype = {
},
/**
- * Load files. Private method ONLY used by loader.
- * @method getAudioURL
+ * Private method ONLY used by loader.
+ * @method Phaser.Loader#getAudioURL
* @param {Description} urls - Description.
+ * @private
*/
getAudioURL: function (urls) {
@@ -690,7 +722,8 @@ Phaser.Loader.prototype = {
/**
* Error occured when load a file.
- * @method fileError
+ *
+ * @method Phaser.Loader#fileError
* @param {string} key - Key of the error loading file.
*/
fileError: function (key) {
@@ -708,7 +741,8 @@ Phaser.Loader.prototype = {
/**
* Called when a file is successfully loaded.
- * @method fileComplete
+ *
+ * @method Phaser.Loader#fileComplete
* @param {string} key - Key of the successfully loaded file.
*/
fileComplete: function (key) {
@@ -872,7 +906,8 @@ Phaser.Loader.prototype = {
/**
* Successfully loaded a JSON file.
- * @method jsonLoadComplete
+ *
+ * @method Phaser.Loader#jsonLoadComplete
* @param {string} key - Key of the loaded JSON file.
*/
jsonLoadComplete: function (key) {
@@ -895,7 +930,8 @@ Phaser.Loader.prototype = {
/**
* Successfully loaded a CSV file.
- * @method csvLoadComplete
+ *
+ * @method Phaser.Loader#csvLoadComplete
* @param {string} key - Key of the loaded CSV file.
*/
csvLoadComplete: function (key) {
@@ -911,7 +947,8 @@ Phaser.Loader.prototype = {
/**
* Error occured when load a JSON.
- * @method dataLoadError
+ *
+ * @method Phaser.Loader#dataLoadError
* @param {string} key - Key of the error loading JSON file.
*/
dataLoadError: function (key) {
@@ -928,7 +965,8 @@ Phaser.Loader.prototype = {
/**
* Successfully loaded an XML file.
- * @method xmlLoadComplete
+ *
+ * @method Phaser.Loader#xmlLoadComplete
* @param {string} key - Key of the loaded XML file.
*/
xmlLoadComplete: function (key) {
@@ -976,10 +1014,12 @@ Phaser.Loader.prototype = {
},
/**
- * Handle loading next file.
- * @param previousKey {string} Key of previous loaded asset.
- * @param success {boolean} Whether the previous asset loaded successfully or not.
- */
+ * Handle loading next file.
+ *
+ * @param previousKey {string} Key of previous loaded asset.
+ * @param success {boolean} Whether the previous asset loaded successfully or not.
+ * @private
+ */
nextFile: function (previousKey, success) {
this.progress = Math.round(this.progress + this._progressChunk);
diff --git a/src/loader/Parser.js b/src/loader/Parser.js
index a402ad51..707e5f68 100644
--- a/src/loader/Parser.js
+++ b/src/loader/Parser.js
@@ -2,19 +2,18 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Parser
*/
-
/**
-* Description of Phaser.Loader.Parser
+* Phaser.Loader.Parser parses data objects from Phaser.Loader that need more preparation before they can be inserted into the Cache.
*
-* @class Phaser.Loader.Parser
+* @class Phaser.Loader.Parser
*/
Phaser.Loader.Parser = {
/**
* Parse frame data from an XML file.
+ * @method Phaser.Loader.Parser.bitmapFont
* @param {object} xml - XML data you want to parse.
* @return {FrameData} Generated FrameData object.
*/
diff --git a/src/math/Math.js b/src/math/Math.js
index f9b3298a..9b434915 100644
--- a/src/math/Math.js
+++ b/src/math/Math.js
@@ -2,7 +2,6 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Math
*/
/**
@@ -14,14 +13,13 @@ Phaser.Math = {
/**
* = 2 π
- * @method PI2
- *
+ * @method Phaser.Math#PI2
*/
PI2: Math.PI * 2,
/**
* Two number are fuzzyEqual if their difference is less than ε.
- * @method fuzzyEqual
+ * @method Phaser.Math#fuzzyEqual
* @param {number} a
* @param {number} b
* @param {number} epsilon
@@ -34,7 +32,7 @@ Phaser.Math = {
/**
* a is fuzzyLessThan b if it is less than b + ε.
- * @method fuzzyEqual
+ * @method Phaser.Math#fuzzyEqual
* @param {number} a
* @param {number} b
* @param {number} epsilon
@@ -47,7 +45,7 @@ Phaser.Math = {
/**
* a is fuzzyGreaterThan b if it is more than b - ε.
- * @method fuzzyGreaterThan
+ * @method Phaser.Math#fuzzyGreaterThan
* @param {number} a
* @param {number} b
* @param {number} epsilon
@@ -59,7 +57,7 @@ Phaser.Math = {
},
/**
- * @method fuzzyCeil
+ * @method Phaser.Math#fuzzyCeil
* @param {number} val
* @param {number} epsilon
* @return {boolean} ceiling(val-ε)
@@ -70,7 +68,7 @@ Phaser.Math = {
},
/**
- * @method fuzzyFloor
+ * @method Phaser.Math#fuzzyFloor
* @param {number} val
* @param {number} epsilon
* @return {boolean} floor(val-ε)
@@ -81,7 +79,9 @@ Phaser.Math = {
},
/**
- * @method average
+ * Averages all values passed to the function and returns the result. You can pass as many parameters as you like.
+ * @method Phaser.Math#average
+ * @return {number} The average of all given values.
*/
average: function () {
@@ -102,16 +102,18 @@ Phaser.Math = {
},
/**
- * @method truncate
+ * @method Phaser.Math#truncate
+ * @param {number} n
+ * @return {number}
*/
truncate: function (n) {
return (n > 0) ? Math.floor(n) : Math.ceil(n);
},
/**
- * @method shear
- * @param n
- * @return n mod 1
+ * @method Phaser.Math#shear
+ * @param {number} n
+ * @return {number} n mod 1
*/
shear: function (n) {
return n % 1;
@@ -122,10 +124,11 @@ Phaser.Math = {
*
* Example: if you have an interval gap of 5 and a position of 12... you will snap to 10 whereas 14 will snap to 15.
*
- * @method snapTo
+ * @method Phaser.Math#snapTo
* @param {number} input - The value to snap.
* @param {number} gap - The interval gap of the grid.
* @param {number} [start] - Optional starting offset for gap.
+ * @return {number}
*/
snapTo: function (input, gap, start) {
@@ -147,10 +150,11 @@ Phaser.Math = {
*
* Example: if you have an interval gap of 5 and a position of 12... you will snap to 10. As will 14 snap to 10... but 16 will snap to 15
*
- * @method snapToFloor
+ * @method Phaser.Math#snapToFloor
* @param {number} input - The value to snap.
* @param {number} gap - The interval gap of the grid.
* @param {number} [start] - Optional starting offset for gap.
+ * @return {number}
*/
snapToFloor: function (input, gap, start) {
@@ -172,10 +176,11 @@ Phaser.Math = {
*
* Example: if you have an interval gap of 5 and a position of 12... you will snap to 15. As will 14 will snap to 15... but 16 will snap to 20.
*
- * @method snapToCeil
+ * @method Phaser.Math#snapToCeil
* @param {number} input - The value to snap.
* @param {number} gap - The interval gap of the grid.
* @param {number} [start] - Optional starting offset for gap.
+ * @return {number}
*/
snapToCeil: function (input, gap, start) {
@@ -195,10 +200,11 @@ Phaser.Math = {
/**
* Snaps a value to the nearest value in an array.
- * @method
+ * @method Phaser.Math#snapToInArray
* @param {number} input
* @param {array} arr
* @param {boolean} sort - True if the array needs to be sorted.
+ * @return {number}
*/
snapToInArray: function (input, arr, sort) {
@@ -255,10 +261,11 @@ Phaser.Math = {
* Note what occurs when we round to the 3rd space (8ths place), 100100000, this is to be assumed
* because we are rounding 100011.1011011011011011 which rounds up.
*
- * @method roundTo
+ * @method Phaser.Math#roundTo
* @param {number} value - The value to round.
* @param {number} place - The place to round to.
* @param {number} base - The base to round in... default is 10 for decimal.
+ * @return {number}
*/
roundTo: function (value, place, base) {
@@ -272,10 +279,11 @@ Phaser.Math = {
},
/**
- * @method floorTo
+ * @method Phaser.Math#floorTo
* @param {number} value - The value to round.
* @param {number} place - The place to round to.
* @param {number} base - The base to round in... default is 10 for decimal.
+ * @return {number}
*/
floorTo: function (value, place, base) {
@@ -289,10 +297,11 @@ Phaser.Math = {
},
/**
- * @method ceilTo
+ * @method Phaser.Math#ceilTo
* @param {number} value - The value to round.
* @param {number} place - The place to round to.
* @param {number} base - The base to round in... default is 10 for decimal.
+ * @return {number}
*/
ceilTo: function (value, place, base) {
@@ -307,10 +316,11 @@ Phaser.Math = {
/**
* A one dimensional linear interpolation of a value.
- * @method interpolateFloat
+ * @method Phaser.Math#interpolateFloat
* @param {number} a
* @param {number} b
* @param {number} weight
+ * @return {number}
*/
interpolateFloat: function (a, b, weight) {
return (b - a) * weight + a;
@@ -318,11 +328,12 @@ Phaser.Math = {
/**
* Find the angle of a segment from (x1, y1) -> (x2, y2 ).
- * @method angleBetween
+ * @method Phaser.Math#angleBetween
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
+ * @return {number}
*/
angleBetween: function (x1, y1, x2, y2) {
return Math.atan2(y2 - y1, x2 - x1);
@@ -330,9 +341,10 @@ Phaser.Math = {
/**
* Set an angle within the bounds of -π toπ.
- * @method normalizeAngle
+ * @method Phaser.Math#normalizeAngle
* @param {number} angle
* @param {boolean} radians - True if angle size is expressed in radians.
+ * @return {number}
*/
normalizeAngle: function (angle, radians) {
@@ -346,10 +358,11 @@ Phaser.Math = {
/**
* Closest angle between two angles from a1 to a2
* absolute value the return for exact angle
- * @method nearestAngleBetween
+ * @method Phaser.Math#nearestAngleBetween
* @param {number} a1
* @param {number} a2
* @param {boolean} radians - True if angle sizes are expressed in radians.
+ * @return {number}
*/
nearestAngleBetween: function (a1, a2, radians) {
@@ -375,12 +388,13 @@ Phaser.Math = {
/**
* Interpolate across the shortest arc between two angles.
- * @method interpolateAngles
+ * @method Phaser.Math#interpolateAngles
* @param {number} a1 - Description.
* @param {number} a2 - Description.
* @param {number} weight - Description.
* @param {boolean} radians - True if angle sizes are expressed in radians.
* @param {Description} ease - Description.
+ * @return {number}
*/
interpolateAngles: function (a1, a2, weight, radians, ease) {
@@ -400,7 +414,7 @@ Phaser.Math = {
* Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
* of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.
*
- * @method chanceRoll
+ * @method Phaser.Math#chanceRoll
* @param {number} chance - The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).
* @return {boolean} True if the roll passed, or false otherwise.
*/
@@ -433,7 +447,7 @@ Phaser.Math = {
/**
* Returns an Array containing the numbers from min to max (inclusive).
*
- * @method numberArray
+ * @method Phaser.Math#numberArray
* @param {number} min - The minimum value the array starts with.
* @param {number} max - The maximum value the array contains.
* @return {array} The array of number values.
@@ -454,11 +468,11 @@ Phaser.Math = {
/**
* Adds the given amount to the value, but never lets the value go over the specified maximum.
*
- * @method maxAdd
+ * @method Phaser.Math#maxAdd
* @param {number} value - The value to add the amount to.
* @param {number} amount - The amount to add to the value.
* @param {number} max- The maximum the value is allowed to be.
- * @return The new value.
+ * @return {number}
*/
maxAdd: function (value, amount, max) {
@@ -476,7 +490,7 @@ Phaser.Math = {
/**
* Subtracts the given amount from the value, but never lets the value go below the specified minimum.
*
- * @method minSub
+ * @method Phaser.Math#minSub
* @param {number} value - The base value.
* @param {number} amount - The amount to subtract from the base value.
* @param {number} min - The minimum the value is allowed to be.
@@ -499,10 +513,11 @@ Phaser.Math = {
* Ensures that the value always stays between min and max, by wrapping the value around.
*
max should be larger than min, or the function will return 0
*
+ * @method Phaser.Math#wrap
* @param value The value to wrap
* @param min The minimum the value is allowed to be
* @param max The maximum the value is allowed to be
- * @return The wrapped value
+ * @return {number} The wrapped value
*/
wrap: function (value, min, max) {
@@ -523,12 +538,11 @@ Phaser.Math = {
* Adds value to amount and ensures that the result always stays between 0 and max, by wrapping the value around.
*
Values must be positive integers, and are passed through Math.abs
*
- * @method wrapValue
+ * @method Phaser.Math#wrapValue
* @param {number} value - The value to add the amount to.
* @param {number} amount - The amount to add to the value.
* @param {number} max - The maximum the value is allowed to be.
* @return {number} The wrapped value.
-
*/
wrapValue: function (value, amount, max) {
@@ -545,7 +559,7 @@ Phaser.Math = {
/**
* Randomly returns either a 1 or -1.
*
- * @method randomSign
+ * @method Phaser.Math#randomSign
* @return {number} 1 or -1
*/
randomSign: function () {
@@ -555,8 +569,8 @@ Phaser.Math = {
/**
* Returns true if the number given is odd.
*
- * @method isOdd
- * @param {number} n - The number to check.
+ * @method Phaser.Math#isOdd
+ * @param {number} n - The number to check.
* @return {boolean} True if the given number is odd. False if the given number is even.
*/
isOdd: function (n) {
@@ -568,8 +582,8 @@ Phaser.Math = {
/**
* Returns true if the number given is even.
*
- * @method isEven
- * @param {number} n - The number to check.
+ * @method Phaser.Math#isEven
+ * @param {number} n - The number to check.
* @return {boolean} True if the given number is even. False if the given number is odd.
*/
isEven: function (n) {
@@ -587,10 +601,10 @@ Phaser.Math = {
/**
* Significantly faster version of Math.max
- * See {@link http://jsperf.com/math-s-min-max-vs-homemade/5}
+ * See http://jsperf.com/math-s-min-max-vs-homemade/5
*
- * @method max
- * @return The highest value from those given.
+ * @method Phaser.Math#max
+ * @return {number} The highest value from those given.
*/
max: function () {
@@ -608,10 +622,10 @@ Phaser.Math = {
/**
* Significantly faster version of Math.min
- * See {@link http://jsperf.com/math-s-min-max-vs-homemade/5}
+ * See http://jsperf.com/math-s-min-max-vs-homemade/5
*
- * @method min
- * @return The lowest value from those given.
+ * @method Phaser.Math#min
+ * @return {number} The lowest value from those given.
*/
min: function () {
@@ -631,7 +645,7 @@ Phaser.Math = {
* Keeps an angle value between -180 and +180
* Should be called whenever the angle is updated on the Sprite to stop it from going insane.
*
- * @method wrapAngle
+ * @method Phaser.Math#wrapAngle
* @param {number} angle - The angle value to check
* @return {number} The new angle value, returns the same as the input angle if it was within bounds.
*/
@@ -660,7 +674,7 @@ Phaser.Math = {
/**
* Keeps an angle value between the given min and max values.
*
- * @method angleLimit
+ * @method Phaser.Math#angleLimit
* @param {number} angle - The angle value to check. Must be between -180 and +180.
* @param {number} min - The minimum angle that is allowed (must be -180 or greater).
* @param {number} max - The maximum angle that is allowed (must be 180 or less).
@@ -679,7 +693,7 @@ Phaser.Math = {
/**
* Description.
- * @method linearInterpolation
+ * @method Phaser.Math#linearInterpolation
* @param {number} v
* @param {number} k
* @return {number}
@@ -699,7 +713,7 @@ Phaser.Math = {
/**
* Description.
- * @method bezierInterpolation
+ * @method Phaser.Math#bezierInterpolation
* @param {number} v
* @param {number} k
* @return {number}
@@ -715,7 +729,7 @@ Phaser.Math = {
/**
* Description.
- * @method catmullRomInterpolation
+ * @method Phaser.Math#catmullRomInterpolation
* @param {number} v
* @param {number} k
* @return {number}
@@ -744,7 +758,7 @@ Phaser.Math = {
/**
* Description.
- * @method Linear
+ * @method Phaser.Math#Linear
* @param {number} p0
* @param {number} p1
* @param {number} t
@@ -755,7 +769,7 @@ Phaser.Math = {
},
/**
- * @method bernstein
+ * @method Phaser.Math#bernstein
* @param {number} n
* @param {number} i
* @return {number}
@@ -766,7 +780,7 @@ Phaser.Math = {
/**
* Description.
- * @method catmullRom
+ * @method Phaser.Math#catmullRom
* @param {number} p0
* @param {number} p1
* @param {number} p2
@@ -779,6 +793,12 @@ Phaser.Math = {
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
},
+ /**
+ * @method Phaser.Math#difference
+ * @param {number} a
+ * @param {number} b
+ * @return {number}
+ */
difference: function (a, b) {
return Math.abs(a - b);
},
@@ -787,11 +807,11 @@ Phaser.Math = {
* Fetch a random entry from the given array.
* Will return null if random selection is missing, or array has no entries.
*
- * @method getRandom
- * @param objects An array of objects.
- * @param startIndex Optional offset off the front of the array. Default value is 0, or the beginning of the array.
- * @param length Optional restriction on the number of values you want to randomly select from.
- * @return The random object that was selected.
+ * @method Phaser.Math#getRandom
+ * @param {array} objects - An array of objects.
+ * @param {number} startIndex - Optional offset off the front of the array. Default value is 0, or the beginning of the array.
+ * @param {number} length - Optional restriction on the number of values you want to randomly select from.
+ * @return {object} The random object that was selected.
*/
getRandom: function (objects, startIndex, length) {
@@ -820,7 +840,7 @@ Phaser.Math = {
/**
* Round down to the next whole number. E.g. floor(1.7) == 1, and floor(-2.7) == -2.
*
- * @method floor
+ * @method Phaser.Math#floor
* @param {number} Value Any number.
* @return {number} The rounded value of that number.
*/
@@ -835,9 +855,9 @@ Phaser.Math = {
/**
* Round up to the next whole number. E.g. ceil(1.3) == 2, and ceil(-2.3) == -3.
*
- * @param Value Any number.
- *
- * @return The rounded value of that number.
+ * @method Phaser.Math#ceil
+ * @param {number} value - Any number.
+ * @return {number} The rounded value of that number.
*/
ceil: function (value) {
var n = value | 0;
@@ -850,13 +870,12 @@ Phaser.Math = {
* The parameters allow you to specify the length, amplitude and frequency of the wave. Once you have called this function
* you should get the results via getSinTable() and getCosTable(). This generator is fast enough to be used in real-time.
*
- * @param length The length of the wave
- * @param sinAmplitude The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
- * @param cosAmplitude The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
- * @param frequency The frequency of the sine and cosine table data
- * @return Returns the sine table
- * @see getSinTable
- * @see getCosTable
+ * @method Phaser.Math#sinCosGenerator
+ * @param {number} length - The length of the wave
+ * @param {number} sinAmplitude - The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
+ * @param {number} cosAmplitude - The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value
+ * @param {number} frequency - The frequency of the sine and cosine table data
+ * @return {Array} Returns the sine table
*/
sinCosGenerator: function (length, sinAmplitude, cosAmplitude, frequency) {
@@ -887,9 +906,11 @@ Phaser.Math = {
/**
* Removes the top element from the stack and re-inserts it onto the bottom, then returns it.
- * The original stack is modified in the process.
- * This effectively moves the position of the data from the start to the end of the table.
- * @return The value.
+ * The original stack is modified in the process. This effectively moves the position of the data from the start to the end of the table.
+ *
+ * @method Phaser.Math#shift
+ * @param {array} stack - The array to shift.
+ * @return {any} The shifted value.
*/
shift: function (stack) {
@@ -902,8 +923,9 @@ Phaser.Math = {
/**
* Shuffles the data in the given array into a new order
- * @param array The array to shuffle
- * @return The array
+ * @method Phaser.Math#shuffleArray
+ * @param {array} array - The array to shuffle
+ * @return {array} The array
*/
shuffleArray: function (array) {
@@ -922,7 +944,7 @@ Phaser.Math = {
/**
* Returns the distance between the two given set of coordinates.
*
- * @method distance
+ * @method Phaser.Math#distance
* @param {number} x1
* @param {number} y1
* @param {number} x2
@@ -938,6 +960,16 @@ Phaser.Math = {
},
+ /**
+ * Returns the rounded distance between the two given set of coordinates.
+ *
+ * @method Phaser.Math#distanceRounded
+ * @param {number} x1
+ * @param {number} y1
+ * @param {number} x2
+ * @param {number} y2
+ * @return {number} The distance between this Point object and the destination Point object.
+ **/
distanceRounded: function (x1, y1, x2, y2) {
return Math.round(Phaser.Math.distance(x1, y1, x2, y2));
@@ -948,10 +980,11 @@ Phaser.Math = {
* Force a value within the boundaries of two values.
* Clamp value to range
*
- * @method clamp
+ * @method Phaser.Math#clamp
* @param {number} x
* @param {number} a
* @param {number} b
+ * @return {number}
*/
clamp: function ( x, a, b ) {
@@ -962,9 +995,10 @@ Phaser.Math = {
/**
* Clamp value to range to range
*
- * @method mapLinear
+ * @method Phaser.Math#mapLinear
* @param {number} x
* @param {number} a1
* @param {number} a1
@@ -990,11 +1024,10 @@ Phaser.Math = {
},
- //
/**
- * {@link http://en.wikipedia.org/wiki/Smoothstep}
+ * Smoothstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
*
- * @method smoothstep
+ * @method Phaser.Math#smoothstep
* @param {number} x
* @param {number} min
* @param {number} max
@@ -1012,9 +1045,9 @@ Phaser.Math = {
},
/**
- * {@link http://en.wikipedia.org/wiki/Smoothstep}
+ * Smootherstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
*
- * @method smootherstep
+ * @method Phaser.Math#smootherstep
* @param {number} x
* @param {number} min
* @param {number} max
@@ -1035,7 +1068,7 @@ Phaser.Math = {
* A value representing the sign of the value.
* -1 for negative, +1 for positive, 0 if value is 0
*
- * @method sign
+ * @method Phaser.Math#sign
* @param {number} x
* @return {number}
*/
@@ -1048,7 +1081,7 @@ Phaser.Math = {
/**
* Convert degrees to radians.
*
- * @method degToRad
+ * @method Phaser.Math#degToRad
* @return {function}
*/
degToRad: function() {
@@ -1066,7 +1099,7 @@ Phaser.Math = {
/**
* Convert degrees to radians.
*
- * @method radToDeg
+ * @method Phaser.Math#radToDeg
* @return {function}
*/
radToDeg: function() {
diff --git a/src/math/QuadTree.js b/src/math/QuadTree.js
index ded11e42..9921a320 100644
--- a/src/math/QuadTree.js
+++ b/src/math/QuadTree.js
@@ -2,7 +2,6 @@
* @author Richard Davey
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Quadtree
*/
/**
@@ -47,11 +46,8 @@
* QuadTree Constructor
*
* @class Phaser.QuadTree
- * @classdesc Javascript QuadTree