Adding docs.

This commit is contained in:
Richard Davey
2013-10-01 13:54:29 +01:00
parent fa15f8015d
commit 305b12d76b
64 changed files with 6268 additions and 2682 deletions
+97 -9
View File
@@ -1,13 +1,14 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Button
*/
/**
* Create a new <code>Button</code> object.
* @class Button
* @class Phaser.Button
* @constructor
*
* @param {Phaser.Game} game Current game instance.
@@ -22,7 +23,6 @@
*/
Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame) {
x = x || 0;
y = y || 0;
key = key || null;
@@ -31,21 +31,86 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
Phaser.Sprite.call(this, game, x, y, key, outFrame);
/**
* @property {Description} type - Description.
*/
this.type = Phaser.BUTTON;
/**
* @property {Description} _onOverFrameName - Description.
* @private
* @default
*/
this._onOverFrameName = null;
/**
* @property {Description} _onOutFrameName - Description.
* @private
* @default
*/
this._onOutFrameName = null;
/**
* @property {Description} _onDownFrameName - Description.
* @private
* @default
*/
this._onDownFrameName = null;
/**
* @property {Description} _onUpFrameName - Description.
* @private
* @default
*/
this._onUpFrameName = null;
/**
* @property {Description} _onOverFrameID - Description.
* @private
* @default
*/
this._onOverFrameID = null;
/**
* @property {Description} _onOutFrameID - Description.
* @private
* @default
*/
this._onOutFrameID = null;
/**
* @property {Description} _onDownFrameID - Description.
* @private
* @default
*/
this._onDownFrameID = null;
/**
* @property {Description} _onUpFrameID - Description.
* @private
* @default
*/
this._onUpFrameID = null;
// These are the signals the game will subscribe to
/**
* @property {Phaser.Signal} onInputOver - Description.
*/
this.onInputOver = new Phaser.Signal;
/**
* @property {Phaser.Signal} onInputOut - Description.
*/
this.onInputOut = new Phaser.Signal;
/**
* @property {Phaser.Signal} onInputDown - Description.
*/
this.onInputDown = new Phaser.Signal;
/**
* @property {Phaser.Signal} onInputUp - Description.
*/
this.onInputUp = new Phaser.Signal;
this.setFrames(overFrame, outFrame, downFrame);
@@ -70,12 +135,12 @@ Phaser.Button.prototype.constructor = Phaser.Button;
/**
* Used to manually set the frames that will be used for the different states of the button
* exactly like setting them in the constructor
* exactly like setting them in the constructor.
*
* @method setFrames
* @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
* @method Phaser.Button.prototype.setFrames
* @param {string|number} [overFrame] - This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [outFrame] - This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [downFrame] - This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
*/
Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
@@ -149,6 +214,12 @@ Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
};
/**
* Description.
*
* @method Phaser.Button.prototype.onInputOverHandler
* @param {Description} pointer - Description.
*/
Phaser.Button.prototype.onInputOverHandler = function (pointer) {
if (this._onOverFrameName != null)
@@ -166,6 +237,12 @@ Phaser.Button.prototype.onInputOverHandler = function (pointer) {
}
};
/**
* Description.
*
* @method Phaser.Button.prototype.onInputOutHandler
* @param {Description} pointer - Description.
*/
Phaser.Button.prototype.onInputOutHandler = function (pointer) {
if (this._onOutFrameName != null)
@@ -181,9 +258,14 @@ Phaser.Button.prototype.onInputOutHandler = function (pointer) {
{
this.onInputOut.dispatch(this, pointer);
}
};
/**
* Description.
*
* @method Phaser.Button.prototype.onInputDownHandler
* @param {Description} pointer - Description.
*/
Phaser.Button.prototype.onInputDownHandler = function (pointer) {
if (this._onDownFrameName != null)
@@ -201,6 +283,12 @@ Phaser.Button.prototype.onInputDownHandler = function (pointer) {
}
};
/**
* Description.
*
* @method Phaser.Button.prototype.onInputUpHandler
* @param {Description} pointer - Description.
*/
Phaser.Button.prototype.onInputUpHandler = function (pointer) {
if (this._onUpFrameName != null)