More docs coming on.

This commit is contained in:
Richard Davey
2013-10-01 16:39:39 +01:00
parent a38ad2d1a9
commit ca113b85aa
80 changed files with 10121 additions and 4763 deletions
+8 -2
View File
@@ -58,13 +58,13 @@ Phaser.Camera = function (game, id, x, y, width, height) {
this.deadzone = null;
/**
* @property {bool} visible - Whether this camera is visible or not.
* @property {boolean} visible - Whether this camera is visible or not.
* @default
*/
this.visible = true;
/**
* @property {bool} atLimit - Whether this camera is flush with the World Bounds or not.
* @property {boolean} atLimit - Whether this camera is flush with the World Bounds or not.
*/
this.atLimit = { x: false, y: false };
@@ -93,6 +93,7 @@ Phaser.Camera.prototype = {
/**
* Tells this camera which sprite to follow.
* @method follow
* @memberOf Phaser.Camera
* @param {Phaser.Sprite} target - The object you want the camera to track. Set to null to not follow anything.
* @param {number} [style] Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
*/
@@ -133,6 +134,7 @@ Phaser.Camera.prototype = {
/**
* Move the camera focus to a location instantly.
* @method focusOnXY
* @memberOf Phaser.Camera
* @param {number} x - X position.
* @param {number} y - Y position.
*/
@@ -146,6 +148,7 @@ Phaser.Camera.prototype = {
/**
* Update focusing and scrolling.
* @method update
* @memberOf Phaser.Camera
*/
update: function () {
@@ -196,6 +199,7 @@ Phaser.Camera.prototype = {
/**
* Method called to ensure the camera doesn't venture outside of the game world.
* @method checkWorldBounds
* @memberOf Phaser.Camera
*/
checkWorldBounds: function () {
@@ -236,6 +240,7 @@ Phaser.Camera.prototype = {
* without having to use game.camera.x and game.camera.y.
*
* @method setPosition
* @memberOf Phaser.Camera
* @param {number} x - X position.
* @param {number} y - Y position.
*/
@@ -251,6 +256,7 @@ Phaser.Camera.prototype = {
* Sets the size of the view rectangle given the width and height in parameters.
*
* @method setSize
* @memberOf Phaser.Camera
* @param {number} width - The desired width.
* @param {number} height - The desired height.
*/
+13 -8
View File
@@ -20,8 +20,8 @@
* @param {number} renderer -Which renderer to use (canvas or webgl)
* @param {HTMLElement} parent -The Games DOM parent.
* @param {Description} state - Description.
* @param {bool} transparent - Use a transparent canvas background or not.
* @param {bool} antialias - Anti-alias graphics.
* @param {boolean} transparent - Use a transparent canvas background or not.
* @param {boolean} antialias - Anti-alias graphics.
*/
Phaser.Game = function (width, height, renderer, parent, state, transparent, antialias) {
@@ -56,12 +56,12 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
this.height = height;
/**
* @property {bool} transparent - Use a transparent canvas background or not.
* @property {boolean} transparent - Use a transparent canvas background or not.
*/
this.transparent = transparent;
/**
* @property {bool} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
* @property {boolean} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
*/
this.antialias = antialias;
@@ -77,7 +77,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
this.state = new Phaser.StateManager(this, state);
/**
* @property {bool} _paused - Is game paused?
* @property {boolean} _paused - Is game paused?
* @private
* @default
*/
@@ -89,20 +89,20 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
this.renderType = renderer;
/**
* @property {bool} _loadComplete - Whether load complete loading or not.
* @property {boolean} _loadComplete - Whether load complete loading or not.
* @private
* @default
*/
this._loadComplete = false;
/**
* @property {bool} isBooted - Whether the game engine is booted, aka available.
* @property {boolean} isBooted - Whether the game engine is booted, aka available.
* @default
*/
this.isBooted = false;
/**
* @property {bool} id -Is game running or paused?
* @property {boolean} id -Is game running or paused?
* @default
*/
this.isRunning = false;
@@ -253,6 +253,7 @@ Phaser.Game.prototype = {
* Initialize engine sub modules and start the game.
*
* @method boot
* @memberOf Phaser.Game
*/
boot: function () {
@@ -333,6 +334,7 @@ Phaser.Game.prototype = {
* Checks if the device is capable of using the requested renderer and sets it up or an alternative if not.
*
* @method setUpRenderer
* @memberOf Phaser.Game
*/
setUpRenderer: function () {
@@ -369,6 +371,7 @@ Phaser.Game.prototype = {
* Called when the load has finished, after preload was run.
*
* @method loadComplete
* @memberOf Phaser.Game
*/
loadComplete: function () {
@@ -382,6 +385,7 @@ Phaser.Game.prototype = {
* The core game loop.
*
* @method update
* @memberOf Phaser.Game
* @param {number} time - The current time as provided by RequestAnimationFrame.
*/
update: function (time) {
@@ -416,6 +420,7 @@ Phaser.Game.prototype = {
* Nuke the entire game from orbit
*
* @method destroy
* @memberOf Phaser.Game
*/
destroy: function () {
+36 -6
View File
@@ -8,13 +8,12 @@
/**
* Phaser Group constructor.
* @class Phaser.Group
* @classdesc An Animation instance contains a single animation and the controls to play it.
* It is created by the AnimationManager, consists of Animation.Frame objects and belongs to a single Game Object such as a Sprite.
* @classdesc A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Description} parent - Description.
* @param {string} name - The unique name for this animation, used in playback commands.
* @param {bool} useStage - Description.
* @param {boolean} useStage - Description.
*/
Phaser.Group = function (game, parent, name, useStage) {
@@ -67,7 +66,7 @@ Phaser.Group = function (game, parent, name, useStage) {
this.type = Phaser.GROUP;
/**
* @property {bool} exists - Description.
* @property {boolean} exists - Description.
* @default
*/
this.exists = true;
@@ -87,6 +86,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method add
* @memberOf Phaser.Group
* @param {Description} child - Description.
* @return {Description} Description.
*/
@@ -112,6 +112,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method addAt
* @memberOf Phaser.Group
* @param {Description} child - Description.
* @param {Description} index - Description.
* @return {Description} Description.
@@ -138,6 +139,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method getAt
* @memberOf Phaser.Group
* @param {Description} index - Description.
* @return {Description} Description.
*/
@@ -151,6 +153,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method create
* @memberOf Phaser.Group
* @param {number} x - Description.
* @param {number} y - Description.
* @param {string} key - Description.
@@ -182,9 +185,10 @@ Phaser.Group.prototype = {
* Description.
*
* @method swap
* @memberOf Phaser.Group
* @param {Description} child1 - Description.
* @param {Description} child2 - Description.
* @return {bool} Description.
* @return {boolean} Description.
*/
swap: function (child1, child2) {
@@ -310,6 +314,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method bringToTop
* @memberOf Phaser.Group
* @param {Description} child - Description.
* @return {Description} Description.
*/
@@ -329,6 +334,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method getIndex
* @memberOf Phaser.Group
* @param {Description} child - Description.
* @return {Description} Description.
*/
@@ -342,6 +348,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method replace
* @memberOf Phaser.Group
* @param {Description} oldChild - Description.
* @param {Description} newChild - Description.
*/
@@ -373,6 +380,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method setProperty
* @memberOf Phaser.Group
* @param {Description} child - Description.
* @param {array} key - An array of values that will be set.
* @param {Description} value - Description.
@@ -436,6 +444,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method setAll
* @memberOf Phaser.Group
* @param {Description} key - Description.
* @param {Description} value - Description.
* @param {Description} checkAlive - Description.
@@ -474,6 +483,7 @@ Phaser.Group.prototype = {
* Group.addAll('x', 10) will add 10 to the child.x value.
*
* @method addAll
* @memberOf Phaser.Group
* @param {string} property - The property to increment, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -490,6 +500,7 @@ Phaser.Group.prototype = {
* Group.subAll('x', 10) will minus 10 from the child.x value.
*
* @method subAll
* @memberOf Phaser.Group
* @param {string} property - The property to decrement, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -506,6 +517,7 @@ Phaser.Group.prototype = {
* Group.multiplyAll('x', 2) will x2 the child.x value.
*
* @method multiplyAll
* @memberOf Phaser.Group
* @param {string} property - The property to multiply, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -522,6 +534,7 @@ Phaser.Group.prototype = {
* Group.divideAll('x', 2) will half the child.x value.
*
* @method divideAll
* @memberOf Phaser.Group
* @param {string} property - The property to divide, for example 'body.velocity.x' or 'angle'.
* @param {number} amount - The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50.
* @param {boolean} checkAlive - If true the property will only be changed if the child is alive.
@@ -538,6 +551,7 @@ Phaser.Group.prototype = {
* After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback.
*
* @method callAllExists
* @memberOf Phaser.Group
* @param {function} callback - The function that exists on the children that will be called.
* @param {boolean} existsValue - Only children with exists=existsValue will be called.
* @param {...*} parameter - Additional parameters that will be passed to the callback.
@@ -570,6 +584,7 @@ Phaser.Group.prototype = {
* After the callback parameter you can add as many extra parameters as you like, which will all be passed to the child.
*
* @method callAll
* @memberOf Phaser.Group
* @param {function} callback - The function that exists on the children that will be called.
* @param {...*} parameter - Additional parameters that will be passed to the callback.
*/
@@ -601,9 +616,10 @@ Phaser.Group.prototype = {
* After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
*
* @method forEach
* @memberOf Phaser.Group
* @param {Description} callback - Description.
* @param {Description} callbackContext - Description.
* @param {bool} checkExists - Description.
* @param {boolean} checkExists - Description.
*/
forEach: function (callback, callbackContext, checkExists) {
@@ -639,6 +655,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method forEachAlive
* @memberOf Phaser.Group
* @param {Description} callback - Description.
* @param {Description} callbackContext - Description.
*/
@@ -671,6 +688,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method forEachDead
* @memberOf Phaser.Group
* @param {Description} callback - Description.
* @param {Description} callbackContext - Description.
*/
@@ -702,6 +720,7 @@ Phaser.Group.prototype = {
* Call this function to retrieve the first object with exists == (the given state) in the group.
*
* @method getFirstExists
* @memberOf Phaser.Group
* @param {Description} state - Description.
* @return {Any} The first child, or null if none found.
*/
@@ -737,6 +756,7 @@ Phaser.Group.prototype = {
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @method getFirstAlive
* @memberOf Phaser.Group
* @return {Any} The first alive child, or null if none found.
*/
getFirstAlive: function () {
@@ -766,6 +786,7 @@ Phaser.Group.prototype = {
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
*
* @method getFirstDead
* @memberOf Phaser.Group
* @return {Any} The first dead child, or null if none found.
*/
getFirstDead: function () {
@@ -794,6 +815,7 @@ Phaser.Group.prototype = {
* Call this function to find out how many members of the group are alive.
*
* @method countLiving
* @memberOf Phaser.Group
* @return {number} The number of children flagged as alive. Returns -1 if Group is empty.
*/
countLiving: function () {
@@ -824,6 +846,7 @@ Phaser.Group.prototype = {
* Call this function to find out how many members of the group are dead.
*
* @method countDead
* @memberOf Phaser.Group
* @return {number} The number of children flagged as dead. Returns -1 if Group is empty.
*/
countDead: function () {
@@ -853,6 +876,8 @@ Phaser.Group.prototype = {
/**
* Returns a member at random from the group.
*
* @method getRandom
* @memberOf Phaser.Group
* @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 {Any} A random child of this Group.
@@ -875,6 +900,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method remove
* @memberOf Phaser.Group
* @param {Description} child - Description.
*/
remove: function (child) {
@@ -889,6 +915,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method removeAll
* @memberOf Phaser.Group
*/
removeAll: function () {
@@ -913,6 +940,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method removeBetween
* @memberOf Phaser.Group
* @param {Description} startIndex - Description.
* @param {Description} endIndex - Description.
*/
@@ -941,6 +969,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method destroy
* @memberOf Phaser.Group
*/
destroy: function () {
@@ -960,6 +989,7 @@ Phaser.Group.prototype = {
* Description.
*
* @method dump
* @memberOf Phaser.Group
*/
dump: function (full) {
+6 -6
View File
@@ -29,37 +29,37 @@ Phaser.Plugin = function (game, parent) {
this.parent = parent;
/**
* @property {bool} active - Description.
* @property {boolean} active - Description.
* @default
*/
this.active = false;
/**
* @property {bool} visible - Description.
* @property {boolean} visible - Description.
* @default
*/
this.visible = false;
/**
* @property {bool} hasPreUpdate - Description.
* @property {boolean} hasPreUpdate - Description.
* @default
*/
this.hasPreUpdate = false;
/**
* @property {bool} hasUpdate - Description.
* @property {boolean} hasUpdate - Description.
* @default
*/
this.hasUpdate = false;
/**
* @property {bool} hasRender - Description.
* @property {boolean} hasRender - Description.
* @default
*/
this.hasRender = false;
/**
* @property {bool} hasPostRender - Description.
* @property {boolean} hasPostRender - Description.
* @default
*/
this.hasPostRender = false;
+5 -5
View File
@@ -47,13 +47,13 @@ Phaser.Signal.prototype = {
* If Signal should keep record of previously dispatched parameters and
* automatically execute listener during `add()`/`addOnce()` if Signal was
* already dispatched before.
* @property {bool} memorize
* @property {boolean} memorize
*/
memorize: false,
/**
* Description.
* @property {bool} _shouldPropagate
* @property {boolean} _shouldPropagate
* @private
*/
_shouldPropagate: true,
@@ -61,7 +61,7 @@ Phaser.Signal.prototype = {
/**
* If Signal is active and should broadcast events.
* <p><strong>IMPORTANT:</strong> Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
* @property {bool} active
* @property {boolean} active
* @default
*/
active: true,
@@ -84,7 +84,7 @@ Phaser.Signal.prototype = {
*
* @method _registerListener
* @param {function} listener - Signal handler function.
* @param {bool} isOnce - Description.
* @param {boolean} isOnce - Description.
* @param {object} [listenerContext] - Description.
* @param {number} [priority] - The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0).
* @return {Phaser.SignalBinding} An Object representing the binding between the Signal and listener.
@@ -152,7 +152,7 @@ Phaser.Signal.prototype = {
* @method has
* @param {Function} listener - Signal handler function.
* @param {Object} [context] - Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @return {bool} If Signal has the specified listener.
* @return {boolean} If Signal has the specified listener.
*/
has: function (listener, context) {
return this._indexOfListener(listener, context) !== -1;
+5 -5
View File
@@ -20,7 +20,7 @@
* @inner
* @param {Signal} signal - Reference to Signal object that listener is currently bound to.
* @param {function} listener - Handler function bound to the signal.
* @param {bool} isOnce - If binding should be executed just once.
* @param {boolean} isOnce - If binding should be executed just once.
* @param {object} [listenerContext] - Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @param {number} [priority] - The priority level of the event listener. (default = 0).
*/
@@ -33,7 +33,7 @@ Phaser.SignalBinding = function (signal, listener, isOnce, listenerContext, prio
this._listener = listener;
/**
* @property {bool} _isOnce - If binding should be executed just once.
* @property {boolean} _isOnce - If binding should be executed just once.
* @private
*/
this._isOnce = isOnce;
@@ -62,7 +62,7 @@ Phaser.SignalBinding.prototype = {
/**
* If binding is active and should be executed.
* @property {bool} active
* @property {boolean} active
* @default
*/
active: true,
@@ -112,7 +112,7 @@ Phaser.SignalBinding.prototype = {
/**
* @method isBound
* @return {bool} True if binding is still bound to the signal and has a listener.
* @return {boolean} True if binding is still bound to the signal and has a listener.
*/
isBound: function () {
return (!!this._signal && !!this._listener);
@@ -120,7 +120,7 @@ Phaser.SignalBinding.prototype = {
/**
* @method isOnce
* @return {bool} If SignalBinding will only be executed once.
* @return {boolean} If SignalBinding will only be executed once.
*/
isOnce: function () {
return this._isOnce;
+5 -5
View File
@@ -51,7 +51,7 @@ Phaser.StateManager.prototype = {
/**
* Flag that sets if the State has been created or not.
* @property {bool}_created
* @property {boolean}_created
* @private
*/
_created: false,
@@ -160,7 +160,7 @@ Phaser.StateManager.prototype = {
* @method add
* @param key {string} - A unique key you use to reference this state, i.e. "MainMenu", "Level1".
* @param state {State} - The state you want to switch to.
* @param autoStart {bool} - Start the state immediately after creating it? (default true)
* @param autoStart {boolean} - Start the state immediately after creating it? (default true)
*/
add: function (key, state, autoStart) {
@@ -241,8 +241,8 @@ Phaser.StateManager.prototype = {
* Start the given state
* @method start
* @param {string} key - The key of the state you want to start.
* @param {bool} [clearWorld] - clear everything in the world? (Default to true)
* @param {bool} [clearCache] - clear asset cache? (Default to false and ONLY available when clearWorld=true)
* @param {boolean} [clearWorld] - clear everything in the world? (Default to true)
* @param {boolean} [clearCache] - clear asset cache? (Default to false and ONLY available when clearWorld=true)
*/
start: function (key, clearWorld, clearCache) {
@@ -327,7 +327,7 @@ Phaser.StateManager.prototype = {
* Description.
* @method checkState
* @param {string} key - The key of the state you want to check.
* @return {bool} Description.
* @return {boolean} Description.
*/
checkState: function (key) {
+2 -2
View File
@@ -170,7 +170,7 @@ Object.defineProperty(Phaser.World.prototype, "width", {
/**
* @method width
* @return {Number} The current width of the game world
* @return {number} The current width of the game world
*/
get: function () {
return this.bounds.width;
@@ -178,7 +178,7 @@ Object.defineProperty(Phaser.World.prototype, "width", {
/**
* @method width
* @return {Number} Sets the width of the game world
* @return {number} Sets the width of the game world
*/
set: function (value) {
this.bounds.width = value;