From 868ae81babce585c2217340d903b893ed32ffb13 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 2 Oct 2013 15:05:55 +0100 Subject: [PATCH] Input, Loader and Math docs tidied up. --- Docs/conf.json | 2 +- Docs/out/Animation.js.html | 60 +- Docs/out/AnimationManager.js.html | 60 +- Docs/out/Cache.js.html | 998 ++ Docs/out/Camera.js.html | 60 +- Docs/out/Circle.js.html | 60 +- Docs/out/Frame.js.html | 60 +- Docs/out/FrameData.js.html | 60 +- Docs/out/Game.js.html | 60 +- Docs/out/Group.js.html | 60 +- Docs/out/Input.js.html | 218 +- Docs/out/InputHandler.js.html | 1315 +++ Docs/out/Key.js.html | 434 + Docs/out/Keyboard.js.html | 726 ++ Docs/out/LinkedList.js.html | 60 +- Docs/out/Loader.js.html | 1326 +++ Docs/out/MSPointer.js.html | 445 + Docs/out/Math.js.html | 1380 +++ Docs/out/Mouse.js.html | 521 + Docs/out/Parser.js.html | 60 +- Docs/out/Parser.js_.html | 345 + Docs/out/Phaser.Animation.Frame.html | 60 +- Docs/out/Phaser.Animation.FrameData.html | 60 +- Docs/out/Phaser.Animation.Parser.html | 60 +- Docs/out/Phaser.Animation.html | 60 +- Docs/out/Phaser.AnimationManager.html | 60 +- Docs/out/Phaser.Cache.html | 6091 ++++++++++ Docs/out/Phaser.Camera.html | 60 +- Docs/out/Phaser.Circle.html | 60 +- Docs/out/Phaser.Game.html | 66 +- Docs/out/Phaser.Group.html | 60 +- Docs/out/Phaser.Input.html | 495 +- Docs/out/Phaser.InputHandler.html | 7312 ++++++++++++ Docs/out/Phaser.Key.html | 2359 ++++ Docs/out/Phaser.Keyboard.html | 2694 +++++ Docs/out/Phaser.LinkedList.html | 60 +- Docs/out/Phaser.Loader.Parser.html | 512 + Docs/out/Phaser.Loader.html | 5331 +++++++++ Docs/out/Phaser.MSPointer.html | 1543 +++ Docs/out/Phaser.Math.html | 9822 +++++++++++++++++ Docs/out/Phaser.Mouse.html | 2089 ++++ Docs/out/Phaser.Plugin.html | 60 +- Docs/out/Phaser.PluginManager.html | 1260 +++ Docs/out/Phaser.Point.html | 60 +- Docs/out/Phaser.Pointer.html | 4663 ++++++++ Docs/out/Phaser.QuadTree.html | 1129 ++ Docs/out/Phaser.RandomDataGenerator.html | 1822 +++ Docs/out/Phaser.Rectangle.html | 60 +- Docs/out/Phaser.Signal.html | 60 +- Docs/out/Phaser.Stage.html | 60 +- Docs/out/Phaser.State.html | 64 +- Docs/out/Phaser.StateManager.html | 60 +- Docs/out/Phaser.Touch.html | 2369 ++++ Docs/out/Phaser.World.html | 60 +- Docs/out/Phaser.js.html | 60 +- Docs/out/Plugin.js.html | 60 +- .../PluginManager-Phaser.PluginManager.html | 10 +- Docs/out/PluginManager.html | 10 +- Docs/out/PluginManager.js.html | 63 +- Docs/out/Point.js.html | 60 +- Docs/out/Pointer.js.html | 954 ++ Docs/out/QuadTree.js.html | 528 + Docs/out/RandomDataGenerator.js.html | 510 + Docs/out/Rectangle.js.html | 60 +- Docs/out/Signal.js.html | 60 +- Docs/out/SignalBinding.html | 60 +- Docs/out/SignalBinding.js.html | 60 +- Docs/out/Stage.js.html | 60 +- Docs/out/State.js.html | 60 +- Docs/out/StateManager.js.html | 60 +- Docs/out/Touch.js.html | 596 + Docs/out/World.js.html | 60 +- Docs/out/classes.list.html | 101 +- Docs/out/index.html | 144 +- Docs/out/module-Phaser.html | 60 +- Docs/out/modules.list.html | 101 +- src/core/PluginManager.js | 3 +- src/input/InputHandler.js | 87 +- src/input/Keyboard.js | 6 +- src/input/MSPointer.js | 77 +- src/input/Mouse.js | 59 +- src/input/Pointer.js | 59 +- src/input/Touch.js | 142 +- src/loader/Cache.js | 266 +- src/loader/Loader.js | 146 +- src/loader/Parser.js | 7 +- src/math/Math.js | 203 +- src/math/QuadTree.js | 18 +- src/math/RandomDataGenerator.js | 36 +- 89 files changed, 62657 insertions(+), 1080 deletions(-) create mode 100644 Docs/out/Cache.js.html create mode 100644 Docs/out/InputHandler.js.html create mode 100644 Docs/out/Key.js.html create mode 100644 Docs/out/Keyboard.js.html create mode 100644 Docs/out/Loader.js.html create mode 100644 Docs/out/MSPointer.js.html create mode 100644 Docs/out/Math.js.html create mode 100644 Docs/out/Mouse.js.html create mode 100644 Docs/out/Parser.js_.html create mode 100644 Docs/out/Phaser.Cache.html create mode 100644 Docs/out/Phaser.InputHandler.html create mode 100644 Docs/out/Phaser.Key.html create mode 100644 Docs/out/Phaser.Keyboard.html create mode 100644 Docs/out/Phaser.Loader.Parser.html create mode 100644 Docs/out/Phaser.Loader.html create mode 100644 Docs/out/Phaser.MSPointer.html create mode 100644 Docs/out/Phaser.Math.html create mode 100644 Docs/out/Phaser.Mouse.html create mode 100644 Docs/out/Phaser.PluginManager.html create mode 100644 Docs/out/Phaser.Pointer.html create mode 100644 Docs/out/Phaser.QuadTree.html create mode 100644 Docs/out/Phaser.RandomDataGenerator.html create mode 100644 Docs/out/Phaser.Touch.html create mode 100644 Docs/out/Pointer.js.html create mode 100644 Docs/out/QuadTree.js.html create mode 100644 Docs/out/RandomDataGenerator.js.html create mode 100644 Docs/out/Touch.js.html diff --git a/Docs/conf.json b/Docs/conf.json index 43143f3f..7a98d537 100644 --- a/Docs/conf.json +++ b/Docs/conf.json @@ -3,7 +3,7 @@ "allowUnknownTags": true }, "source": { - "include": [ "../src/Phaser.js", "../src/animation/", "../src/core/", "../src/geom/", "../src/input/Input.js" ], + "include": [ "../src/Phaser.js", "../src/animation/", "../src/core/", "../src/geom/", "../src/input/", "../src/loader/", "../src/math/" ], "exclude": [], "includePattern": ".+\\.js(doc)?$", "excludePattern": "(^|\\/|\\\\)_" diff --git a/Docs/out/Animation.js.html b/Docs/out/Animation.js.html index a2e1dcdd..163eadc8 100644 --- a/Docs/out/Animation.js.html +++ b/Docs/out/Animation.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -595,7 +643,7 @@ Phaser.Animation.generateFrameNames = function (prefix, min, max, suffix, zeroPa 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/AnimationManager.js.html b/Docs/out/AnimationManager.js.html index b9ff5c8d..2df9e128 100644 --- a/Docs/out/AnimationManager.js.html +++ b/Docs/out/AnimationManager.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -544,7 +592,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", { 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/Cache.js.html b/Docs/out/Cache.js.html new file mode 100644 index 00000000..f9d61a88 --- /dev/null +++ b/Docs/out/Cache.js.html @@ -0,0 +1,998 @@ + + + + + + Phaser Source: loader/Cache.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: loader/Cache.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}
    +*/
    +
    +/**
    +* Phaser.Cache constructor.
    +*
    +* @class    Phaser.Cache
    +* @classdesc 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.
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +*/
    +Phaser.Cache = function (game) {
    +
    +    /**
    +	* @property {Phaser.Game} game - Local reference to game.
    +	*/
    +	this.game = game;
    +
    +	/**
    +	* @property {object} game - Canvas key-value container.
    +	* @private
    +	*/
    +    this._canvases = {};
    +
    +    /**
    +	* @property {object} _images - Image key-value container.
    +	* @private
    +	*/
    +    this._images = {};
    +
    +    /**
    +	* @property {object} _textures - RenderTexture key-value container.
    +	* @private
    +	*/
    +    this._textures = {};
    +
    +    /**
    +	* @property {object} _sounds - Sound key-value container.
    +	* @private
    +	*/
    +    this._sounds = {};
    +
    +    /**
    +	* @property {object} _text - Text key-value container.
    +	* @private
    +	*/
    +    this._text = {};
    +
    +    /**
    +	* @property {object} _tilemaps - Tilemap key-value container.
    +	* @private
    +	*/
    +    this._tilemaps = {};
    +
    +
    +    this.addDefaultImage();
    +
    +    /**
    +	* @property {Phaser.Signal} onSoundUnlock - Description.
    +	*/
    +    this.onSoundUnlock = new Phaser.Signal;
    +
    +};
    +
    +Phaser.Cache.prototype = {
    +
    +    /**
    +    * 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 };
    +
    +    },
    +
    +    /**
    +    * 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, '', '');
    +
    +        this._textures[key] = { texture: texture, frame: frame };
    +
    +    },
    +
    +    /**
    +    * 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 };
    +
    +        PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
    +        PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
    +
    +        this._images[key].frameData = Phaser.Animation.Parser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax);
    +
    +    },
    +
    +    /**
    +    * 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 };
    +
    +        PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
    +        PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
    +
    +    },
    +
    +    /**
    +    * 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 };
    +
    +        PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
    +        PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
    +
    +        if (format == Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY)
    +        {
    +            this._images[key].frameData = Phaser.Animation.Parser.JSONData(this.game, atlasData, key);
    +        }
    +        else if (format == Phaser.Loader.TEXTURE_ATLAS_JSON_HASH)
    +        {
    +            this._images[key].frameData = Phaser.Animation.Parser.JSONDataHash(this.game, atlasData, key);
    +        }
    +        else if (format == Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)
    +        {
    +            this._images[key].frameData = Phaser.Animation.Parser.XMLData(this.game, atlasData, key);
    +        }
    +
    +    },
    +
    +    /**
    +    * 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 };
    +
    +        PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
    +        PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
    +
    +        Phaser.Loader.Parser.bitmapFont(this.game, xmlData, key);
    +        // this._images[key].frameData = Phaser.Animation.Parser.XMLData(this.game, xmlData, key);
    +
    +    },
    +
    +    /**
    +    * 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 };
    +        this._images['__default'].frame = new Phaser.Animation.Frame(0, 0, 0, 32, 32, '', '');
    +
    +        var base = new PIXI.BaseTexture();
    +        base.width = 32;
    +        base.height = 32;
    +        base.hasLoaded = true; // avoids a hanging event listener
    +
    +        PIXI.BaseTextureCache['__default'] = base;
    +        PIXI.TextureCache['__default'] = new PIXI.Texture(base);
    +
    +    },
    +
    +    /**
    +    * 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 };
    +        this._images[key].frame = new Phaser.Animation.Frame(0, 0, 0, data.width, data.height, '', '');
    +
    +        PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
    +        PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
    +
    +    },
    +
    +    /**
    +    * 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;
    +        audioTag = audioTag || false;
    +
    +        var locked = this.game.sound.touchLocked;
    +        var decoded = false;
    +
    +        if (audioTag)
    +        {
    +            decoded = true;
    +        }
    +
    +        this._sounds[key] = { url: url, data: data, isDecoding: false, decoded: decoded, webAudio: webAudio, audioTag: audioTag };
    +
    +    },
    +
    +    /**
    +    * Reload a sound.
    +    * @method Phaser.Cache#reloadSound
    +    * @param {string} key - Asset key for the sound.
    +    */
    +    reloadSound: function (key) {
    +
    +        var _this = this;
    +
    +        if (this._sounds[key])
    +        {
    +            this._sounds[key].data.src = this._sounds[key].url;
    +
    +            this._sounds[key].data.addEventListener('canplaythrough', function () {
    +                return _this.reloadSoundComplete(key);
    +            }, false);
    +
    +            this._sounds[key].data.load();
    +        }
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.Cache#reloadSoundComplete
    +    * @param {string} key - Asset key for the sound.
    +    */
    +    reloadSoundComplete: function (key) {
    +
    +        if (this._sounds[key])
    +        {
    +            this._sounds[key].locked = false;
    +            this.onSoundUnlock.dispatch(key);
    +        }
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.Cache#updateSound
    +    * @param {string} key - Asset key for the sound.
    +    */
    +    updateSound: function (key, property, value) {
    +        
    +        if (this._sounds[key])
    +        {
    +            this._sounds[key][property] = value;
    +        }
    +
    +    },
    +
    +	/**
    +	* Add a new decoded sound.
    +    *
    +    * @method Phaser.Cache#decodedSound
    +	* @param {string} key - Asset key for the sound.
    +	* @param {object} data - Extra sound data.
    +	*/
    +    decodedSound: function (key, data) {
    +
    +        this._sounds[key].data = data;
    +        this._sounds[key].decoded = true;
    +        this._sounds[key].isDecoding = false;
    +
    +    },
    +
    +	/**
    +	* 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.
    +	*/    
    +    addText: function (key, url, data) {
    +
    +        this._text[key] = {
    +            url: url,
    +            data: data
    +        };
    +
    +    },
    +
    +	/**
    +	* 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.
    +	*/
    +    getCanvas: function (key) {
    +
    +        if (this._canvases[key])
    +        {
    +            return this._canvases[key].canvas;
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * 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.
    +    */    
    +    checkImageKey: function (key) {
    +
    +        if (this._images[key])
    +        {
    +            return true;
    +        }
    +
    +        return false;
    +
    +    },
    +
    +	/**
    +	* 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.
    +	*/    
    +    getImage: function (key) {
    +
    +        if (this._images[key])
    +        {
    +            return this._images[key].data;
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * Get tilemap data by key.
    +    *
    +    * @method Phaser.Cache#getTilemap
    +    * @param {string} key - Asset key of the tilemap you want.
    +    * @return {Phaser.Tilemap} The tilemap data. The tileset image is in the data property, the map data in mapData.
    +    */
    +    getTilemap: function (key) {
    +
    +        if (this._tilemaps[key])
    +        {
    +            return this._tilemaps[key];
    +        }
    +
    +        return null;
    +    },
    +
    +	/**
    +	* Get frame data by key.
    +    *
    +    * @method Phaser.Cache#getFrameData
    +	* @param {string} key - Asset key of the frame data you want.
    +	* @return {Phaser.Animation.FrameData} The frame data you want.
    +	*/
    +    getFrameData: function (key) {
    +
    +        if (this._images[key] && this._images[key].frameData)
    +        {
    +            return this._images[key].frameData;
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * 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 {Phaser.Animation.Frame} The frame data you want.
    +    */
    +    getFrameByIndex: function (key, frame) {
    +
    +        if (this._images[key] && this._images[key].frameData)
    +        {
    +            return this._images[key].frameData.getFrame(frame);
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * 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 {Phaser.Animation.Frame} The frame data you want.
    +    */
    +    getFrameByName: function (key, frame) {
    +
    +        if (this._images[key] && this._images[key].frameData)
    +        {
    +            return this._images[key].frameData.getFrameByName(frame);
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * 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 {Phaser.Animation.Frame} The frame data you want.
    +    */
    +    getFrame: function (key) {
    +
    +        if (this._images[key] && this._images[key].spriteSheet == false)
    +        {
    +            return this._images[key].frame;
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * 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 {Phaser.Animation.Frame} The frame data you want.
    +    */
    +    getTextureFrame: function (key) {
    +
    +        if (this._textures[key])
    +        {
    +            return this._textures[key].frame;
    +        }
    +
    +        return null;
    +    },
    +
    +    /**
    +    * Get a RenderTexture by key.
    +    *
    +    * @method Phaser.Cache#getTexture
    +    * @param {string} key - Asset key of the RenderTexture you want.
    +    * @return {Phaser.RenderTexture} The RenderTexture you want.
    +    */
    +    getTexture: function (key) {
    +
    +        if (this._textures[key])
    +        {
    +            return this._textures[key];
    +        }
    +
    +        return null;
    +
    +    },
    +
    +	/**
    +	* Get sound by key.
    +    *
    +    * @method Phaser.Cache#getSound
    +	* @param {string} key - Asset key of the sound you want.
    +	* @return {Phaser.Sound} The sound you want.
    +	*/
    +    getSound: function (key) {
    +
    +        if (this._sounds[key])
    +        {
    +            return this._sounds[key];
    +        }
    +
    +        return null;
    +
    +    },
    +
    +	/**
    +	* 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.
    +	*/
    +    getSoundData: function (key) {
    +
    +        if (this._sounds[key])
    +        {
    +            return this._sounds[key].data;
    +        }
    +
    +        return null;
    +
    +    },
    +
    +	/**
    +	* Check if the given sound has finished decoding.
    +    *
    +    * @method Phaser.Cache#isSoundDecoded
    +	* @param {string} key - Asset key of the sound you want.
    +	* @return {boolean} The decoded state of the Sound object.
    +	*/
    +    isSoundDecoded: function (key) {
    +
    +        if (this._sounds[key])
    +        {
    +            return this._sounds[key].decoded;
    +        }
    +
    +    },
    +
    +	/**
    +	* 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 {boolean} True if the sound is decoded and the device is not touch locked.
    +	*/
    +    isSoundReady: function (key) {
    +
    +        return (this._sounds[key] && this._sounds[key].decoded && this.game.sound.touchLocked == false);
    +
    +    },
    +
    +	/**
    +	* 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 {boolean} True if the image is a sprite sheet.
    +	*/
    +    isSpriteSheet: function (key) {
    +
    +        if (this._images[key])
    +        {
    +            return this._images[key].spriteSheet;
    +        }
    +
    +        return false;
    +
    +    },
    +
    +	/**
    +	* 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.
    +	*/
    +    getText: function (key) {
    +
    +        if (this._text[key])
    +        {
    +            return this._text[key].data;
    +        }
    +
    +        return null;
    +        
    +    },
    +
    +    /**
    +    * 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 = [];
    +
    +        for (var item in array)
    +        {
    +            if (item !== '__default')
    +            {
    +                output.push(item);
    +            }
    +        }
    +
    +        return output;
    +
    +    },
    +
    +	/**
    +	* 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 () {
    +    	return this.getKeys(this._images);
    +    },
    +
    +	/**
    +	* 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 () {
    +    	return this.getKeys(this._sounds);
    +    },
    +
    +	/**
    +	* 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 () {
    +    	return this.getKeys(this._text);
    +    },
    +
    +	/**
    +	* 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];
    +    },
    +
    +    /**
    +    * 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];
    +    },
    +
    +    /**
    +    * 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];
    +    },
    +
    +    /**
    +    * 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];
    +    },
    +
    +	/**
    +	* Clears the cache. Removes every local cache object reference.
    +    *
    +	* @method Phaser.Cache#destroy
    +	*/
    +    destroy: function () {
    +
    +        for (var item in this._canvases)
    +        {
    +            delete this._canvases[item['key']];
    +        }
    +
    +        for (var item in this._images)
    +        {
    +            delete this._images[item['key']];
    +        }
    +
    +        for (var item in this._sounds)
    +        {
    +            delete this._sounds[item['key']];
    +        }
    +
    +        for (var item in this._text)
    +        {
    +            delete this._text[item['key']];
    +        }
    +    }
    +
    +};
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:47 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Camera.js.html b/Docs/out/Camera.js.html index ef859c8d..67b5c356 100644 --- a/Docs/out/Camera.js.html +++ b/Docs/out/Camera.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -524,7 +572,7 @@ Object.defineProperty(Phaser.Camera.prototype, "height", { 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/Circle.js.html b/Docs/out/Circle.js.html index c0037758..68a37ead 100644 --- a/Docs/out/Circle.js.html +++ b/Docs/out/Circle.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -642,7 +690,7 @@ Phaser.Circle.intersectsRectangle = function (c, r) { 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/Frame.js.html b/Docs/out/Frame.js.html index 89cf7d32..27df9ff8 100644 --- a/Docs/out/Frame.js.html +++ b/Docs/out/Frame.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -332,7 +380,7 @@ Phaser.Animation.Frame.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:47 GMT+0100 (BST) using the DocStrap template. diff --git a/Docs/out/FrameData.js.html b/Docs/out/FrameData.js.html index 9c34b36f..6a975afc 100644 --- a/Docs/out/FrameData.js.html +++ b/Docs/out/FrameData.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -406,7 +454,7 @@ Object.defineProperty(Phaser.Animation.FrameData.prototype, "total", { 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/Game.js.html b/Docs/out/Game.js.html index 8e2a95c4..dd25dbce 100644 --- a/Docs/out/Game.js.html +++ b/Docs/out/Game.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -647,7 +695,7 @@ Object.defineProperty(Phaser.Game.prototype, "paused", { 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/Group.js.html b/Docs/out/Group.js.html index ce9faefc..bcddef90 100644 --- a/Docs/out/Group.js.html +++ b/Docs/out/Group.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -1328,7 +1376,7 @@ Object.defineProperty(Phaser.Group.prototype, "visible", { 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/Input.js.html b/Docs/out/Input.js.html index d38e9ed4..aed3be16 100644 --- a/Docs/out/Input.js.html +++ b/Docs/out/Input.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    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}
    +*/
    +
    +/**
    +* Constructor for Phaser InputHandler.
    +* @class Phaser.InputHandler
    +* @classdesc Description.
    +* @constructor
    +* @param {Phaser.Sprite} game - Description.
    +*/
    +Phaser.InputHandler = function (sprite) {
    +
    +	/**
    +	* @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
    +	*/
    +    this.enabled = false;
    +
    +    //	Linked list references
    +	/**
    +	* @property {Description} parent - Description. 
    +	* @default
    +	*/
    +    this.parent = null;
    +    
    +	/**
    +	* @property {Description} next - Description. 
    +	* @default
    +	*/
    +    this.next = null;
    +    
    +	/**
    +	* @property {Description} prev - Description. 
    +	* @default
    +	*/
    +    this.prev = null;
    +    
    +	/**
    +	* @property {Description} last - Description. 
    +	* @default
    +	*/
    +	this.last = this;
    +	
    +	/**
    +	* @property {Description} first - Description. 
    +	* @default
    +	*/
    +	this.first = this;
    +
    +	/**
    +	* @property {number} priorityID - The PriorityID controls which Sprite receives an Input event first if they should overlap.
    +	* @default
    +	*/
    +    this.priorityID = 0;
    +    
    +	/**
    +	* @property {boolean} useHandCursor - Description. 
    +	* @default
    +	*/
    +    this.useHandCursor = false;
    +	
    +	/**
    +	* @property {boolean} isDragged - Description. 
    +	* @default
    +	*/
    +    this.isDragged = false;
    +    
    +	/**
    +	* @property {boolean} allowHorizontalDrag - Description. 
    +	* @default
    +	*/
    +    this.allowHorizontalDrag = true;
    +    
    +	/**
    +	* @property {boolean} allowVerticalDrag - Description. 
    +	* @default
    +	*/
    +    this.allowVerticalDrag = true;
    +    
    +	/**
    +	* @property {boolean} bringToTop - Description. 
    +	* @default
    +	*/
    +    this.bringToTop = false;
    +
    +	/**
    +	* @property {Description} snapOffset - Description. 
    +	* @default
    +	*/
    +    this.snapOffset = null;
    +    
    +	/**
    +	* @property {boolean} snapOnDrag - Description. 
    +	* @default
    +	*/
    +    this.snapOnDrag = false;
    +    
    +	/**
    +	* @property {boolean} snapOnRelease - Description. 
    +	* @default
    +	*/
    +    this.snapOnRelease = false;
    +    
    +	/**
    +	* @property {number} snapX - Description. 
    +	* @default
    +	*/
    +    this.snapX = 0;
    +    
    +	/**
    +	* @property {number} snapY - Description. 
    +	* @default
    +	*/
    +    this.snapY = 0;
    +
    +	/**
    +	* @property {number} pixelPerfect - Should we use pixel perfect hit detection? Warning: expensive. Only enable if you really need it!
    +	* @default
    +	*/
    +    this.pixelPerfect = false;
    +
    +    /**
    +    * @property {number} pixelPerfectAlpha - The alpha tolerance threshold. If the alpha value of the pixel matches or is above this value, it's considered a hit.
    +    * @default
    +    */
    +    this.pixelPerfectAlpha = 255;
    +
    +    /**
    +    * @property {boolean} draggable - Is this sprite allowed to be dragged by the mouse? true = yes, false = no
    +    * @default 
    +    */
    +    this.draggable = false;
    +
    +    /**
    +    * @property {Description} boundsRect - A region of the game world within which the sprite is restricted during drag.
    +    * @default 
    +    */
    +    this.boundsRect = null;
    +
    +    /**
    +    * @property {Description} boundsSprite - A Sprite the bounds of which this sprite is restricted during drag.
    +    * @default
    +    */
    +    this.boundsSprite = null;
    +
    +    /**
    +    * 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.
    +    * @property {boolean} consumePointerEvent
    +    * @default
    +    */
    +    this.consumePointerEvent = false;
    +
    +    /**
    +    * @property {Phaser.Point} _tempPoint - Description.
    +    * @private
    +    */
    +    this._tempPoint = new Phaser.Point;
    +
    +    this._pointerData = [];
    +
    +    this._pointerData.push({
    +        id: 0,
    +        x: 0,
    +        y: 0,
    +        isDown: false,
    +        isUp: false,
    +        isOver: false,
    +        isOut: false,
    +        timeOver: 0,
    +        timeOut: 0,
    +        timeDown: 0,
    +        timeUp: 0,
    +        downDuration: 0,
    +        isDragged: false
    +    });
    +
    +};
    +
    +Phaser.InputHandler.prototype = {
    +
    +	/**
    +	* Description.
    +	* @method Phaser.InputHandler#start
    +	* @param {number} priority - Description.
    +	* @param {boolean} useHandCursor - Description.
    +	* @return {Phaser.Sprite} Description.
    +	*/
    +	start: function (priority, useHandCursor) {
    +
    +		priority = priority || 0;
    +		if (typeof useHandCursor == 'undefined') { useHandCursor = false; }
    +
    +        //  Turning on
    +        if (this.enabled == false)
    +        {
    +            //  Register, etc
    +			this.game.input.interactiveItems.add(this);
    +            this.useHandCursor = useHandCursor;
    +            this.priorityID = priority;
    +
    +            for (var i = 0; i < 10; i++)
    +            {
    +                this._pointerData[i] = {
    +                    id: i,
    +                    x: 0,
    +                    y: 0,
    +                    isDown: false,
    +                    isUp: false,
    +                    isOver: false,
    +                    isOut: false,
    +                    timeOver: 0,
    +                    timeOut: 0,
    +                    timeDown: 0,
    +                    timeUp: 0,
    +                    downDuration: 0,
    +                    isDragged: false
    +                };
    +            }
    +
    +            this.snapOffset = new Phaser.Point;
    +            this.enabled = true;
    +
    +            //  Create the signals the Input component will emit
    +            if (this.sprite.events && this.sprite.events.onInputOver == null)
    +            {
    +                this.sprite.events.onInputOver = new Phaser.Signal;
    +                this.sprite.events.onInputOut = new Phaser.Signal;
    +                this.sprite.events.onInputDown = new Phaser.Signal;
    +                this.sprite.events.onInputUp = new Phaser.Signal;
    +                this.sprite.events.onDragStart = new Phaser.Signal;
    +                this.sprite.events.onDragStop = new Phaser.Signal;
    +            }
    +        }
    +
    +        return this.sprite;
    +
    +	},
    +
    +	/**
    +	* Description.
    +	* @method Phaser.InputHandler#reset
    +	*/
    +    reset: function () {
    +
    +        this.enabled = false;
    +
    +        for (var i = 0; i < 10; i++)
    +        {
    +            this._pointerData[i] = {
    +                id: i,
    +                x: 0,
    +                y: 0,
    +                isDown: false,
    +                isUp: false,
    +                isOver: false,
    +                isOut: false,
    +                timeOver: 0,
    +                timeOut: 0,
    +                timeDown: 0,
    +                timeUp: 0,
    +                downDuration: 0,
    +                isDragged: false
    +            };
    +        }
    +    },
    +
    +	/**
    +	* Description.
    +	* @method Phaser.InputHandler#stop
    +	*/
    +	stop: function () {
    +
    +        //  Turning off
    +        if (this.enabled == false)
    +        {
    +            return;
    +        }
    +        else
    +        {
    +            //  De-register, etc
    +            this.enabled = false;
    +			this.game.input.interactiveItems.remove(this);
    +        }
    +
    +	},
    +
    +	/**
    +	* Clean up memory.
    +	* @method Phaser.InputHandler#destroy
    +	*/
    +    destroy: function () {
    +
    +        if (this.enabled)
    +        {
    +        	this.stop();
    +        	//	Null everything
    +        	this.sprite = null;
    +        	//	etc
    +        }
    +    },
    +
    +	/**
    +    * 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 Phaser.InputHandler#pointerX
    +    * @param {Pointer} pointer
    +    * @return {number} The x coordinate of the Input pointer.
    +    */    
    +    pointerX: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].x;
    +
    +    },
    +
    +	/**
    +    * 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 Phaser.InputHandler#pointerY
    +    * @param {Pointer} pointer
    +    * @return {number} The y coordinate of the Input pointer.
    +    */
    +    pointerY: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].y;
    +
    +    },
    +
    +	/**
    +    * If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.
    +    * @method Phaser.InputHandler#pointerDown
    +    * @param {Pointer} pointer
    +    * @return {boolean}
    +    */
    +    pointerDown: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].isDown;
    +
    +    },
    +
    +	/**
    +    * If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true
    +    * @method Phaser.InputHandler#pointerUp
    +    * @param {Pointer} pointer
    +    * @return {boolean}
    +    */
    +    pointerUp: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].isUp;
    +
    +    },
    +
    +	/**
    +    * A timestamp representing when the Pointer first touched the touchscreen.
    +    * @method Phaser.InputHandler#pointerTimeDown
    +    * @param {Pointer} pointer
    +    * @return {number}
    +    */
    +    pointerTimeDown: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].timeDown;
    +
    +    },
    +
    +	/**
    +    * A timestamp representing when the Pointer left the touchscreen.
    +    * @method Phaser.InputHandler#pointerTimeUp
    +    * @param {Pointer} pointer
    +    * @return {number}
    +    */
    +    pointerTimeUp: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].timeUp;
    +
    +    },
    +
    +	/**
    +    * Is the Pointer over this Sprite?
    +    * @method Phaser.InputHandler#pointerOver
    +    * @param {Pointer} pointer
    +    * @return {bool
    +    */
    +    pointerOver: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].isOver;
    +
    +    },
    +
    +	/**
    +    * Is the Pointer outside of this Sprite?
    +    * @method Phaser.InputHandler#pointerOut
    +    * @param {Pointer} pointer
    +    * @return {boolean}
    +    */
    +    pointerOut: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].isOut;
    +
    +    },
    +
    +	/**
    +    * A timestamp representing when the Pointer first touched the touchscreen.
    +    * @method Phaser.InputHandler#pointerTimeOver
    +    * @param {Pointer} pointer
    +    * @return {number}
    +    */
    +    pointerTimeOver: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].timeOver;
    +
    +    },
    +
    +	/**
    +    * A timestamp representing when the Pointer left the touchscreen.
    +    * @method Phaser.InputHandler#pointerTimeOut
    +    * @param {Pointer} pointer
    +    * @return {number}
    +    */
    +    pointerTimeOut: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].timeOut;
    +
    +    },
    +
    +	/**
    +    * Is this sprite being dragged by the mouse or not?
    +    * @method Phaser.InputHandler#pointerTimeOut
    +    * @param {Pointer} pointer
    +    * @return {number}
    +    */
    +    pointerDragged: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        return this._pointerData[pointer].isDragged;
    +
    +    },
    +
    +	/**
    +    * Checks if the given pointer is over this Sprite.
    +    * @method Phaser.InputHandler#checkPointerOver
    +    * @param {Pointer} pointer
    +    * @return {boolean}
    +    */
    +    checkPointerOver: function (pointer) {
    +
    +        if (this.enabled && this.sprite.visible)
    +        {
    +            this.sprite.getLocalUnmodifiedPosition(this._tempPoint, pointer.x, pointer.y);
    +
    +            //  Check against bounds first (move these to private vars)
    +            var x1 = -(this.sprite.texture.frame.width) * this.sprite.anchor.x;
    +            var y1;
    +            
    +            if (this._tempPoint.x > x1 && this._tempPoint.x < x1 + this.sprite.texture.frame.width)
    +            {
    +                y1 = -(this.sprite.texture.frame.height) * this.sprite.anchor.y;
    +            
    +                if (this._tempPoint.y > y1 && this._tempPoint.y < y1 + this.sprite.texture.frame.height)
    +                {
    +                    if (this.pixelPerfect)
    +                    {
    +                        return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
    +                    }
    +                    else
    +                    {
    +                        return true;
    +                    }
    +                }
    +            }
    +        }
    +
    +        return false;
    +
    +    },
    +
    +	/**
    +     * Description.
    +     * @method Phaser.InputHandler#checkPixel
    +     * @param {Description} x - Description.
    +     * @param {Description} y - Description.
    +     * @return {boolean}
    +     */
    +    checkPixel: function (x, y) {
    +
    +        x += (this.sprite.texture.frame.width * this.sprite.anchor.x);
    +        y += (this.sprite.texture.frame.height * this.sprite.anchor.y);
    +
    +        //  Grab a pixel from our image into the hitCanvas and then test it
    +
    +        if (this.sprite.texture.baseTexture.source)
    +        {
    +            this.game.input.hitContext.clearRect(0, 0, 1, 1);
    +
    +            //  This will fail if the image is part of a texture atlas - need to modify the x/y values here
    +            this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source, x, y, 1, 1, 0, 0, 1, 1);
    +            
    +            var rgb = this.game.input.hitContext.getImageData(0, 0, 1, 1);
    +
    +            if (rgb.data[3] >= this.pixelPerfectAlpha)
    +            {
    +                return true;
    +            }
    +        }
    +
    +        return false;
    +
    +    },
    +
    +	/**
    +    * Update.
    +    * @method Phaser.InputHandler#update
    +    * @param {Pointer} pointer
    +    */
    +    update: function (pointer) {
    +
    +        if (this.enabled == false || this.sprite.visible == false || (this.sprite.group && this.sprite.group.visible == false))
    +        {
    +            this._pointerOutHandler(pointer);
    +            return false;
    +        }
    +
    +        if (this.draggable && this._draggedPointerID == pointer.id)
    +        {
    +            return this.updateDrag(pointer);
    +        }
    +        else if (this._pointerData[pointer.id].isOver == true)
    +        {
    +            if (this.checkPointerOver(pointer))
    +            {
    +                this._pointerData[pointer.id].x = pointer.x - this.sprite.x;
    +                this._pointerData[pointer.id].y = pointer.y - this.sprite.y;
    +                return true;
    +            }
    +            else
    +            {
    +                this._pointerOutHandler(pointer);
    +                return false;
    +            }
    +        }
    +    },
    +
    +	/**
    +     * Description.
    +     * @method Phaser.InputHandler#_pointerOverHandler
    +     * @private
    +     * @param {Pointer} pointer
    +     */
    +    _pointerOverHandler: function (pointer) {
    +
    +        if (this._pointerData[pointer.id].isOver == false)
    +        {
    +            this._pointerData[pointer.id].isOver = true;
    +            this._pointerData[pointer.id].isOut = false;
    +            this._pointerData[pointer.id].timeOver = this.game.time.now;
    +            this._pointerData[pointer.id].x = pointer.x - this.sprite.x;
    +            this._pointerData[pointer.id].y = pointer.y - this.sprite.y;
    +
    +            if (this.useHandCursor && this._pointerData[pointer.id].isDragged == false)
    +            {
    +                this.game.stage.canvas.style.cursor = "pointer";
    +            }
    +
    +            this.sprite.events.onInputOver.dispatch(this.sprite, pointer);
    +        }
    +    },
    +
    +	/**
    +     * Description.
    +     * @method Phaser.InputHandler#_pointerOutHandler
    +     * @private
    +     * @param {Pointer} pointer
    +     */
    +    _pointerOutHandler: function (pointer) {
    +
    +        this._pointerData[pointer.id].isOver = false;
    +        this._pointerData[pointer.id].isOut = true;
    +        this._pointerData[pointer.id].timeOut = this.game.time.now;
    +
    +        if (this.useHandCursor && this._pointerData[pointer.id].isDragged == false)
    +        {
    +            this.game.stage.canvas.style.cursor = "default";
    +        }
    +
    +        this.sprite.events.onInputOut.dispatch(this.sprite, pointer);
    +
    +    },
    +
    +	/**
    +     * Description.
    +     * @method Phaser.InputHandler#_touchedHandler
    +     * @private
    +     * @param {Pointer} pointer
    +     */
    +    _touchedHandler: function (pointer) {
    +
    +        if (this._pointerData[pointer.id].isDown == false && this._pointerData[pointer.id].isOver == true)
    +        {
    +            this._pointerData[pointer.id].isDown = true;
    +            this._pointerData[pointer.id].isUp = false;
    +            this._pointerData[pointer.id].timeDown = this.game.time.now;
    +            this.sprite.events.onInputDown.dispatch(this.sprite, pointer);
    +
    +            //  Start drag
    +            if (this.draggable && this.isDragged == false)
    +            {
    +                this.startDrag(pointer);
    +            }
    +
    +            if (this.bringToTop)
    +            {
    +                this.sprite.bringToTop();
    +			}
    +        }
    +
    +        //  Consume the event?
    +        return this.consumePointerEvent;
    +
    +    },
    +
    +	/**
    +     * Description.
    +     * @method Phaser.InputHandler#_releasedHandler
    +     * @private
    +     * @param {Pointer} pointer
    +     */
    +    _releasedHandler: function (pointer) {
    +
    +        //  If was previously touched by this Pointer, check if still is AND still over this item
    +        if (this._pointerData[pointer.id].isDown && pointer.isUp)
    +        {
    +            this._pointerData[pointer.id].isDown = false;
    +            this._pointerData[pointer.id].isUp = true;
    +            this._pointerData[pointer.id].timeUp = this.game.time.now;
    +            this._pointerData[pointer.id].downDuration = this._pointerData[pointer.id].timeUp - this._pointerData[pointer.id].timeDown;
    +
    +            //  Only release the InputUp signal if the pointer is still over this sprite
    +            if (this.checkPointerOver(pointer))
    +            {
    +                //console.log('releasedHandler: ' + Date.now());
    +                this.sprite.events.onInputUp.dispatch(this.sprite, pointer);
    +            }
    +            else
    +            {
    +                //  Pointer outside the sprite? Reset the cursor
    +                if (this.useHandCursor)
    +                {
    +                    this.game.stage.canvas.style.cursor = "default";
    +                }
    +            }
    +
    +            //  Stop drag
    +            if (this.draggable && this.isDragged && this._draggedPointerID == pointer.id)
    +            {
    +                this.stopDrag(pointer);
    +            }
    +        }
    +
    +    },
    +
    +	/**
    +    * Updates the Pointer drag on this Sprite.
    +    * @method Phaser.InputHandler#updateDrag
    +    * @param {Pointer} pointer
    +    * @return {boolean}
    +    */
    +    updateDrag: function (pointer) {
    +
    +        if (pointer.isUp)
    +        {
    +            this.stopDrag(pointer);
    +            return false;
    +        }
    +
    +        if (this.allowHorizontalDrag)
    +        {
    +            this.sprite.x = pointer.x + this._dragPoint.x + this.dragOffset.x;
    +        }
    +
    +        if (this.allowVerticalDrag)
    +        {
    +            this.sprite.y = pointer.y + this._dragPoint.y + this.dragOffset.y;
    +        }
    +
    +        if (this.boundsRect)
    +        {
    +            this.checkBoundsRect();
    +        }
    +
    +        if (this.boundsSprite)
    +        {
    +            this.checkBoundsSprite();
    +        }
    +
    +        if (this.snapOnDrag)
    +        {
    +            this.sprite.x = Math.floor(this.sprite.x / this.snapX) * this.snapX;
    +            this.sprite.y = Math.floor(this.sprite.y / this.snapY) * this.snapY;
    +        }
    +
    +        return true;
    +
    +    },
    +
    +	/**
    +    * Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
    +    * @method Phaser.InputHandler#justOver
    +    * @param {Pointer} pointer
    +    * @param {number} delay - The time below which the pointer is considered as just over.
    +    * @return {boolean}
    +    */
    +    justOver: function (pointer, delay) {
    +
    +    	pointer = pointer || 0;
    +    	delay = delay || 500;
    +
    +        return (this._pointerData[pointer].isOver && this.overDuration(pointer) < delay);
    +
    +    },
    +
    +	/**
    +    * Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
    +    * @method Phaser.InputHandler#justOut
    +    * @param {Pointer} pointer
    +    * @param {number} delay - The time below which the pointer is considered as just out.
    +    * @return {boolean}
    +    */
    +    justOut: function (pointer, delay) {
    +
    +    	pointer = pointer || 0;
    +    	delay = delay || 500;
    +
    +        return (this._pointerData[pointer].isOut && (this.game.time.now - this._pointerData[pointer].timeOut < delay));
    +
    +    },
    +
    +	/**
    +    * Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
    +    * @method Phaser.InputHandler#justPressed
    +    * @param {Pointer} pointer
    +    * @param {number} delay - The time below which the pointer is considered as just over.
    +    * @return {boolean}
    +    */
    +    justPressed: function (pointer, delay) {
    +
    +    	pointer = pointer || 0;
    +    	delay = delay || 500;
    +
    +        return (this._pointerData[pointer].isDown && this.downDuration(pointer) < delay);
    +
    +    },
    +
    +	/**
    +    * Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
    +    * @method Phaser.InputHandler#justReleased
    +    * @param {Pointer} pointer
    +    * @param {number} delay - The time below which the pointer is considered as just out.
    +    * @return {boolean}
    +    */
    +    justReleased: function (pointer, delay) {
    +
    +    	pointer = pointer || 0;
    +    	delay = delay || 500;
    +
    +        return (this._pointerData[pointer].isUp && (this.game.time.now - this._pointerData[pointer].timeUp < delay));
    +
    +    },
    +
    +	/**
    +    * If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
    +    * @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.
    +    */
    +    overDuration: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        if (this._pointerData[pointer].isOver)
    +        {
    +            return this.game.time.now - this._pointerData[pointer].timeOver;
    +        }
    +
    +        return -1;
    +
    +    },
    +
    +	/**
    +    * If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
    +    * @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.
    +    */
    +    downDuration: function (pointer) {
    +
    +    	pointer = pointer || 0;
    +
    +        if (this._pointerData[pointer].isDown)
    +        {
    +            return this.game.time.now - this._pointerData[pointer].timeDown;
    +        }
    +
    +        return -1;
    +
    +    },
    +
    +	/**
    +    * Make this Sprite draggable by the mouse. You can also optionally set mouseStartDragCallback and mouseStopDragCallback
    +    * @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.
    +    * @param	alphaThreshold		If using pixel perfect collision this specifies the alpha level from 0 to 255 above which a collision is processed (default 255)
    +    * @param	boundsRect			If you want to restrict the drag of this sprite to a specific FlxRect, pass the FlxRect here, otherwise it's free to drag anywhere
    +    * @param	boundsSprite		If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here
    +    */
    +    enableDrag: function (lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite) {
    +
    +        if (typeof lockCenter == 'undefined') { lockCenter = false; }
    +        if (typeof bringToTop == 'undefined') { bringToTop = false; }
    +        if (typeof pixelPerfect == 'undefined') { pixelPerfect = false; }
    +
    +        alphaThreshold = alphaThreshold || 255;
    +        boundsRect = boundsRect || null;
    +        boundsSprite = boundsSprite || null;
    +
    +        this._dragPoint = new Phaser.Point();
    +        this.draggable = true;
    +        this.bringToTop = bringToTop;
    +        this.dragOffset = new Phaser.Point();
    +        this.dragFromCenter = lockCenter;
    +
    +        this.pixelPerfect = pixelPerfect;
    +        this.pixelPerfectAlpha = alphaThreshold;
    +
    +        if (boundsRect)
    +        {
    +            this.boundsRect = boundsRect;
    +        }
    +
    +        if (boundsSprite)
    +        {
    +            this.boundsSprite = boundsSprite;
    +        }
    +
    +    },
    +
    +	/**
    +    * 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 Phaser.InputHandler#disableDrag
    +    */
    +    disableDrag: function () {
    +
    +        if (this._pointerData)
    +        {
    +            for (var i = 0; i < 10; i++)
    +            {
    +                this._pointerData[i].isDragged = false;
    +            }
    +        }
    +
    +        this.draggable = false;
    +        this.isDragged = false;
    +        this._draggedPointerID = -1;
    +
    +    },
    +
    +	/**
    +    * Called by Pointer when drag starts on this Sprite. Should not usually be called directly.
    +    * @method Phaser.InputHandler#startDrag
    +    */
    +    startDrag: function (pointer) {
    +
    +        this.isDragged = true;
    +        this._draggedPointerID = pointer.id;
    +        this._pointerData[pointer.id].isDragged = true;
    +
    +        if (this.dragFromCenter)
    +        {
    +            this.sprite.centerOn(pointer.x, pointer.y);
    +            this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
    +        }
    +        else
    +        {
    +            this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
    +        }
    +
    +        this.updateDrag(pointer);
    +        
    +        if (this.bringToTop)
    +        {
    +            this.sprite.bringToTop();
    +        }
    +
    +        this.sprite.events.onDragStart.dispatch(this.sprite, pointer);
    +
    +    },
    +
    +	/**
    +    * Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
    +    * @method Phaser.InputHandler#stopDrag
    +    */
    +    stopDrag: function (pointer) {
    +
    +        this.isDragged = false;
    +        this._draggedPointerID = -1;
    +        this._pointerData[pointer.id].isDragged = false;
    +        
    +        if (this.snapOnRelease)
    +        {
    +            this.sprite.x = Math.floor(this.sprite.x / this.snapX) * this.snapX;
    +            this.sprite.y = Math.floor(this.sprite.y / this.snapY) * this.snapY;
    +        }
    +
    +        this.sprite.events.onDragStop.dispatch(this.sprite, pointer);
    +        this.sprite.events.onInputUp.dispatch(this.sprite, pointer);
    +
    +    },
    +
    +	/**
    +    * Restricts this sprite to drag movement only on the given axis. Note: If both are set to false the sprite will never move!
    +    * @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
    +    */
    +    setDragLock: function (allowHorizontal, allowVertical) {
    +
    +        if (typeof allowHorizontal == 'undefined') { allowHorizontal = true; }
    +    	if (typeof allowVertical == 'undefined') { allowVertical = true; }
    +
    +        this.allowHorizontalDrag = allowHorizontal;
    +        this.allowVerticalDrag = allowVertical;
    +
    +    },
    +
    +	/**
    +    * 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 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
    +    * @param	onRelease	If true the sprite will snap to the grid when released
    +    */
    +    enableSnap: function (snapX, snapY, onDrag, onRelease) {
    +
    +        if (typeof onDrag == 'undefined') { onDrag = true; }
    +        if (typeof onRelease == 'undefined') { onRelease = false; }
    +
    +        this.snapX = snapX;
    +        this.snapY = snapY;
    +        this.snapOnDrag = onDrag;
    +        this.snapOnRelease = onRelease;
    +
    +    },
    +
    +	/**
    +    * Stops the sprite from snapping to a grid during drag or release.
    +    * @method Phaser.InputHandler#disableSnap
    +    */
    +    disableSnap: function () {
    +
    +        this.snapOnDrag = false;
    +        this.snapOnRelease = false;
    +
    +    },
    +
    +	/**
    +    * Bounds Rect check for the sprite drag
    +    * @method Phaser.InputHandler#checkBoundsRect
    +    */
    +    checkBoundsRect: function () {
    +
    +        if (this.sprite.x < this.boundsRect.left)
    +        {
    +            this.sprite.x = this.boundsRect.x;
    +        }
    +        else if ((this.sprite.x + this.sprite.width) > this.boundsRect.right)
    +        {
    +            this.sprite.x = this.boundsRect.right - this.sprite.width;
    +        }
    +
    +        if (this.sprite.y < this.boundsRect.top)
    +        {
    +            this.sprite.y = this.boundsRect.top;
    +        }
    +        else if ((this.sprite.y + this.sprite.height) > this.boundsRect.bottom)
    +        {
    +            this.sprite.y = this.boundsRect.bottom - this.sprite.height;
    +        }
    +
    +    },
    +
    +	/**
    +    * Parent Sprite Bounds check for the sprite drag.
    +    * @method Phaser.InputHandler#checkBoundsSprite
    +    */
    +    checkBoundsSprite: function () {
    +
    +        if (this.sprite.x < this.boundsSprite.x)
    +        {
    +            this.sprite.x = this.boundsSprite.x;
    +        }
    +        else if ((this.sprite.x + this.sprite.width) > (this.boundsSprite.x + this.boundsSprite.width))
    +        {
    +            this.sprite.x = (this.boundsSprite.x + this.boundsSprite.width) - this.sprite.width;
    +        }
    +
    +        if (this.sprite.y < this.boundsSprite.y)
    +        {
    +            this.sprite.y = this.boundsSprite.y;
    +        }
    +        else if ((this.sprite.y + this.sprite.height) > (this.boundsSprite.y + this.boundsSprite.height))
    +        {
    +            this.sprite.y = (this.boundsSprite.y + this.boundsSprite.height) - this.sprite.height;
    +        }
    +
    +    }
    +
    +};
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:47 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Key.js.html b/Docs/out/Key.js.html new file mode 100644 index 00000000..6f3b75eb --- /dev/null +++ b/Docs/out/Key.js.html @@ -0,0 +1,434 @@ + + + + + + Phaser Source: input/Key.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: input/Key.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));
    +
    +    }
    +
    +};
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:47 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Keyboard.js.html b/Docs/out/Keyboard.js.html new file mode 100644 index 00000000..54164b1f --- /dev/null +++ b/Docs/out/Keyboard.js.html @@ -0,0 +1,726 @@ + + + + + + Phaser Source: input/Keyboard.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: input/Keyboard.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}
    +*/
    +
    +/**
    +* Phaser - Keyboard constructor.
    +*
    +* @class Phaser.Keyboard
    +* @classdesc A Keyboard object Description.
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +*/
    +Phaser.Keyboard = function (game) {
    +
    +	/**
    +	* @property {Phaser.Game} game - Local reference to game.
    +	*/
    +	this.game = game;
    +	
    +	/**
    +	* @property {Description} _keys - Description.
    +	* @private
    +	*/
    +    this._keys = {};
    +    
    +    /**
    +    * @property {Description} _hotkeys - Description.
    +    * @private
    +    */
    +    this._hotkeys = {};
    +
    +	/**
    +	* @property {Description} _capture - Description.
    +	* @private
    +	*/
    +    this._capture = {};
    +
    +    /**
    +    * You can disable all Keyboard Input by setting disabled to true. While true all new input related events will be ignored.
    +    * @property {boolean} disabled - The disabled state of the Keyboard.
    +    * @default
    +    */
    +    this.disabled = false;
    +
    +    /**
    +    * @property {function} _onKeyDown
    +    * @private
    +    * @default
    +    */
    +    this._onKeyDown = null;
    +    
    +    /**
    +    * @property {function} _onKeyUp
    +    * @private
    +    * @default
    +    */
    +    this._onKeyUp = null;
    +
    +    /**
    +    * @property {Object} callbackContext - The context under which the callbacks are run.
    +    */
    +    this.callbackContext = this;
    +
    +    /**
    +    * @property {function} onDownCallback - This callback is invoked every time a key is pressed down.
    +    */
    +    this.onDownCallback = null;
    +
    +    /**
    +    * @property {function} onUpCallback - This callback is invoked every time a key is released.
    +    */
    +    this.onUpCallback = null;
    +	
    +};
    +
    +Phaser.Keyboard.prototype = {
    +
    +    /**
    +    * Add callbacks to the Keyboard handler so that each time a key is pressed down or releases the callbacks are activated.
    +    * @method Phaser.Keyboard#addCallbacks
    +    * @param {Object} context - The context under which the callbacks are run.
    +    * @param {function} onDown - This callback is invoked every time a key is pressed down.
    +    * @param {function} [onUp=null] - This callback is invoked every time a key is released.
    +    */
    +    addCallbacks: function (context, onDown, onUp) {
    +
    +        this.callbackContext = context;
    +        this.onDownCallback = onDown;
    +
    +        if (typeof onUp !== 'undefined')
    +        {
    +            this.onUpCallback = onUp;
    +        }
    +
    +    },
    +
    +    /**
    +    * 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.
    +    *
    +    * @method Phaser.Keyboard#addKey
    +    * @param {number} keycode - The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
    +    * @return {Phaser.Key} The Key object which you can store locally and reference directly.
    +    */
    +    addKey: function (keycode) {
    +
    +        this._hotkeys[keycode] = new Phaser.Key(this.game, keycode);
    +        return this._hotkeys[keycode];
    +
    +    },
    +
    +    /**
    +    * Removes a Key object from the Keyboard manager.
    +    *
    +    * @method Phaser.Keyboard#removeKey
    +    * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
    +    */
    +    removeKey: function (keycode) {
    +
    +        delete (this._hotkeys[keycode]);
    +
    +    },
    +
    +    /**
    +    * 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.
    +    *
    +    * @method Phaser.Keyboard#start
    +    */
    +    start: function () {
    +
    +        var _this = this;
    +
    +        this._onKeyDown = function (event) {
    +            return _this.processKeyDown(event);
    +        };
    +
    +        this._onKeyUp = function (event) {
    +            return _this.processKeyUp(event);
    +        };
    +
    +        document.body.addEventListener('keydown', this._onKeyDown, false);
    +        document.body.addEventListener('keyup', this._onKeyUp, false);
    +
    +    },
    +
    +    /**
    +    * Stops the Keyboard event listeners from running (keydown and keyup). They are removed from the document.body.
    +    *
    +    * @method Phaser.Keyboard#stop
    +    */
    +    stop: function () {
    +
    +        document.body.removeEventListener('keydown', this._onKeyDown);
    +        document.body.removeEventListener('keyup', this._onKeyUp);
    +
    +    },
    +
    +	/**
    +    * 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.
    +    * @method Phaser.Keyboard#addKeyCapture
    +    * @param {Any} keycode
    +    */
    +    addKeyCapture: function (keycode) {
    +
    +        if (typeof keycode === 'object')
    +        {
    +            for (var key in keycode)
    +            {
    +                this._capture[keycode[key]] = true;
    +            }
    +        }
    +        else
    +        {
    +            this._capture[keycode] = true;
    +        }
    +    },
    +
    +	/**
    +	* Removes an existing key capture.
    +	* @method Phaser.Keyboard#removeKeyCapture
    +    * @param {number} keycode
    +    */
    +    removeKeyCapture: function (keycode) {
    +
    +        delete this._capture[keycode];
    +
    +    },
    +
    +	/**
    +	* Clear all set key captures.
    +	* @method Phaser.Keyboard#clearCaptures
    +    */
    +    clearCaptures: function () {
    +
    +        this._capture = {};
    +
    +    },
    +
    +	/**
    +	* Process the keydown event.
    +	* @method Phaser.Keyboard#processKeyDown
    +    * @param {KeyboardEvent} event
    +    * @protected
    +    */    
    +    processKeyDown: function (event) {
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        if (this._capture[event.keyCode])
    +        {
    +            event.preventDefault();
    +        }
    +
    +        if (this.onDownCallback)
    +        {
    +            this.onDownCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this._keys[event.keyCode] && this._keys[event.keyCode].isDown)
    +        {
    +            //  Key already down and still down, so update
    +            this._keys[event.keyCode].duration = this.game.time.now - this._keys[event.keyCode].timeDown;
    +        }
    +        else
    +        {
    +            if (!this._keys[event.keyCode])
    +            {
    +                //  Not used this key before, so register it
    +                this._keys[event.keyCode] = {
    +                    isDown: true,
    +                    timeDown: this.game.time.now,
    +                    timeUp: 0,
    +                    duration: 0
    +                };
    +            }
    +            else
    +            {
    +                //  Key used before but freshly down
    +                this._keys[event.keyCode].isDown = true;
    +                this._keys[event.keyCode].timeDown = this.game.time.now;
    +                this._keys[event.keyCode].duration = 0;
    +            }
    +        }
    +
    +        if (this._hotkeys[event.keyCode])
    +        {
    +            this._hotkeys[event.keyCode].processKeyDown(event);
    +        }
    +
    +    },
    +
    +	/**
    +	* Process the keyup event.
    +	* @method Phaser.Keyboard#processKeyUp
    +    * @param {KeyboardEvent} event
    +    * @protected
    +    */
    +    processKeyUp: function (event) {
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        if (this._capture[event.keyCode])
    +        {
    +            event.preventDefault();
    +        }
    +
    +        if (this.onUpCallback)
    +        {
    +            this.onUpCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this._hotkeys[event.keyCode])
    +        {
    +            this._hotkeys[event.keyCode].processKeyUp(event);
    +        }
    +
    +        this._keys[event.keyCode].isDown = false;
    +        this._keys[event.keyCode].timeUp = this.game.time.now;
    +
    +    },
    +
    +	/**
    +	* Reset the "isDown" state of all keys.
    +	* @method Phaser.Keyboard#reset
    +    */
    +    reset: function () {
    +
    +        for (var key in this._keys)
    +        {
    +            this._keys[key].isDown = false;
    +        }
    +
    +    },
    +
    +    /**
    +    * 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.Keyboard#justPressed
    +    * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
    +    * @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 (keycode, duration) {
    +
    +        if (typeof duration === "undefined") { duration = 250; }
    +
    +        if (this._keys[keycode] && this._keys[keycode].isDown && this._keys[keycode].duration < duration)
    +        {
    +            return true;
    +        }
    +
    +        return false;
    +
    +    },
    +
    +    /**
    +    * 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.Keyboard#justPressed
    +    * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
    +    * @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 (keycode, duration) {
    +
    +        if (typeof duration === "undefined") { duration = 250; }
    +
    +        if (this._keys[keycode] && this._keys[keycode].isDown === false && (this.game.time.now - this._keys[keycode].timeUp < duration))
    +        {
    +            return true;
    +        }
    +
    +        return false;
    +
    +    },
    +
    +    /**
    +    * Returns true of the key is currently pressed down. Note that it can only detect key presses on the web browser.
    +    * @method Phaser.Keyboard#isDown
    +    * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
    +    * @return {boolean} True if the key is currently down.
    +    */
    +    isDown: function (keycode) {
    +
    +        if (this._keys[keycode])
    +        {
    +            return this._keys[keycode].isDown;
    +        }
    +
    +		return false;
    +
    +    }
    +
    +};
    +
    +Phaser.Keyboard.A = "A".charCodeAt(0);
    +Phaser.Keyboard.B = "B".charCodeAt(0);
    +Phaser.Keyboard.C = "C".charCodeAt(0);
    +Phaser.Keyboard.D = "D".charCodeAt(0);
    +Phaser.Keyboard.E = "E".charCodeAt(0);
    +Phaser.Keyboard.F = "F".charCodeAt(0);
    +Phaser.Keyboard.G = "G".charCodeAt(0);
    +Phaser.Keyboard.H = "H".charCodeAt(0);
    +Phaser.Keyboard.I = "I".charCodeAt(0);
    +Phaser.Keyboard.J = "J".charCodeAt(0);
    +Phaser.Keyboard.K = "K".charCodeAt(0);
    +Phaser.Keyboard.L = "L".charCodeAt(0);
    +Phaser.Keyboard.M = "M".charCodeAt(0);
    +Phaser.Keyboard.N = "N".charCodeAt(0);
    +Phaser.Keyboard.O = "O".charCodeAt(0);
    +Phaser.Keyboard.P = "P".charCodeAt(0);
    +Phaser.Keyboard.Q = "Q".charCodeAt(0);
    +Phaser.Keyboard.R = "R".charCodeAt(0);
    +Phaser.Keyboard.S = "S".charCodeAt(0);
    +Phaser.Keyboard.T = "T".charCodeAt(0);
    +Phaser.Keyboard.U = "U".charCodeAt(0);
    +Phaser.Keyboard.V = "V".charCodeAt(0);
    +Phaser.Keyboard.W = "W".charCodeAt(0);
    +Phaser.Keyboard.X = "X".charCodeAt(0);
    +Phaser.Keyboard.Y = "Y".charCodeAt(0);
    +Phaser.Keyboard.Z = "Z".charCodeAt(0);
    +Phaser.Keyboard.ZERO = "0".charCodeAt(0);
    +Phaser.Keyboard.ONE = "1".charCodeAt(0);
    +Phaser.Keyboard.TWO = "2".charCodeAt(0);
    +Phaser.Keyboard.THREE = "3".charCodeAt(0);
    +Phaser.Keyboard.FOUR = "4".charCodeAt(0);
    +Phaser.Keyboard.FIVE = "5".charCodeAt(0);
    +Phaser.Keyboard.SIX = "6".charCodeAt(0);
    +Phaser.Keyboard.SEVEN = "7".charCodeAt(0);
    +Phaser.Keyboard.EIGHT = "8".charCodeAt(0);
    +Phaser.Keyboard.NINE = "9".charCodeAt(0);
    +Phaser.Keyboard.NUMPAD_0 = 96;
    +Phaser.Keyboard.NUMPAD_1 = 97;
    +Phaser.Keyboard.NUMPAD_2 = 98;
    +Phaser.Keyboard.NUMPAD_3 = 99;
    +Phaser.Keyboard.NUMPAD_4 = 100;
    +Phaser.Keyboard.NUMPAD_5 = 101;
    +Phaser.Keyboard.NUMPAD_6 = 102;
    +Phaser.Keyboard.NUMPAD_7 = 103;
    +Phaser.Keyboard.NUMPAD_8 = 104;
    +Phaser.Keyboard.NUMPAD_9 = 105;
    +Phaser.Keyboard.NUMPAD_MULTIPLY = 106;
    +Phaser.Keyboard.NUMPAD_ADD = 107;
    +Phaser.Keyboard.NUMPAD_ENTER = 108;
    +Phaser.Keyboard.NUMPAD_SUBTRACT = 109;
    +Phaser.Keyboard.NUMPAD_DECIMAL = 110;
    +Phaser.Keyboard.NUMPAD_DIVIDE = 111;
    +Phaser.Keyboard.F1 = 112;
    +Phaser.Keyboard.F2 = 113;
    +Phaser.Keyboard.F3 = 114;
    +Phaser.Keyboard.F4 = 115;
    +Phaser.Keyboard.F5 = 116;
    +Phaser.Keyboard.F6 = 117;
    +Phaser.Keyboard.F7 = 118;
    +Phaser.Keyboard.F8 = 119;
    +Phaser.Keyboard.F9 = 120;
    +Phaser.Keyboard.F10 = 121;
    +Phaser.Keyboard.F11 = 122;
    +Phaser.Keyboard.F12 = 123;
    +Phaser.Keyboard.F13 = 124;
    +Phaser.Keyboard.F14 = 125;
    +Phaser.Keyboard.F15 = 126;
    +Phaser.Keyboard.COLON = 186;
    +Phaser.Keyboard.EQUALS = 187;
    +Phaser.Keyboard.UNDERSCORE = 189;
    +Phaser.Keyboard.QUESTION_MARK = 191;
    +Phaser.Keyboard.TILDE = 192;
    +Phaser.Keyboard.OPEN_BRACKET = 219;
    +Phaser.Keyboard.BACKWARD_SLASH = 220;
    +Phaser.Keyboard.CLOSED_BRACKET = 221;
    +Phaser.Keyboard.QUOTES = 222;
    +Phaser.Keyboard.BACKSPACE = 8;
    +Phaser.Keyboard.TAB = 9;
    +Phaser.Keyboard.CLEAR = 12;
    +Phaser.Keyboard.ENTER = 13;
    +Phaser.Keyboard.SHIFT = 16;
    +Phaser.Keyboard.CONTROL = 17;
    +Phaser.Keyboard.ALT = 18;
    +Phaser.Keyboard.CAPS_LOCK = 20;
    +Phaser.Keyboard.ESC = 27;
    +Phaser.Keyboard.SPACEBAR = 32;
    +Phaser.Keyboard.PAGE_UP = 33;
    +Phaser.Keyboard.PAGE_DOWN = 34;
    +Phaser.Keyboard.END = 35;
    +Phaser.Keyboard.HOME = 36;
    +Phaser.Keyboard.LEFT = 37;
    +Phaser.Keyboard.UP = 38;
    +Phaser.Keyboard.RIGHT = 39;
    +Phaser.Keyboard.DOWN = 40;
    +Phaser.Keyboard.INSERT = 45;
    +Phaser.Keyboard.DELETE = 46;
    +Phaser.Keyboard.HELP = 47;
    +Phaser.Keyboard.NUM_LOCK = 144;
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/LinkedList.js.html b/Docs/out/LinkedList.js.html index 5a293818..cff83c43 100644 --- a/Docs/out/LinkedList.js.html +++ b/Docs/out/LinkedList.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -325,7 +373,7 @@ Phaser.LinkedList.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/Loader.js.html b/Docs/out/Loader.js.html new file mode 100644 index 00000000..90c676c8 --- /dev/null +++ b/Docs/out/Loader.js.html @@ -0,0 +1,1326 @@ + + + + + + Phaser Source: loader/Loader.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: loader/Loader.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}
    +*/
    +
    +/**
    +* 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.
    +* @class Phaser.Loader
    +* @classdesc  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.
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +*/
    +Phaser.Loader = function (game) {
    +
    +	/**
    +    * @property {Phaser.Game} game - Local reference to game.
    +	*/
    +	this.game = game;
    +
    +	/**
    +	* @property {array} _keys - Array stores assets keys. So you can get that asset by its unique key.
    +	* @private
    +    */
    +	this._keys = [];
    +
    +	/**
    +	* @property {Description} _fileList - Contains all the assets file infos.
    +	* @private
    +    */
    +	this._fileList = {};
    +
    +	/**
    +	* @property {number} _progressChunk - Indicates assets loading progress. (from 0 to 100)
    +	* @private
    +	* @default
    +	*/
    +	this._progressChunk = 0;
    +
    +	/**
    +	* @property {XMLHttpRequest} - An XMLHttpRequest object used for loading text and audio data.
    +	* @private
    +	*/
    +	this._xhr = new XMLHttpRequest();
    +
    +	/** 
    +	* @property {number} - Length of assets queue.
    +	* @default
    +	*/
    +	this.queueSize = 0;
    +
    +	/**
    +	* @property {boolean} isLoading - True if the Loader is in the process of loading the queue.
    +	* @default
    +	*/
    +	this.isLoading = false;
    +
    +	/**
    +	* @property {boolean} hasLoaded - True if all assets in the queue have finished loading.
    +	* @default
    +	*/
    +	this.hasLoaded = false;
    +
    +	/**
    +	* @property {number} progress - The Load progress percentage value (from 0 to 100)
    +	* @default
    +	*/
    +	this.progress = 0;
    +
    +	/**
    +	* You can optionally link a sprite to the preloader.
    +	* If you do so the Sprite's width or height will be cropped based on the percentage loaded.
    +	* @property {Description} preloadSprite
    +	* @default
    +	*/
    +	this.preloadSprite = null;
    +
    +	/**
    +	* @property {string} crossOrigin - The crossOrigin value applied to loaded images
    +	*/
    +	this.crossOrigin = '';
    +
    +	/**
    +	* 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!
    +	* @property {string} baseURL
    +	* @default
    +	*/
    +	this.baseURL = '';
    +
    +	/**
    +	* @property {Phaser.Signal} onFileComplete - Event signal.
    +	*/
    +	this.onFileComplete = new Phaser.Signal;
    +	
    +	/**
    +	* @property {Phaser.Signal} onFileError - Event signal.
    +	*/
    +	this.onFileError = new Phaser.Signal;
    +	
    +	/**
    +	* @property {Phaser.Signal} onLoadStart - Event signal.
    +	*/
    +	this.onLoadStart = new Phaser.Signal;
    +	
    +	/**
    +	* @property {Phaser.Signal} onLoadComplete - Event signal.
    +	*/
    +	this.onLoadComplete = new Phaser.Signal;
    +
    +};
    +
    +/**
    +* @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 = {
    +
    +	/**
    +	* 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 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) {
    +
    +		direction = direction || 0;
    +
    +		this.preloadSprite = { sprite: sprite, direction: direction, width: sprite.width, height: sprite.height, crop: null };
    +
    +		if (direction == 0)
    +		{
    +			//	Horizontal crop
    +			this.preloadSprite.crop = new Phaser.Rectangle(0, 0, 1, sprite.height);
    +		}
    +		else
    +		{
    +			//	Vertical crop
    +			this.preloadSprite.crop = new Phaser.Rectangle(0, 0, sprite.width, 1);
    +		}
    +
    +		sprite.crop = this.preloadSprite.crop;
    +
    +	},
    +
    +	/**
    +	* Check whether asset exists with a specific key.
    +	*
    +	* @method Phaser.Loader#checkKeyExists
    +	* @param {string} key - Key of the asset you want to check.
    +	* @return {boolean} Return true if exists, otherwise return false.
    +	*/
    +	checkKeyExists: function (key) {
    +
    +		if (this._fileList[key])
    +		{
    +			return true;
    +		}
    +		else
    +		{
    +			return false;
    +		}
    +		
    +	},
    +
    +	/**
    +	* Reset loader, this will remove all loaded assets.
    +	*
    +	* @method Phaser.Loader#reset
    +	*/
    +	reset: function () {
    +
    +		this.preloadSprite = null;
    +		this.queueSize = 0;
    +		this.isLoading = false;
    +
    +	},
    +
    +	/**
    +	* 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) {
    +
    +		var entry = {
    +			type: type,
    +			key: key,
    +			url: url,
    +			data: null,
    +			error: false,
    +			loaded: false
    +		};
    +
    +		if (typeof properties !== "undefined")
    +		{
    +			for (var prop in properties)
    +			{
    +				entry[prop] = properties[prop];
    +			}
    +		}
    +
    +		this._fileList[key] = entry;
    +
    +		this._keys.push(key);
    +
    +		this.queueSize++;
    +
    +	},
    +
    +	/**
    +	* Add an image to the Loader.
    +	*
    +	* @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
    +	*/
    +	image: function (key, url, overwrite) {
    +
    +		if (typeof overwrite === "undefined") { overwrite = false; }
    +
    +		if (overwrite || this.checkKeyExists(key) == false)
    +		{
    +			this.addToFileList('image', key, url);
    +		}
    +
    +	},
    +
    +	/**
    +	* Add a text file to the Loader.
    +	*
    +	* @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.
    +	*/
    +	text: function (key, url, overwrite) {
    +
    +		if (typeof overwrite === "undefined") { overwrite = false; }
    +
    +		if (overwrite || this.checkKeyExists(key) == false)
    +		{
    +			this.addToFileList('text', key, url);
    +		}
    +
    +	},
    +
    +	/**
    +	* 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.
    +	* @param {number} frameHeight - Height of each single frame.
    +	* @param {number} frameMax - How many frames in this sprite sheet.
    +	*/
    +	spritesheet: function (key, url, frameWidth, frameHeight, frameMax) {
    +
    +		if (typeof frameMax === "undefined") { frameMax = -1; }
    +
    +		if (this.checkKeyExists(key) === false)
    +		{
    +			this.addToFileList('spritesheet', key, url, { frameWidth: frameWidth, frameHeight: frameHeight, frameMax: frameMax });
    +		}
    +
    +	},
    +
    +	/**
    +	* 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.
    +	*/
    +	audio: function (key, urls, autoDecode) {
    +
    +		if (typeof autoDecode === "undefined") { autoDecode = true; }
    +
    +		if (this.checkKeyExists(key) === false)
    +		{
    +			this.addToFileList('audio', key, urls, { buffer: null, autoDecode: autoDecode });
    +		}
    +
    +	},
    +
    +	/**
    +	* Add a new tilemap loading request.
    +	*
    +	* @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)
    +	* @param {object} [mapData] - An optional JSON data object (can be given in place of a URL).
    +	* @param {string} [format] - The format of the map data.
    +	*/
    +	tilemap: function (key, tilesetURL, mapDataURL, mapData, format) {
    +
    +		if (typeof mapDataURL === "undefined") { mapDataURL = null; }
    +		if (typeof mapData === "undefined") { mapData = null; }
    +		if (typeof format === "undefined") { format = Phaser.Tilemap.CSV; }
    +
    +		if (this.checkKeyExists(key) === false)
    +		{
    +			//  A URL to a json/csv file has been given
    +			if (mapDataURL)
    +			{
    +				this.addToFileList('tilemap', key, tilesetURL, { mapDataURL: mapDataURL, format: format });
    +			}
    +			else
    +			{
    +				switch (format)
    +				{
    +					//  A csv string or object has been given
    +					case Phaser.Tilemap.CSV:
    +						break;
    +
    +					//  An xml string or object has been given
    +					case Phaser.Tilemap.JSON:
    +
    +						if (typeof mapData === 'string')
    +						{
    +							mapData = JSON.parse(mapData);
    +						}
    +						break;
    +				}
    +
    +				this.addToFileList('tilemap', key, tilesetURL, { mapDataURL: null, mapData: mapData, format: format });
    +
    +			}
    +		}
    +
    +	},
    +
    +	/**
    +	* Add a new bitmap font loading request.
    +	*
    +	* @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)
    +	* @param {object} [xmlData] - An optional XML data object.
    +	*/
    +	bitmapFont: function (key, textureURL, xmlURL, xmlData) {
    +
    +		if (typeof xmlURL === "undefined") { xmlURL = null; }
    +		if (typeof xmlData === "undefined") { xmlData = null; }
    +
    +		if (this.checkKeyExists(key) === false)
    +		{
    +			//  A URL to a json/xml file has been given
    +			if (xmlURL)
    +			{
    +				this.addToFileList('bitmapfont', key, textureURL, { xmlURL: xmlURL });
    +			}
    +			else
    +			{
    +				//  An xml string or object has been given
    +				if (typeof xmlData === 'string')
    +				{
    +					var xml;
    +
    +					try  {
    +						if (window['DOMParser'])
    +						{
    +							var domparser = new DOMParser();
    +							xml = domparser.parseFromString(xmlData, "text/xml");
    +						}
    +						else
    +						{
    +							xml = new ActiveXObject("Microsoft.XMLDOM");
    +							xml.async = 'false';
    +							xml.loadXML(xmlData);
    +						}
    +					}
    +					catch (e)
    +					{
    +						xml = undefined;
    +					}
    +
    +					if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length)
    +					{
    +						throw new Error("Phaser.Loader. Invalid Bitmap Font XML given");
    +					}
    +					else
    +					{
    +						this.addToFileList('bitmapfont', key, textureURL, { xmlURL: null, xmlData: xml });
    +					}
    +				}
    +			}
    +		}
    +
    +	},
    +
    +	/**
    +	* 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.
    +	*/
    +	atlasJSONArray: function (key, textureURL, atlasURL, atlasData) {
    +
    +		this.atlas(key, textureURL, atlasURL, atlasData, Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY);
    +
    +	},
    +
    +	/**
    +	* 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.
    +	*/
    +	atlasJSONHash: function (key, textureURL, atlasURL, atlasData) {
    +
    +		this.atlas(key, textureURL, atlasURL, atlasData, Phaser.Loader.TEXTURE_ATLAS_JSON_HASH);
    +
    +	},
    +
    +	/**
    +	* 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.
    +	*/
    +	atlasXML: function (key, textureURL, atlasURL, atlasData) {
    +
    +		this.atlas(key, textureURL, atlasURL, atlasData, Phaser.Loader.TEXTURE_ATLAS_XML_STARLING);
    +
    +	},
    +
    +	/**
    +	* 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). 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) {
    +
    +		if (typeof atlasURL === "undefined") { atlasURL = null; }
    +		if (typeof atlasData === "undefined") { atlasData = null; }
    +		if (typeof format === "undefined") { format = Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY; }
    +
    +		if (this.checkKeyExists(key) === false)
    +		{
    +			//  A URL to a json/xml file has been given
    +			if (atlasURL)
    +			{
    +				this.addToFileList('textureatlas', key, textureURL, { atlasURL: atlasURL, format: format });
    +			}
    +			else
    +			{
    +				switch (format)
    +				{
    +					//  A json string or object has been given
    +					case Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY: 
    +
    +						if (typeof atlasData === 'string')
    +						{
    +							atlasData = JSON.parse(atlasData);
    +						}
    +						break;
    +
    +					//  An xml string or object has been given
    +					case Phaser.Loader.TEXTURE_ATLAS_XML_STARLING:
    +
    +						if (typeof atlasData === 'string')
    +						{
    +							var xml;
    +
    +							try  {
    +								if (window['DOMParser'])
    +								{
    +									var domparser = new DOMParser();
    +									xml = domparser.parseFromString(atlasData, "text/xml");
    +								}
    +								else
    +								{
    +									xml = new ActiveXObject("Microsoft.XMLDOM");
    +									xml.async = 'false';
    +									xml.loadXML(atlasData);
    +								}
    +							}
    +							catch (e)
    +							{
    +								xml = undefined;
    +							}
    +
    +							if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length)
    +							{
    +								throw new Error("Phaser.Loader. Invalid Texture Atlas XML given");
    +							}
    +							else
    +							{
    +								atlasData = xml;
    +							}
    +						}
    +						break;
    +				}
    +
    +				this.addToFileList('textureatlas', key, textureURL, { atlasURL: null, atlasData: atlasData, format: format });
    +
    +			}
    +
    +		}
    +
    +	},
    +
    +	/**
    +	* 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];
    +
    +	},
    +
    +	/**
    +	* Remove all file loading requests.
    +	*
    +	* @method Phaser.Loader#removeAll
    +	*/
    +	removeAll: function () {
    +
    +		this._fileList = {};
    +
    +	},
    +
    +	/**
    +	* 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)
    +		{
    +			return;
    +		}
    +
    +		this.progress = 0;
    +		this.hasLoaded = false;
    +		this.isLoading = true;
    +
    +		this.onLoadStart.dispatch(this.queueSize);
    +
    +		if (this._keys.length > 0)
    +		{
    +			this._progressChunk = 100 / this._keys.length;
    +			this.loadFile();
    +		}
    +		else
    +		{
    +			this.progress = 100;
    +			this.hasLoaded = true;
    +			this.onLoadComplete.dispatch();
    +		}
    +
    +	},
    +
    +	/**
    +	* Load files. Private method ONLY used by loader.
    +	*
    +	* @method Phaser.Loader#loadFile
    +	* @private
    +	*/
    +	loadFile: function () {
    +
    +		var file = this._fileList[this._keys.shift()];
    +		var _this = this;
    +
    +		//  Image or Data?
    +		switch (file.type)
    +		{
    +			case 'image':
    +			case 'spritesheet':
    +			case 'textureatlas':
    +			case 'bitmapfont':
    +			case 'tilemap':
    +				file.data = new Image();
    +				file.data.name = file.key;
    +				file.data.onload = function () {
    +					return _this.fileComplete(file.key);
    +				};
    +				file.data.onerror = function () {
    +					return _this.fileError(file.key);
    +				};
    +				file.data.crossOrigin = this.crossOrigin;
    +				file.data.src = this.baseURL + file.url;
    +				break;
    +
    +			case 'audio':
    +				file.url = this.getAudioURL(file.url);
    +
    +				if (file.url !== null)
    +				{
    +					//  WebAudio or Audio Tag?
    +					if (this.game.sound.usingWebAudio)
    +					{
    +						this._xhr.open("GET", this.baseURL + file.url, true);
    +						this._xhr.responseType = "arraybuffer";
    +						this._xhr.onload = function () {
    +							return _this.fileComplete(file.key);
    +						};
    +						this._xhr.onerror = function () {
    +							return _this.fileError(file.key);
    +						};
    +						this._xhr.send();
    +					}
    +					else if (this.game.sound.usingAudioTag)
    +					{
    +						if (this.game.sound.touchLocked)
    +						{
    +							//  If audio is locked we can't do this yet, so need to queue this load request. Bum.
    +							file.data = new Audio();
    +							file.data.name = file.key;
    +							file.data.preload = 'auto';
    +							file.data.src = this.baseURL + file.url;
    +							this.fileComplete(file.key);
    +						}
    +						else
    +						{
    +							file.data = new Audio();
    +							file.data.name = file.key;
    +							file.data.onerror = function () {
    +								return _this.fileError(file.key);
    +							};
    +							file.data.preload = 'auto';
    +							file.data.src = this.baseURL + file.url;
    +							file.data.addEventListener('canplaythrough', Phaser.GAMES[this.game.id].load.fileComplete(file.key), false);
    +							file.data.load();
    +						}
    +					}
    +				}
    +				else
    +				{
    +					this.fileError(file.key);
    +				}
    +
    +				break;
    +
    +			case 'text':
    +				this._xhr.open("GET", this.baseURL + file.url, true);
    +				this._xhr.responseType = "text";
    +				this._xhr.onload = function () {
    +					return _this.fileComplete(file.key);
    +				};
    +				this._xhr.onerror = function () {
    +					return _this.fileError(file.key);
    +				};
    +				this._xhr.send();
    +				break;
    +		}
    +
    +	},
    +
    +	/**
    +	* Private method ONLY used by loader.
    +	* @method Phaser.Loader#getAudioURL
    +	* @param {Description} urls - Description.
    +	* @private
    +	*/
    +	getAudioURL: function (urls) {
    +
    +		var extension;
    +
    +		for (var i = 0; i < urls.length; i++)
    +		{
    +			extension = urls[i].toLowerCase();
    +			extension = extension.substr((Math.max(0, extension.lastIndexOf(".")) || Infinity) + 1);
    +
    +			if (this.game.device.canPlayAudio(extension))
    +			{
    +				return urls[i];
    +			}
    +
    +		}
    +
    +		return null;
    +
    +	},
    +
    +	/**
    +	* Error occured when load a file.
    +	*
    +	* @method Phaser.Loader#fileError
    +	* @param {string} key - Key of the error loading file.
    +	*/
    +	fileError: function (key) {
    +
    +		this._fileList[key].loaded = true;
    +		this._fileList[key].error = true;
    +
    +		this.onFileError.dispatch(key);
    +
    +		console.warn("Phaser.Loader error loading file: " + key);
    +
    +		this.nextFile(key, false);
    +
    +	},
    +
    +	/**
    +	* Called when a file is successfully loaded.
    +	*
    +	* @method Phaser.Loader#fileComplete
    +	* @param {string} key - Key of the successfully loaded file.
    +	*/
    +	fileComplete: function (key) {
    +
    +		if (!this._fileList[key])
    +		{
    +			console.warn('Phaser.Loader fileComplete invalid key ' + key);
    +			return;
    +		}
    +		
    +		this._fileList[key].loaded = true;
    +
    +		var file = this._fileList[key];
    +		var loadNext = true;
    +		var _this = this;
    +
    +		switch (file.type)
    +		{
    +			case 'image':
    +
    +				this.game.cache.addImage(file.key, file.url, file.data);
    +				break;
    +
    +			case 'spritesheet':
    +
    +				this.game.cache.addSpriteSheet(file.key, file.url, file.data, file.frameWidth, file.frameHeight, file.frameMax);
    +				break;
    +
    +			case 'tilemap':
    +
    +				if (file.mapDataURL == null)
    +				{
    +					this.game.cache.addTilemap(file.key, file.url, file.data, file.mapData, file.format);
    +				}
    +				else
    +				{
    +					//  Load the JSON or CSV before carrying on with the next file
    +					loadNext = false;
    +					this._xhr.open("GET", this.baseURL + file.mapDataURL, true);
    +					this._xhr.responseType = "text";
    +
    +					if (file.format == Phaser.Tilemap.JSON)
    +					{
    +						this._xhr.onload = function () {
    +							return _this.jsonLoadComplete(file.key);
    +						};
    +					}
    +					else if (file.format == Phaser.Tilemap.CSV)
    +					{
    +						this._xhr.onload = function () {
    +							return _this.csvLoadComplete(file.key);
    +						};
    +					}
    +
    +					this._xhr.onerror = function () {
    +						return _this.dataLoadError(file.key);
    +					};
    +					this._xhr.send();
    +				}
    +				break;
    +
    +			case 'textureatlas':
    +
    +				if (file.atlasURL == null)
    +				{
    +					this.game.cache.addTextureAtlas(file.key, file.url, file.data, file.atlasData, file.format);
    +				}
    +				else
    +				{
    +					//  Load the JSON or XML before carrying on with the next file
    +					loadNext = false;
    +					this._xhr.open("GET", this.baseURL + file.atlasURL, true);
    +					this._xhr.responseType = "text";
    +
    +					if (file.format == Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY || file.format == Phaser.Loader.TEXTURE_ATLAS_JSON_HASH)
    +					{
    +						this._xhr.onload = function () {
    +							return _this.jsonLoadComplete(file.key);
    +						};
    +					}
    +					else if (file.format == Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)
    +					{
    +						this._xhr.onload = function () {
    +							return _this.xmlLoadComplete(file.key);
    +						};
    +					}
    +
    +					this._xhr.onerror = function () {
    +						return _this.dataLoadError(file.key);
    +					};
    +					this._xhr.send();
    +				}
    +				break;
    +
    +			case 'bitmapfont':
    +
    +				if (file.xmlURL == null)
    +				{
    +					this.game.cache.addBitmapFont(file.key, file.url, file.data, file.xmlData);
    +				}
    +				else
    +				{
    +					//  Load the XML before carrying on with the next file
    +					loadNext = false;
    +					this._xhr.open("GET", this.baseURL + file.xmlURL, true);
    +					this._xhr.responseType = "text";
    +
    +					this._xhr.onload = function () {
    +						return _this.xmlLoadComplete(file.key);
    +					};
    +
    +					this._xhr.onerror = function () {
    +						return _this.dataLoadError(file.key);
    +					};
    +					this._xhr.send();
    +				}
    +				break;
    +
    +			case 'audio':
    +
    +				if (this.game.sound.usingWebAudio)
    +				{
    +					file.data = this._xhr.response;
    +
    +					this.game.cache.addSound(file.key, file.url, file.data, true, false);
    +
    +					if (file.autoDecode)
    +					{
    +						this.game.cache.updateSound(key, 'isDecoding', true);
    +
    +						var that = this;
    +						var key = file.key;
    +
    +						this.game.sound.context.decodeAudioData(file.data, function (buffer) {
    +							if (buffer)
    +							{
    +								that.game.cache.decodedSound(key, buffer);
    +							}
    +						});
    +					}
    +				}
    +				else
    +				{
    +					file.data.removeEventListener('canplaythrough', Phaser.GAMES[this.game.id].load.fileComplete);
    +					this.game.cache.addSound(file.key, file.url, file.data, false, true);
    +				}
    +				break;
    +
    +			case 'text':
    +				file.data = this._xhr.response;
    +				this.game.cache.addText(file.key, file.url, file.data);
    +				break;
    +		}
    +
    +		if (loadNext)
    +		{
    +			this.nextFile(key, true);
    +		}
    +
    +	},
    +
    +	/**
    +	* Successfully loaded a JSON file.
    +	*
    +	* @method Phaser.Loader#jsonLoadComplete
    +	* @param {string} key - Key of the loaded JSON file.
    +	*/
    +	jsonLoadComplete: function (key) {
    +
    +		var data = JSON.parse(this._xhr.response);
    +		var file = this._fileList[key];
    +
    +		if (file.type == 'tilemap')
    +		{
    +			this.game.cache.addTilemap(file.key, file.url, file.data, data, file.format);
    +		}
    +		else
    +		{
    +			this.game.cache.addTextureAtlas(file.key, file.url, file.data, data, file.format);
    +		}
    +
    +		this.nextFile(key, true);
    +
    +	},
    +
    +	/**
    +	* Successfully loaded a CSV file.
    +	*
    +	* @method Phaser.Loader#csvLoadComplete
    +	* @param {string} key - Key of the loaded CSV file.
    +	*/
    +	csvLoadComplete: function (key) {
    +
    +		var data = this._xhr.response;
    +		var file = this._fileList[key];
    +
    +		this.game.cache.addTilemap(file.key, file.url, file.data, data, file.format);
    +
    +		this.nextFile(key, true);
    +
    +	},
    +
    +	/**
    +	* Error occured when load a JSON.
    +	*
    +	* @method Phaser.Loader#dataLoadError
    +	* @param {string} key - Key of the error loading JSON file.
    +	*/
    +	dataLoadError: function (key) {
    +
    +		var file = this._fileList[key];
    +
    +		file.error = true;
    +
    +		console.warn("Phaser.Loader dataLoadError: " + key);
    +
    +		this.nextFile(key, true);
    +
    +	},
    +
    +	/**
    +	* Successfully loaded an XML file.
    +	*
    +	* @method Phaser.Loader#xmlLoadComplete
    +	* @param {string} key - Key of the loaded XML file.
    +	*/
    +	xmlLoadComplete: function (key) {
    +
    +		var data = this._xhr.response;
    +		var xml;
    +
    +		try
    +		{
    +			if (window['DOMParser'])
    +			{
    +				var domparser = new DOMParser();
    +				xml = domparser.parseFromString(data, "text/xml");
    +			}
    +			else
    +			{
    +				xml = new ActiveXObject("Microsoft.XMLDOM");
    +				xml.async = 'false';
    +				xml.loadXML(data);
    +			}
    +		}
    +		catch (e)
    +		{
    +			xml = undefined;
    +		}
    +
    +		if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length)
    +		{
    +			throw new Error("Phaser.Loader. Invalid XML given");
    +		}
    +
    +		var file = this._fileList[key];
    +
    +		if (file.type == 'bitmapfont')
    +		{
    +			this.game.cache.addBitmapFont(file.key, file.url, file.data, xml);
    +		}
    +		else if (file.type == 'textureatlas')
    +		{
    +			this.game.cache.addTextureAtlas(file.key, file.url, file.data, xml, file.format);
    +		}
    +
    +		this.nextFile(key, true);
    +
    +	},
    +
    +	/**
    +	* 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);
    +
    +		if (this.progress > 100)
    +		{
    +			this.progress = 100;
    +		}
    +
    +		if (this.preloadSprite !== null)
    +		{
    +			if (this.preloadSprite.direction == 0)
    +			{
    +				this.preloadSprite.crop.width = Math.floor((this.preloadSprite.width / 100) * this.progress);
    +			}
    +			else
    +			{
    +				this.preloadSprite.crop.height = Math.floor((this.preloadSprite.height / 100) * this.progress);
    +			}
    +
    +			this.preloadSprite.sprite.crop = this.preloadSprite.crop;
    +		}
    +
    +		this.onFileComplete.dispatch(this.progress, previousKey, success, this.queueSize - this._keys.length, this.queueSize);
    +
    +		if (this._keys.length > 0)
    +		{
    +			this.loadFile();
    +		}
    +		else
    +		{
    +			this.hasLoaded = true;
    +			this.isLoading = false;
    +			
    +			this.removeAll();
    +
    +			this.onLoadComplete.dispatch();
    +		}
    +
    +	}
    +
    +};
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/MSPointer.js.html b/Docs/out/MSPointer.js.html new file mode 100644 index 00000000..891aef6a --- /dev/null +++ b/Docs/out/MSPointer.js.html @@ -0,0 +1,445 @@ + + + + + + Phaser Source: input/MSPointer.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: input/MSPointer.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}
    +*/
    +
    +/**
    +* Phaser - MSPointer constructor.
    +*
    +* @class Phaser.MSPointer
    +* @classdesc 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
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +*/
    +Phaser.MSPointer = function (game) {
    +
    +	/**
    +	* @property {Phaser.Game} game - Local reference to game.
    +	*/
    +	this.game = game;
    +	
    +	/**
    +	* @property {Phaser.Game} callbackContext - Description.
    +	*/
    +	this.callbackContext = this.game;
    +
    +	/**
    +	* @property {Description} mouseDownCallback - Description.
    +	* @default
    +	*/
    +	this.mouseDownCallback = null;
    +	
    +	/**
    +	* @property {Description} mouseMoveCallback - Description.
    +	* @default
    +	*/
    +	this.mouseMoveCallback = null;
    +	
    +	/**
    +	* @property {Description} mouseUpCallback - Description.
    +	* @default
    +	*/
    +	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 = {
    +
    +	/**
    +    * Starts the event listeners running.
    +    * @method Phaser.MSPointer#start
    +    */
    +    start: function () {
    +
    +        var _this = this;
    +
    +        if (this.game.device.mspointer == true)
    +        {
    +            this._onMSPointerDown = function (event) {
    +                return _this.onPointerDown(event);
    +            };
    +
    +            this._onMSPointerMove = function (event) {
    +                return _this.onPointerMove(event);
    +            };
    +
    +            this._onMSPointerUp = function (event) {
    +                return _this.onPointerUp(event);
    +            };
    +
    +            this.game.renderer.view.addEventListener('MSPointerDown', this._onMSPointerDown, false);
    +            this.game.renderer.view.addEventListener('MSPointerMove', this._onMSPointerMove, false);
    +            this.game.renderer.view.addEventListener('MSPointerUp', this._onMSPointerUp, false);
    +
    +            this.game.renderer.view.style['-ms-content-zooming'] = 'none';
    +            this.game.renderer.view.style['-ms-touch-action'] = 'none';
    +
    +        }
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.MSPointer#onPointerDown
    +    * @param {Any} event
    +    **/
    +    onPointerDown: function (event) {
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        event.preventDefault();
    +        event.identifier = event.pointerId;
    +
    +        this.game.input.startPointer(event);
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.MSPointer#onPointerMove
    +    * @param {Any} event
    +    **/
    +    onPointerMove: function (event) {
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        event.preventDefault();
    +        event.identifier = event.pointerId;
    +
    +        this.game.input.updatePointer(event);
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.MSPointer#onPointerUp
    +    * @param {Any} event
    +    **/
    +    onPointerUp: function (event) {
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        event.preventDefault();
    +        event.identifier = event.pointerId;
    +
    +        this.game.input.stopPointer(event);
    +
    +    },
    +
    +	/**
    +    * Stop the event listeners.
    +    * @method Phaser.MSPointer#stop
    +    */
    +    stop: function () {
    +
    +        this.game.stage.canvas.removeEventListener('MSPointerDown', this._onMSPointerDown);
    +        this.game.stage.canvas.removeEventListener('MSPointerMove', this._onMSPointerMove);
    +        this.game.stage.canvas.removeEventListener('MSPointerUp', this._onMSPointerUp);
    +
    +    }
    +
    +};
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Math.js.html b/Docs/out/Math.js.html new file mode 100644 index 00000000..324b2e97 --- /dev/null +++ b/Docs/out/Math.js.html @@ -0,0 +1,1380 @@ + + + + + + Phaser Source: math/Math.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: math/Math.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}
    +*/
    +
    +/**
    +* 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;
    +
    +		};
    +
    +	}()
    +
    +};
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Mouse.js.html b/Docs/out/Mouse.js.html new file mode 100644 index 00000000..ce98d1ee --- /dev/null +++ b/Docs/out/Mouse.js.html @@ -0,0 +1,521 @@ + + + + + + Phaser Source: input/Mouse.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: input/Mouse.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}
    +*/
    +
    +/**
    +* Phaser - Mouse constructor.
    +*
    +* @class Phaser.Mouse
    +* @classdesc The Mouse class
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +*/
    +Phaser.Mouse = function (game) {
    +
    +	/**
    +	* @property {Phaser.Game} game - Local reference to game.
    +	*/
    +	this.game = game;
    +	
    +	/**
    +	* @property {Object} callbackContext - Description.
    +	*/
    +	this.callbackContext = this.game;
    +
    +	/**
    +	* @property {Description} mouseDownCallback - Description.
    +	* @default
    +	*/
    +	this.mouseDownCallback = null;
    +	
    +	/**
    +	* @property {Description} mouseMoveCallback - Description.
    +	* @default
    +	*/
    +	this.mouseMoveCallback = null;
    +	
    +	/**
    +	* @property {Description} mouseUpCallback - Description.
    +	* @default
    +	*/
    +	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
    +    * @default
    +    */
    +    this.disabled = false;
    +
    +    /**
    +    * If the mouse has been Pointer Locked successfully this will be set to true.
    +    * @property {boolean} locked
    +    * @default
    +    */
    +    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 Phaser.Mouse#start
    +    */
    +    start: function () {
    +
    +        var _this = this;
    +
    +        if (this.game.device.android && this.game.device.chrome == false)
    +        {
    +            //  Android stock browser fires mouse events even if you preventDefault on the touchStart, so ...
    +            return;
    +        }
    +
    +        this._onMouseDown = function (event) {
    +            return _this.onMouseDown(event);
    +        };
    +
    +        this._onMouseMove = function (event) {
    +            return _this.onMouseMove(event);
    +        };
    +
    +        this._onMouseUp = function (event) {
    +            return _this.onMouseUp(event);
    +        };
    +
    +        this.game.renderer.view.addEventListener('mousedown', this._onMouseDown, true);
    +        this.game.renderer.view.addEventListener('mousemove', this._onMouseMove, true);
    +        this.game.renderer.view.addEventListener('mouseup', this._onMouseUp, true);
    +
    +    },
    +
    +	/**
    +	* Description.
    +	* @method Phaser.Mouse#onMouseDown
    +    * @param {MouseEvent} event
    +    */
    +    onMouseDown: function (event) {
    +
    +        if (this.mouseDownCallback)
    +        {
    +            this.mouseDownCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        event['identifier'] = 0;
    +
    +        this.game.input.mousePointer.start(event);
    +
    +    },
    +
    +	/**
    +	* Description
    +	* @method Phaser.Mouse#onMouseMove
    +    * @param {MouseEvent} event
    +    */
    +    onMouseMove: function (event) {
    +
    +        if (this.mouseMoveCallback)
    +        {
    +            this.mouseMoveCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        event['identifier'] = 0;
    +
    +        this.game.input.mousePointer.move(event);
    +
    +    },
    +
    +	/**
    +	* Description.
    +	* @method Phaser.Mouse#onMouseUp
    +    * @param {MouseEvent} event
    +    */
    +    onMouseUp: function (event) {
    +
    +        if (this.mouseUpCallback)
    +        {
    +            this.mouseUpCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        event['identifier'] = 0;
    +
    +        this.game.input.mousePointer.stop(event);
    +
    +    },
    +
    +    /**
    +    * Description.
    +	* @method Phaser.Mouse#requestPointerLock
    +    */
    +    requestPointerLock: function () {
    +
    +        if (this.game.device.pointerLock)
    +        {
    +            var element = this.game.stage.canvas;
    +
    +            element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;
    +
    +            element.requestPointerLock();
    +
    +            var _this = this;
    +
    +            this._pointerLockChange = function (event) {
    +                return _this.pointerLockChange(event);
    +            };
    +
    +            document.addEventListener('pointerlockchange', this._pointerLockChange, false);
    +            document.addEventListener('mozpointerlockchange', this._pointerLockChange, false);
    +            document.addEventListener('webkitpointerlockchange', this._pointerLockChange, false);
    +        }
    +
    +    },
    +
    +	/**
    +	* Description.
    +	* @method Phaser.Mouse#pointerLockChange
    +    * @param {MouseEvent} event
    +    */
    +    pointerLockChange: function (event) {
    +
    +        var element = this.game.stage.canvas;
    +
    +        if (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element)
    +        {
    +            //  Pointer was successfully locked
    +            this.locked = true;
    +        }
    +        else
    +        {
    +            //  Pointer was unlocked
    +            this.locked = false;
    +        }
    +
    +    },
    +
    +	/**
    +	* Description.
    +	* @method Phaser.Mouse#releasePointerLock
    +    */
    +    releasePointerLock: function () {
    +
    +        document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock;
    +
    +        document.exitPointerLock();
    +
    +        document.removeEventListener('pointerlockchange', this._pointerLockChange);
    +        document.removeEventListener('mozpointerlockchange', this._pointerLockChange);
    +        document.removeEventListener('webkitpointerlockchange', this._pointerLockChange);
    +
    +    },
    +
    +	/**
    +    * Stop the event listeners.
    +    * @method Phaser.Mouse#stop
    +    */
    +    stop: function () {
    +
    +        this.game.stage.canvas.removeEventListener('mousedown', this._onMouseDown);
    +        this.game.stage.canvas.removeEventListener('mousemove', this._onMouseMove);
    +        this.game.stage.canvas.removeEventListener('mouseup', this._onMouseUp);
    +
    +    }
    +
    +};
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Parser.js.html b/Docs/out/Parser.js.html index c9f06d27..80f372c4 100644 --- a/Docs/out/Parser.js.html +++ b/Docs/out/Parser.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -490,7 +538,7 @@ Phaser.Animation.Parser = { 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/Parser.js_.html b/Docs/out/Parser.js_.html new file mode 100644 index 00000000..2deb9d0d --- /dev/null +++ b/Docs/out/Parser.js_.html @@ -0,0 +1,345 @@ + + + + + + Phaser Source: loader/Parser.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: loader/Parser.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}
    +*/
    +
    +/**
    +* 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
    +*/
    +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.
    +    */
    +	bitmapFont: function (game, xml, cacheKey) {
    +
    +        //  Malformed?
    +        if (!xml.getElementsByTagName('font'))
    +        {
    +            console.warn("Phaser.Loader.Parser.bitmapFont: Invalid XML given, missing <font> tag");
    +            return;
    +        }
    +
    +        var texture = PIXI.TextureCache[cacheKey];
    +
    +        var data = {};
    +        var info = xml.getElementsByTagName("info")[0];
    +        var common = xml.getElementsByTagName("common")[0];
    +        data.font = info.attributes.getNamedItem("face").nodeValue;
    +        data.size = parseInt(info.attributes.getNamedItem("size").nodeValue, 10);
    +        data.lineHeight = parseInt(common.attributes.getNamedItem("lineHeight").nodeValue, 10);
    +        data.chars = {};
    +
    +        //parse letters
    +        var letters = xml.getElementsByTagName("char");
    +
    +        for (var i = 0; i < letters.length; i++)
    +        {
    +            var charCode = parseInt(letters[i].attributes.getNamedItem("id").nodeValue, 10);
    +
    +            var textureRect = {
    +                x: parseInt(letters[i].attributes.getNamedItem("x").nodeValue, 10),
    +                y: parseInt(letters[i].attributes.getNamedItem("y").nodeValue, 10),
    +                width: parseInt(letters[i].attributes.getNamedItem("width").nodeValue, 10),
    +                height: parseInt(letters[i].attributes.getNamedItem("height").nodeValue, 10)
    +            };
    +
    +            //	Note: This means you can only have 1 BitmapFont loaded at once!
    +            //	Need to replace this with our own handler soon.
    +            PIXI.TextureCache[charCode] = new PIXI.Texture(texture, textureRect);
    +
    +            data.chars[charCode] = {
    +                xOffset: parseInt(letters[i].attributes.getNamedItem("xoffset").nodeValue, 10),
    +                yOffset: parseInt(letters[i].attributes.getNamedItem("yoffset").nodeValue, 10),
    +                xAdvance: parseInt(letters[i].attributes.getNamedItem("xadvance").nodeValue, 10),
    +                kerning: {},
    +                texture:new PIXI.Texture(texture, textureRect)
    +
    +            };
    +        }
    +
    +        //parse kernings
    +        var kernings = xml.getElementsByTagName("kerning");
    +
    +        for (i = 0; i < kernings.length; i++)
    +        {
    +           var first = parseInt(kernings[i].attributes.getNamedItem("first").nodeValue, 10);
    +           var second = parseInt(kernings[i].attributes.getNamedItem("second").nodeValue, 10);
    +           var amount = parseInt(kernings[i].attributes.getNamedItem("amount").nodeValue, 10);
    +
    +            data.chars[second].kerning[first] = amount;
    +        }
    +
    +        PIXI.BitmapText.fonts[data.font] = data;
    +
    +    }
    +
    +};
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Phaser.Animation.Frame.html b/Docs/out/Phaser.Animation.Frame.html index 0317af56..76085ba2 100644 --- a/Docs/out/Phaser.Animation.Frame.html +++ b/Docs/out/Phaser.Animation.Frame.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -2684,7 +2732,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/Docs/out/Phaser.Animation.FrameData.html b/Docs/out/Phaser.Animation.FrameData.html index 65f716b4..da21cbbe 100644 --- a/Docs/out/Phaser.Animation.FrameData.html +++ b/Docs/out/Phaser.Animation.FrameData.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -1138,7 +1186,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/Docs/out/Phaser.Animation.html b/Docs/out/Phaser.Animation.html index 1c2338c5..b9a3c5c1 100644 --- a/Docs/out/Phaser.Animation.html +++ b/Docs/out/Phaser.Animation.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Cache

    +
    + +
    +

    + 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.

    + +
    + +
    +
    + + + + +
    +

    new Cache(game)

    + + +
    +
    + + +
    +

    Phaser.Cache constructor.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onSoundUnlock

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onSoundUnlock + + +Phaser.Signal + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    addBitmapFont(key, url, data, xmlData)

    + + +
    +
    + + +
    +

    Add a new Bitmap Font.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    url + + +string + + + +

    URL of this font xml file.

    data + + +object + + + +

    Extra font data.

    xmlData + + +object + + + +

    Texture atlas frames data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addCanvas(key, canvas, context)

    + + +
    +
    + + +
    +

    Add a new canvas object in to the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for this canvas.

    canvas + + +HTMLCanvasElement + + + +

    Canvas DOM element.

    context + + +CanvasRenderingContext2D + + + +

    Render context of this canvas.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addDefaultImage()

    + + +
    +
    + + +
    +

    Adds a default image to be used when a key is wrong / missing. Is mapped to the key __default.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addImage(key, url, data)

    + + +
    +
    + + +
    +

    Add a new image.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    url + + +string + + + +

    URL of this image file.

    data + + +object + + + +

    Extra image data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addRenderTexture(key, textue)

    + + +
    +
    + + +
    +

    Add a new Phaser.RenderTexture in to the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    textue + + +Phaser.Texture + + + +

    The texture to use as the base of the RenderTexture.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addSound(key, url, data, webAudio, audioTag)

    + + +
    +
    + + +
    +

    Add a new sound.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for the sound.

    url + + +string + + + +

    URL of this sound file.

    data + + +object + + + +

    Extra sound data.

    webAudio + + +boolean + + + +

    True if the file is using web audio.

    audioTag + + +boolean + + + +

    True if the file is using legacy HTML audio.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addSpriteSheet(key, url, data, frameWidth, frameHeight, frameMax)

    + + +
    +
    + + +
    +

    Add a new sprite sheet in to the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    url + + +string + + + +

    URL of this sprite sheet file.

    data + + +object + + + +

    Extra sprite sheet data.

    frameWidth + + +number + + + +

    Width of the sprite sheet.

    frameHeight + + +number + + + +

    Height of the sprite sheet.

    frameMax + + +number + + + +

    How many frames stored in the sprite sheet.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addText(key, url, data)

    + + +
    +
    + + +
    +

    Add a new text data.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for the text data.

    url + + +string + + + +

    URL of this text data file.

    data + + +object + + + +

    Extra text data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addTextureAtlas(key, url, data, atlasData, format)

    + + +
    +
    + + +
    +

    Add a new texture atlas.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    url + + +string + + + +

    URL of this texture atlas file.

    data + + +object + + + +

    Extra texture atlas data.

    atlasData + + +object + + + +

    Texture atlas frames data.

    format + + +number + + + +

    The format of the texture atlas.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addTilemap(key, url, data, mapData, format)

    + + +
    +
    + + +
    +

    Add a new tilemap.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    url + + +string + + + +

    URL of the tilemap image.

    data + + +object + + + +

    Tilemap data.

    mapData + + +object + + + +

    The tilemap data object.

    format + + +number + + + +

    The format of the tilemap data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    checkImageKey(key) → {boolean}

    + + +
    +
    + + +
    +

    Checks if an image key exists.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the image you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the key exists, otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    decodedSound(key, data)

    + + +
    +
    + + +
    +

    Add a new decoded sound.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for the sound.

    data + + +object + + + +

    Extra sound data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Clears the cache. Removes every local cache object reference.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getCanvas(key) → {object}

    + + +
    +
    + + +
    +

    Get acanvas object from the cache by its key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the canvas you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The canvas you want.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + + +
    + + + +
    +

    getFrame(key) → {Phaser.Animation.Frame}

    + + +
    +
    + + +
    +

    Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the frame data you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The frame data you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation.Frame + + +
    +
    + + + + + +
    + + + +
    +

    getFrameByIndex(key) → {Phaser.Animation.Frame}

    + + +
    +
    + + +
    +

    Get a single frame out of a frameData set by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the frame data you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The frame data you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation.Frame + + +
    +
    + + + + + +
    + + + +
    +

    getFrameByName(key) → {Phaser.Animation.Frame}

    + + +
    +
    + + +
    +

    Get a single frame out of a frameData set by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the frame data you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The frame data you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation.Frame + + +
    +
    + + + + + +
    + + + +
    +

    getFrameData(key) → {Phaser.Animation.FrameData}

    + + +
    +
    + + +
    +

    Get frame data by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the frame data you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The frame data you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation.FrameData + + +
    +
    + + + + + +
    + + + +
    +

    getImage(key) → {object}

    + + +
    +
    + + +
    +

    Get image data by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the image you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The image data you want.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + + +
    + + + +
    +

    getImageKeys() → {Array}

    + + +
    +
    + + +
    +

    Returns an array containing all of the keys of Images in the Cache.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The string based keys in the Cache.

    +
    + + + +
    +
    + Type +
    +
    + +Array + + +
    +
    + + + + + +
    + + + +
    +

    getKeys(array) → {Array}

    + + +
    +
    + + +
    +

    Get the cache keys from a given array of objects. +Normally you don't call this directly but instead use getImageKeys, getSoundKeys, etc.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    array + + +Array + + + +

    An array of items to return the keys for.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The array of item keys.

    +
    + + + +
    +
    + Type +
    +
    + +Array + + +
    +
    + + + + + +
    + + + +
    +

    getSound(key) → {Phaser.Sound}

    + + +
    +
    + + +
    +

    Get sound by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the sound you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The sound you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Sound + + +
    +
    + + + + + +
    + + + +
    +

    getSoundData(key) → {object}

    + + +
    +
    + + +
    +

    Get sound data by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the sound you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The sound data you want.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + + +
    + + + +
    +

    getSoundKeys() → {Array}

    + + +
    +
    + + +
    +

    Returns an array containing all of the keys of Sounds in the Cache.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The string based keys in the Cache.

    +
    + + + +
    +
    + Type +
    +
    + +Array + + +
    +
    + + + + + +
    + + + +
    +

    getText(key) → {object}

    + + +
    +
    + + +
    +

    Get text data by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the text data you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The text data you want.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + + +
    + + + +
    +

    getTextKeys() → {Array}

    + + +
    +
    + + +
    +

    Returns an array containing all of the keys of Text Files in the Cache.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The string based keys in the Cache.

    +
    + + + +
    +
    + Type +
    +
    + +Array + + +
    +
    + + + + + +
    + + + +
    +

    getTexture(key) → {Phaser.RenderTexture}

    + + +
    +
    + + +
    +

    Get a RenderTexture by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the RenderTexture you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The RenderTexture you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.RenderTexture + + +
    +
    + + + + + +
    + + + +
    +

    getTextureFrame(key) → {Phaser.Animation.Frame}

    + + +
    +
    + + +
    +

    Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the frame data you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The frame data you want.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation.Frame + + +
    +
    + + + + + +
    + + + +
    +

    getTilemap(key) → {Phaser.Tilemap}

    + + +
    +
    + + +
    +

    Get tilemap data by key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the tilemap you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The tilemap data. The tileset image is in the data property, the map data in mapData.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Tilemap + + +
    +
    + + + + + +
    + + + +
    +

    isSoundDecoded(key) → {boolean}

    + + +
    +
    + + +
    +

    Check if the given sound has finished decoding.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the sound you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The decoded state of the Sound object.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    isSoundReady(key) → {boolean}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the sound you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the sound is decoded and the device is not touch locked.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    isSpriteSheet(key) → {boolean}

    + + +
    +
    + + +
    +

    Check whether an image asset is sprite sheet or not.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the sprite sheet you want.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the image is a sprite sheet.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    reloadSound(key)

    + + +
    +
    + + +
    +

    Reload a sound.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for the sound.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reloadSoundComplete(key)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for the sound.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeCanvas(key)

    + + +
    +
    + + +
    +

    Removes a canvas from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeImage(key)

    + + +
    +
    + + +
    +

    Removes an image from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeSound(key)

    + + +
    +
    + + +
    +

    Removes a sound from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeText(key)

    + + +
    +
    + + +
    +

    Removes a text from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    updateSound(key)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key for the sound.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Camera.html b/Docs/out/Phaser.Camera.html index 1b2571dc..6e4a4542 100644 --- a/Docs/out/Phaser.Camera.html +++ b/Docs/out/Phaser.Camera.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -472,115 +520,6 @@ This is updated by the core game loop.

    - - - - - - - - -
    -

    _oldPosition

    - - -
    -
    - -
    -

    A vector object representing the previous position of the Pointer.

    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    vector - - -Vec2 - - - -
    -
    - - - - - - - - - - - - - - - - - - -
    Default Value:
    -
    • null
    - - - -
    Source:
    -
    - - - - - - -
    @@ -640,7 +579,7 @@ When you've limited max pointers to 1 this will accurately be either the first f -Pointer +Phaser.Pointer @@ -682,7 +621,7 @@ When you've limited max pointers to 1 this will accurately be either the first f
    Source:
    @@ -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
    Source:
    @@ -901,7 +840,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
    Source:
    @@ -1011,7 +950,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1120,7 +1059,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1643,7 +1582,113 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    + + + + + + + + + + + + + + + +
    +

    interactiveItems

    + + +
    +
    + +
    +

    A linked list of interactive objects, the InputHandler components (belonging to Sprites) register themselves with this.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    interactiveItems + + +Phaser.LinkedList + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1752,7 +1797,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1861,7 +1906,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1886,7 +1931,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -

    Description.

    +

    The Keyboard Input manager.

    @@ -1928,7 +1973,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous -Description +Phaser.Keyboard @@ -1938,7 +1983,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous - +

    The Keyboard Input manager.

    @@ -1970,7 +2015,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -2080,7 +2125,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2105,7 +2150,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    The Mouse Input manager.

    @@ -2147,7 +2192,7 @@ For lots of games it's useful to set this to 1.

    -Description +Phaser.Mouse @@ -2157,7 +2202,7 @@ For lots of games it's useful to set this to 1.

    - +

    The Mouse Input manager.

    @@ -2189,7 +2234,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2214,7 +2259,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    The mouse has its own unique Phaser.Pointer object which you can use if making a desktop specific game.

    @@ -2298,7 +2343,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2323,7 +2368,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    The MSPointer Input manager.

    @@ -2365,7 +2410,7 @@ For lots of games it's useful to set this to 1.

    -Description +Phaser.MSPointer @@ -2375,7 +2420,7 @@ For lots of games it's useful to set this to 1.

    - +

    The MSPointer Input manager.

    @@ -2407,7 +2452,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2513,7 +2558,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2538,7 +2583,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    A Signal that is dispatched each time a pointer is pressed down.

    @@ -2580,7 +2625,7 @@ For lots of games it's useful to set this to 1.

    -Description +Phaser.Signal @@ -2622,7 +2667,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2647,7 +2692,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    A Signal that is dispatched each time a pointer is held down.

    @@ -2689,7 +2734,7 @@ For lots of games it's useful to set this to 1.

    -Description +Phaser.Signal @@ -2731,7 +2776,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2756,7 +2801,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    A Signal that is dispatched each time a pointer is tapped.

    @@ -2798,7 +2843,7 @@ For lots of games it's useful to set this to 1.

    -Description +Phaser.Signal @@ -2840,7 +2885,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2865,7 +2910,7 @@ For lots of games it's useful to set this to 1.

    -

    Description.

    +

    A Signal that is dispatched each time a pointer is released.

    @@ -2907,7 +2952,7 @@ For lots of games it's useful to set this to 1.

    -Description +Phaser.Signal @@ -2949,7 +2994,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3016,7 +3061,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3055,7 +3100,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3122,7 +3167,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3161,7 +3206,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3228,7 +3273,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3267,7 +3312,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3334,7 +3379,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3373,7 +3418,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3440,7 +3485,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3479,7 +3524,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3546,7 +3591,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3585,7 +3630,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3652,7 +3697,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3691,7 +3736,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3758,7 +3803,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3797,7 +3842,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3864,7 +3909,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -3903,7 +3948,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3970,7 +4015,7 @@ For lots of games it's useful to set this to 1.

    -Pointer +Phaser.Pointer @@ -4009,7 +4054,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4111,7 +4156,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4288,7 +4333,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr -Vec2 +Phaser.Point @@ -4330,7 +4375,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr
    Source:
    @@ -4440,7 +4485,7 @@ If the Pointer is tracking one event every 100ms, then a trackLimit of 100 would
    Source:
    @@ -4551,7 +4596,7 @@ The history is updated at the rate specified in Input.pollRate

    Source:
    @@ -4660,7 +4705,7 @@ The history is updated at the rate specified in Input.pollRate

    Source:
    @@ -4728,7 +4773,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    -Vec2 +Phaser.Point @@ -4770,7 +4815,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -4838,7 +4883,7 @@ otherwise see the Pointer objects directly.

    -Vec2 +Phaser.Point @@ -4880,7 +4925,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -4989,7 +5034,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5095,7 +5140,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5201,7 +5246,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5226,7 +5271,7 @@ otherwise see the Pointer objects directly.

    -

    Description.

    +

    The Touch Input manager.

    @@ -5268,7 +5313,7 @@ otherwise see the Pointer objects directly.

    -Description +Phaser.Touch @@ -5278,7 +5323,7 @@ otherwise see the Pointer objects directly.

    - +

    the Touch Input manager.

    @@ -5310,7 +5355,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5416,7 +5461,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5522,7 +5567,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5628,7 +5673,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5734,7 +5779,7 @@ otherwise see the Pointer objects directly.

    Source:
    @@ -5758,7 +5803,7 @@ otherwise see the Pointer objects directly.

    -

    addPointer() → {Pointer}

    +

    addPointer() → {Phaser.Pointer}

    @@ -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.

    Source:
    @@ -5825,7 +5870,7 @@ use this to create a new one, up to a maximum of 10.

    -

    A reference to the new Pointer object.

    +

    A reference to the new Pointer object that was created.

    @@ -5836,7 +5881,7 @@ use this to create a new one, up to a maximum of 10.

    -Pointer +Phaser.Pointer
    @@ -5892,7 +5937,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6033,7 +6078,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6197,7 +6242,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6248,7 +6293,7 @@ use this to create a new one, up to a maximum of 10.

    -

    getPointer(state) → {Phaser.Pointer}

    +

    getPointer(state) → {Phaser.Pointer}

    @@ -6338,7 +6383,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6374,7 +6419,7 @@ use this to create a new one, up to a maximum of 10.

    -Phaser.Pointer +Phaser.Pointer
    @@ -6389,7 +6434,7 @@ use this to create a new one, up to a maximum of 10.

    -

    getPointerFromIdentifier(identifier) → {Phaser.Pointer}

    +

    getPointerFromIdentifier(identifier) → {Phaser.Pointer}

    @@ -6479,7 +6524,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6515,7 +6560,7 @@ use this to create a new one, up to a maximum of 10.

    -Phaser.Pointer +Phaser.Pointer
    @@ -6588,7 +6633,7 @@ use this to create a new one, up to a maximum of 10.

    -

    A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.

    +

    A soft reset (hard = false) won't reset any Signals that might be bound. A hard reset will.

    @@ -6620,7 +6665,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6761,7 +6806,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6789,7 +6834,7 @@ use this to create a new one, up to a maximum of 10.

    -

    startPointer(event) → {Phaser.Pointer}

    +

    startPointer(event) → {Phaser.Pointer}

    @@ -6797,7 +6842,7 @@ use this to create a new one, up to a maximum of 10.

    -

    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.

    @@ -6879,7 +6924,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6915,7 +6960,7 @@ use this to create a new one, up to a maximum of 10.

    -Phaser.Pointer +Phaser.Pointer
    @@ -6930,7 +6975,7 @@ use this to create a new one, up to a maximum of 10.

    -

    stopPointer(event) → {Phaser.Pointer}

    +

    stopPointer(event) → {Phaser.Pointer}

    @@ -7020,7 +7065,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -7056,7 +7101,7 @@ use this to create a new one, up to a maximum of 10.

    -Phaser.Pointer +Phaser.Pointer
    @@ -7112,7 +7157,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -7140,7 +7185,7 @@ use this to create a new one, up to a maximum of 10.

    -

    updatePointer(event) → {Phaser.Pointer}

    +

    updatePointer(event) → {Phaser.Pointer}

    @@ -7148,7 +7193,7 @@ use this to create a new one, up to a maximum of 10.

    -

    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.

    @@ -7230,7 +7275,7 @@ use this to create a new one, up to a maximum of 10.

    Source:
    @@ -7266,7 +7311,7 @@ use this to create a new one, up to a maximum of 10.

    -Phaser.Pointer +Phaser.Pointer
    @@ -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 + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: InputHandler

    +
    + +
    +

    + InputHandler +

    + +

    Description.

    + +
    + +
    +
    + + + + +
    +

    new InputHandler(game)

    + + +
    +
    + + +
    +

    Constructor for Phaser InputHandler.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Sprite + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    allowHorizontalDrag

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    allowHorizontalDrag + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    allowVerticalDrag

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    allowVerticalDrag + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    boundsRect

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    boundsRect + + +Description + + + +

    A region of the game world within which the sprite is restricted during drag.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    boundsSprite

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    boundsSprite + + +Description + + + +

    A Sprite the bounds of which this sprite is restricted during drag.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    bringToTop

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    bringToTop + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    consumePointerEvent

    + + +
    +
    + +
    +

    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.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    consumePointerEvent + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    draggable

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    draggable + + +boolean + + + +

    Is this sprite allowed to be dragged by the mouse? true = yes, false = no

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    enabled

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    enabled + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    first

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    first + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isDragged

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isDragged + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    last

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    last + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    next

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    next + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    parent

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    parent + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    pixelPerfect

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pixelPerfect + + +number + + + +

    Should we use pixel perfect hit detection? Warning: expensive. Only enable if you really need it!

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    pixelPerfectAlpha

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pixelPerfectAlpha + + +number + + + +

    The alpha tolerance threshold. If the alpha value of the pixel matches or is above this value, it's considered a hit.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 255
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    prev

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    prev + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    priorityID

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    priorityID + + +number + + + +

    The PriorityID controls which Sprite receives an Input event first if they should overlap.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    snapOffset

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    snapOffset + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    snapOnDrag

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    snapOnDrag + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    snapOnRelease

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    snapOnRelease + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    snapX

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    snapX + + +number + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    snapY

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    snapY + + +number + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    sprite

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    sprite + + +Phaser.Sprite + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    useHandCursor

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    useHandCursor + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    checkBoundsRect()

    + + +
    +
    + + +
    +

    Bounds Rect check for the sprite drag

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    checkBoundsSprite()

    + + +
    +
    + + +
    +

    Parent Sprite Bounds check for the sprite drag.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    checkPixel(x, y) → {boolean}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +Description + + + +

    Description.

    y + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    checkPointerOver(pointer) → {boolean}

    + + +
    +
    + + +
    +

    Checks if the given pointer is over this Sprite.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Clean up memory.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    disableDrag()

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    disableSnap()

    + + +
    +
    + + +
    +

    Stops the sprite from snapping to a grid during drag or release.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    downDuration(pointer) → {number}

    + + +
    +
    + + +
    +

    If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The number of milliseconds the pointer has been pressed down on the Sprite, or -1 if not over.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    enableDrag(lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite)

    + + +
    +
    + + +
    +

    Make this Sprite draggable by the mouse. You can also optionally set mouseStartDragCallback and mouseStopDragCallback

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    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.

    bringToTop + +

    If true the Sprite will be bought to the top of the rendering list in its current Group.

    pixelPerfect + +

    If true it will use a pixel perfect test to see if you clicked the Sprite. False uses the bounding box.

    alphaThreshold + +

    If using pixel perfect collision this specifies the alpha level from 0 to 255 above which a collision is processed (default 255)

    boundsRect + +

    If you want to restrict the drag of this sprite to a specific FlxRect, pass the FlxRect here, otherwise it's free to drag anywhere

    boundsSprite + +

    If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    enableSnap(snapX, snapY, onDrag, onRelease)

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    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

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    justOut(pointer, delay) → {boolean}

    + + +
    +
    + + +
    +

    Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    delay + + +number + + + +

    The time below which the pointer is considered as just out.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justOver(pointer, delay) → {boolean}

    + + +
    +
    + + +
    +

    Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    delay + + +number + + + +

    The time below which the pointer is considered as just over.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justPressed(pointer, delay) → {boolean}

    + + +
    +
    + + +
    +

    Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    delay + + +number + + + +

    The time below which the pointer is considered as just over.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justReleased(pointer, delay) → {boolean}

    + + +
    +
    + + +
    +

    Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    delay + + +number + + + +

    The time below which the pointer is considered as just out.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    overDuration(pointer) → {number}

    + + +
    +
    + + +
    +

    If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The number of milliseconds the pointer has been over the Sprite, or -1 if not over.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerDown(pointer) → {boolean}

    + + +
    +
    + + +
    +

    If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    pointerOut(pointer) → {boolean}

    + + +
    +
    + + +
    +

    Is the Pointer outside of this Sprite?

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    pointerOver(pointer)

    + + +
    +
    + + +
    +

    Is the Pointer over this Sprite?

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    {bool

    +
    + + + + + + + +
    + + + +
    +

    pointerTimeDown(pointer) → {number}

    + + +
    +
    + + +
    +

    A timestamp representing when the Pointer first touched the touchscreen.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerTimeOut(pointer) → {number}

    + + +
    +
    + + +
    +

    A timestamp representing when the Pointer left the touchscreen.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerTimeOut(pointer) → {number}

    + + +
    +
    + + +
    +

    Is this sprite being dragged by the mouse or not?

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerTimeOver(pointer) → {number}

    + + +
    +
    + + +
    +

    A timestamp representing when the Pointer first touched the touchscreen.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerTimeUp(pointer) → {number}

    + + +
    +
    + + +
    +

    A timestamp representing when the Pointer left the touchscreen.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerUp(pointer) → {boolean}

    + + +
    +
    + + +
    +

    If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    pointerX(pointer) → {number}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The x coordinate of the Input pointer.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pointerY(pointer) → {number}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The y coordinate of the Input pointer.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    reset()

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    setDragLock(allowHorizontal, allowVertical)

    + + +
    +
    + + +
    +

    Restricts this sprite to drag movement only on the given axis. Note: If both are set to false the sprite will never move!

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    allowHorizontal + +

    To enable the sprite to be dragged horizontally set to true, otherwise false

    allowVertical + +

    To enable the sprite to be dragged vertically set to true, otherwise false

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start(priority, useHandCursor) → {Phaser.Sprite}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    priority + + +number + + + +

    Description.

    useHandCursor + + +boolean + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    Description.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Sprite + + +
    +
    + + + + + +
    + + + +
    +

    startDrag()

    + + +
    +
    + + +
    +

    Called by Pointer when drag starts on this Sprite. Should not usually be called directly.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stop()

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stopDrag()

    + + +
    +
    + + +
    +

    Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    update(pointer)

    + + +
    +
    + + +
    +

    Update.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    updateDrag(pointer) → {boolean}

    + + +
    +
    + + +
    +

    Updates the Pointer drag on this Sprite.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pointer + + +Pointer + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Key.html b/Docs/out/Phaser.Key.html new file mode 100644 index 00000000..19018940 --- /dev/null +++ b/Docs/out/Phaser.Key.html @@ -0,0 +1,2359 @@ + + + + + + Phaser Class: Key + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Key

    +
    + +
    +

    + Key +

    + +

    If you need more fine-grained control over the handling of specific keys you can create and use Phaser.Key objects.

    + +
    + +
    +
    + + + + +
    +

    new Key(game, keycode)

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Current game instance.

    keycode + + +number + + + +

    The key code this Key is responsible for.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    altKey

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    altKey + + +boolean + + + +

    The down state of the ALT key, if pressed at the same time as this key.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    ctrlKey

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    ctrlKey + + +boolean + + + +

    The down state of the CTRL key, if pressed at the same time as this key.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    duration

    + + +
    +
    + +
    +

    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:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    duration + + +number + + + +

    The number of milliseconds this key has been held down for.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isDown

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isDown + + +boolean + + + +

    The "down" state of the key.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isUp

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isUp + + +boolean + + + +

    The "up" state of the key.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    keyCode

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    keyCode + + +number + + + +

    The keycode of this key.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onDown

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onDown + + +Phaser.Signal + + + +

    This Signal is dispatched every time this Key is pressed down. It is only dispatched once (until the key is released again).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onUp

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onUp + + +Phaser.Signal + + + +

    This Signal is dispatched every time this Key is pressed down. It is only dispatched once (until the key is released again).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    repeats

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    repeats + + +number + + + +

    If a key is held down this holds down the number of times the key has 'repeated'.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    shiftKey

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    shiftKey + + +boolean + + + +

    The down state of the SHIFT key, if pressed at the same time as this key.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    timeDown

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    timeDown + + +number + + + +

    The timestamp when the key was last pressed down.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    timeUp

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    timeUp + + +number + + + +

    The timestamp when the key was last released.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    justPressed(duration) → {boolean}

    + + +
    +
    + + +
    +

    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)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    duration + + +number + + + + + + <optional>
    + + + + + +
    + + 250 + +

    The duration below which the key is considered as being just pressed.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the key is just pressed otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justPressed(duration) → {boolean}

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    duration + + +number + + + + + + <optional>
    + + + + + +
    + + 250 + +

    The duration below which the key is considered as being just released.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the key is just released otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    <protected> processKeyDown()

    + + +
    +
    + + +
    +

    Called automatically by Phaser.Keyboard.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event. + + +KeyboardEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    <protected> processKeyUp()

    + + +
    +
    + + +
    +

    Called automatically by Phaser.Keyboard.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event. + + +KeyboardEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Keyboard.html b/Docs/out/Phaser.Keyboard.html new file mode 100644 index 00000000..85c4a6e6 --- /dev/null +++ b/Docs/out/Phaser.Keyboard.html @@ -0,0 +1,2694 @@ + + + + + + Phaser Class: Keyboard + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Keyboard

    +
    + +
    +

    + Keyboard +

    + +

    A Keyboard object Description.

    + +
    + +
    +
    + + + + +
    +

    new Keyboard(game)

    + + +
    +
    + + +
    +

    Phaser - Keyboard constructor.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    callbackContext

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callbackContext + + +Object + + + +

    The context under which the callbacks are run.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    disabled

    + + +
    +
    + +
    +

    You can disable all Keyboard Input by setting disabled to true. While true all new input related events will be ignored.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    disabled + + +boolean + + + +

    The disabled state of the Keyboard.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onDownCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onDownCallback + + +function + + + +

    This callback is invoked every time a key is pressed down.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onUpCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onUpCallback + + +function + + + +

    This callback is invoked every time a key is released.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    addCallbacks(context, onDown, onUp)

    + + +
    +
    + + +
    +

    Add callbacks to the Keyboard handler so that each time a key is pressed down or releases the callbacks are activated.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    context + + +Object + + + + + + + + + + + +

    The context under which the callbacks are run.

    onDown + + +function + + + + + + + + + + + +

    This callback is invoked every time a key is pressed down.

    onUp + + +function + + + + + + <optional>
    + + + + + +
    + + null + +

    This callback is invoked every time a key is released.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addKey(keycode) → {Phaser.Key}

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    keycode + + +number + + + +

    The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The Key object which you can store locally and reference directly.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Key + + +
    +
    + + + + + +
    + + + +
    +

    addKeyCapture(keycode)

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    keycode + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    clearCaptures()

    + + +
    +
    + + +
    +

    Clear all set key captures.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    isDown(keycode) → {boolean}

    + + +
    +
    + + +
    +

    Returns true of the key is currently pressed down. Note that it can only detect key presses on the web browser.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    keycode + + +number + + + +

    The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the key is currently down.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justPressed(keycode, duration) → {boolean}

    + + +
    +
    + + +
    +

    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)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    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 pressed.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the key is just pressed otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justPressed(keycode, duration) → {boolean}

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the key is just released otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    <protected> processKeyDown(event)

    + + +
    +
    + + +
    +

    Process the keydown event.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +KeyboardEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    <protected> processKeyUp(event)

    + + +
    +
    + + +
    +

    Process the keyup event.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +KeyboardEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeKey(keycode)

    + + +
    +
    + + +
    +

    Removes a Key object from the Keyboard manager.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    keycode + + +number + + + +

    The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeKeyCapture(keycode)

    + + +
    +
    + + +
    +

    Removes an existing key capture.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    keycode + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reset()

    + + +
    +
    + + +
    +

    Reset the "isDown" state of all keys.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start()

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stop()

    + + +
    +
    + + +
    +

    Stops the Keyboard event listeners from running (keydown and keyup). They are removed from the document.body.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.LinkedList.html b/Docs/out/Phaser.LinkedList.html index 863a2142..0d8ac21c 100644 --- a/Docs/out/Phaser.LinkedList.html +++ b/Docs/out/Phaser.LinkedList.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Parser

    +
    + +
    +

    + .Loader. + + Parser +

    + +
    + +
    +
    + + + + +
    +

    new Parser()

    + + +
    +
    + + +
    +

    Phaser.Loader.Parser parses data objects from Phaser.Loader that need more preparation before they can be inserted into the Cache.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + +

    Methods

    + +
    + +
    +

    <static> bitmapFont(xml) → {FrameData}

    + + +
    +
    + + +
    +

    Parse frame data from an XML file.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    xml + + +object + + + +

    XML data you want to parse.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    Generated FrameData object.

    +
    + + + +
    +
    + Type +
    +
    + +FrameData + + +
    +
    + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Loader.html b/Docs/out/Phaser.Loader.html new file mode 100644 index 00000000..63069479 --- /dev/null +++ b/Docs/out/Phaser.Loader.html @@ -0,0 +1,5331 @@ + + + + + + Phaser Class: Loader + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Loader

    +
    + +
    +

    + Loader +

    + +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + +

    Classes

    + +
    +
    Parser
    +
    +
    + + + + + +

    Members

    + +
    + +
    +

    <static, constant> TEXTURE_ATLAS_JSON_ARRAY :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXTURE_ATLAS_JSON_HASH :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXTURE_ATLAS_XML_STARLING :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    baseURL

    + + +
    +
    + +
    +

    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!

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    baseURL + + +string + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    crossOrigin

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    crossOrigin + + +string + + + +

    The crossOrigin value applied to loaded images

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    hasLoaded

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    hasLoaded + + +boolean + + + +

    True if all assets in the queue have finished loading.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isLoading

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isLoading + + +boolean + + + +

    True if the Loader is in the process of loading the queue.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onFileComplete

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onFileComplete + + +Phaser.Signal + + + +

    Event signal.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onFileError

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onFileError + + +Phaser.Signal + + + +

    Event signal.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onLoadComplete

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onLoadComplete + + +Phaser.Signal + + + +

    Event signal.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    onLoadStart

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    onLoadStart + + +Phaser.Signal + + + +

    Event signal.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    preloadSprite

    + + +
    +
    + +
    +

    You can optionally link a sprite to the preloader. +If you do so the Sprite's width or height will be cropped based on the percentage loaded.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    preloadSprite + + +Description + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    progress

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    progress + + +number + + + +

    The Load progress percentage value (from 0 to 100)

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    queueSize

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    TypeDescription
    + + +number + + + +

    Length of assets queue.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    <protected> addToFileList(type, key, url, properties)

    + + +
    +
    + + +
    +

    Internal function that adds a new entry to the file list. Do not call directly.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +Description + + + +

    Description.

    key + + +string + + + +

    Description.

    url + + +string + + + +

    URL of Description.

    properties + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    atlas(key, textureURL, atlasURL, atlasData, format)

    + + +
    +
    + + +
    +

    Add a new texture atlas to the loader.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    key + + +string + + + + + + + + + +

    Unique asset key of the texture atlas file.

    textureURL + + +string + + + + + + + + + +

    The url of the texture atlas image file.

    atlasURL + + +string + + + + + + <optional>
    + + + + + +

    The url of the texture atlas data file (json/xml). You don't need this if you are passing an atlasData object instead.

    atlasData + + +object + + + + + + <optional>
    + + + + + +

    A JSON or XML data object. You don't need this if the data is being loaded from a URL.

    format + + +number + + + + + + <optional>
    + + + + + +

    A value describing the format of the data, the default is Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    atlasJSONArray(key, atlasURL, atlasData)

    + + +
    +
    + + +
    +

    Add a new texture atlas to the loader. This atlas uses the JSON Array data format.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of the bitmap font.

    atlasURL + + +Description + + + +

    The url of the Description.

    atlasData + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    atlasJSONHash(key, atlasURL, atlasData)

    + + +
    +
    + + +
    +

    Add a new texture atlas to the loader. This atlas uses the JSON Hash data format.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of the bitmap font.

    atlasURL + + +Description + + + +

    The url of the Description.

    atlasData + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    atlasXML(key, atlasURL, atlasData)

    + + +
    +
    + + +
    +

    Add a new texture atlas to the loader. This atlas uses the Starling XML data format.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of the bitmap font.

    atlasURL + + +Description + + + +

    The url of the Description.

    atlasData + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    audio(key, urls, autoDecode)

    + + +
    +
    + + +
    +

    Add a new audio file to the loader.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of the audio file.

    urls + + +Array + + + +

    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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    bitmapFont(key, textureURL, xmlURL, xmlData)

    + + +
    +
    + + +
    +

    Add a new bitmap font loading request.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    key + + +string + + + + + + + + + +

    Unique asset key of the bitmap font.

    textureURL + + +string + + + + + + + + + +

    The url of the font image file.

    xmlURL + + +string + + + + + + <optional>
    + + + + + +

    The url of the font data file (xml/fnt)

    xmlData + + +object + + + + + + <optional>
    + + + + + +

    An optional XML data object.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    checkKeyExists(key) → {boolean}

    + + +
    +
    + + +
    +

    Check whether asset exists with a specific key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to check.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    Return true if exists, otherwise return false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    csvLoadComplete(key)

    + + +
    +
    + + +
    +

    Successfully loaded a CSV file.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the loaded CSV file.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    dataLoadError(key)

    + + +
    +
    + + +
    +

    Error occured when load a JSON.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the error loading JSON file.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    fileComplete(key)

    + + +
    +
    + + +
    +

    Called when a file is successfully loaded.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the successfully loaded file.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    fileError(key)

    + + +
    +
    + + +
    +

    Error occured when load a file.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the error loading file.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    image(key, url, overwrite)

    + + +
    +
    + + +
    +

    Add an image to the Loader.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of this image file.

    url + + +string + + + +

    URL of image file.

    overwrite + + +boolean + + + +

    If an entry with a matching key already exists this will over-write it

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    jsonLoadComplete(key)

    + + +
    +
    + + +
    +

    Successfully loaded a JSON file.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the loaded JSON file.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeAll()

    + + +
    +
    + + +
    +

    Remove all file loading requests.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeFile(key)

    + + +
    +
    + + +
    +

    Remove loading request of a file.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the file you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reset()

    + + +
    +
    + + +
    +

    Reset loader, this will remove all loaded assets.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    setPreloadSprite(sprite, direction)

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    spritesheet(key, url, frameWidth, frameHeight, frameMax)

    + + +
    +
    + + +
    +

    Add a new sprite sheet to the loader.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of the sheet file.

    url + + +string + + + +

    URL of the sheet file.

    frameWidth + + +number + + + +

    Width of each single frame.

    frameHeight + + +number + + + +

    Height of each single frame.

    frameMax + + +number + + + +

    How many frames in this sprite sheet.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start()

    + + +
    +
    + + +
    +

    Start loading the assets. Normally you don't need to call this yourself as the StateManager will do so.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    text(key, url, overwrite)

    + + +
    +
    + + +
    +

    Add a text file to the Loader.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Unique asset key of the text file.

    url + + +string + + + +

    URL of the text file.

    overwrite + + +boolean + + + +

    True if Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    tilemap(key, tilesetURL, mapDataURL, mapData, format)

    + + +
    +
    + + +
    +

    Add a new tilemap loading request.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    key + + +string + + + + + + + + + +

    Unique asset key of the tilemap data.

    tilesetURL + + +string + + + + + + + + + +

    The url of the tile set image file.

    mapDataURL + + +string + + + + + + <optional>
    + + + + + +

    The url of the map data file (csv/json)

    mapData + + +object + + + + + + <optional>
    + + + + + +

    An optional JSON data object (can be given in place of a URL).

    format + + +string + + + + + + <optional>
    + + + + + +

    The format of the map data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    xmlLoadComplete(key)

    + + +
    +
    + + +
    +

    Successfully loaded an XML file.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the loaded XML file.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:49 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.MSPointer.html b/Docs/out/Phaser.MSPointer.html new file mode 100644 index 00000000..81647a65 --- /dev/null +++ b/Docs/out/Phaser.MSPointer.html @@ -0,0 +1,1543 @@ + + + + + + Phaser Class: MSPointer + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: MSPointer

    +
    + +
    +

    + MSPointer +

    + +

    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

    + +
    + +
    +
    + + + + +
    +

    new MSPointer(game)

    + + +
    +
    + + +
    +

    Phaser - MSPointer constructor.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    callbackContext

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callbackContext + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    disabled

    + + +
    +
    + +
    +

    You can disable all Input by setting disabled = true. While set all new input related events will be ignored.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    disabled + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    mouseDownCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    mouseDownCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    mouseMoveCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    mouseMoveCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    mouseUpCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    mouseUpCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    onPointerDown(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onPointerMove(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onPointerUp(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start()

    + + +
    +
    + + +
    +

    Starts the event listeners running.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stop()

    + + +
    +
    + + +
    +

    Stop the event listeners.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Math.html b/Docs/out/Phaser.Math.html new file mode 100644 index 00000000..c61098b5 --- /dev/null +++ b/Docs/out/Phaser.Math.html @@ -0,0 +1,9822 @@ + + + + + + Phaser Class: Math + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Math

    +
    + +
    +

    + Math +

    + +
    + +
    +
    + + + + +
    +

    new Math()

    + + +
    +
    + + +
    +

    A collection of mathematical methods.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + +

    Methods

    + +
    + +
    +

    angleBetween(x1, y1, x2, y2) → {number}

    + + +
    +
    + + +
    +

    Find the angle of a segment from (x1, y1) -> (x2, y2 ).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x1 + + +number + + + +
    y1 + + +number + + + +
    x2 + + +number + + + +
    y2 + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    angleLimit(angle, min, max) → {number}

    + + +
    +
    + + +
    +

    Keeps an angle value between the given min and max values.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    The angle value to check. Must be between -180 and +180.

    min + + +number + + + +

    The minimum angle that is allowed (must be -180 or greater).

    max + + +number + + + +

    The maximum angle that is allowed (must be 180 or less).

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The new angle value, returns the same as the input angle if it was within bounds

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    average() → {number}

    + + +
    +
    + + +
    +

    Averages all values passed to the function and returns the result. You can pass as many parameters as you like.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The average of all given values.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    bernstein(n, i) → {number}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +number + + + +
    i + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    bezierInterpolation(v, k) → {number}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    v + + +number + + + +
    k + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    catmullRom(p0, p1, p2, p3, t) → {number}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    p0 + + +number + + + +
    p1 + + +number + + + +
    p2 + + +number + + + +
    p3 + + +number + + + +
    t + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    catmullRomInterpolation(v, k) → {number}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    v + + +number + + + +
    k + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    ceil(value) → {number}

    + + +
    +
    + + +
    +

    Round up to the next whole number. E.g. ceil(1.3) == 2, and ceil(-2.3) == -3.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    value + + +number + + + +

    Any number.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The rounded value of that number.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    ceilTo(value, place, base) → {number}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    chanceRoll(chance) → {boolean}

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    chance + + +number + + + +

    The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the roll passed, or false otherwise.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    clamp(x, a, b) → {number}

    + + +
    +
    + + +
    +

    Force a value within the boundaries of two values. +Clamp value to range <a, b>

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    a + + +number + + + +
    b + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    clampBottom(x, a) → {number}

    + + +
    +
    + + +
    +

    Clamp value to range <a, inf).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    a + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    degToRad() → {function}

    + + +
    +
    + + +
    +

    Convert degrees to radians.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +function + + +
    +
    + + + + + +
    + + + +
    +

    difference(a, b) → {number}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a + + +number + + + +
    b + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    distance(x1, y1, x2, y2) → {number}

    + + +
    +
    + + +
    +

    Returns the distance between the two given set of coordinates.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x1 + + +number + + + +
    y1 + + +number + + + +
    x2 + + +number + + + +
    y2 + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The distance between this Point object and the destination Point object.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    distanceRounded(x1, y1, x2, y2) → {number}

    + + +
    +
    + + +
    +

    Returns the rounded distance between the two given set of coordinates.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x1 + + +number + + + +
    y1 + + +number + + + +
    x2 + + +number + + + +
    y2 + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The distance between this Point object and the destination Point object.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    floor(Value) → {number}

    + + +
    +
    + + +
    +

    Round down to the next whole number. E.g. floor(1.7) == 1, and floor(-2.7) == -2.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    Value + + +number + + + +

    Any number.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The rounded value of that number.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    floorTo(value, place, base) → {number}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    fuzzyCeil(val, epsilon) → {boolean}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    val + + +number + + + +
    epsilon + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    ceiling(val-ε)

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    fuzzyEqual(a, b, epsilon) → {boolean}

    + + +
    +
    + + +
    +

    Two number are fuzzyEqual if their difference is less than ε.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a + + +number + + + +
    b + + +number + + + +
    epsilon + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if |a-b|<ε

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    fuzzyEqual(a, b, epsilon) → {boolean}

    + + +
    +
    + + +
    +

    a is fuzzyLessThan b if it is less than b + ε.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a + + +number + + + +
    b + + +number + + + +
    epsilon + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if a<b+ε

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    fuzzyFloor(val, epsilon) → {boolean}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    val + + +number + + + +
    epsilon + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    floor(val-ε)

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    fuzzyGreaterThan(a, b, epsilon) → {boolean}

    + + +
    +
    + + +
    +

    a is fuzzyGreaterThan b if it is more than b - ε.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a + + +number + + + +
    b + + +number + + + +
    epsilon + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if a>b+ε

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    getRandom(objects, startIndex, length) → {object}

    + + +
    +
    + + +
    +

    Fetch a random entry from the given array. +Will return null if random selection is missing, or array has no entries.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    objects + + +array + + + +

    An array of objects.

    startIndex + + +number + + + +

    Optional offset off the front of the array. Default value is 0, or the beginning of the array.

    length + + +number + + + +

    Optional restriction on the number of values you want to randomly select from.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The random object that was selected.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + + +
    + + + +
    +

    interpolateAngles(a1, a2, weight, radians, ease) → {number}

    + + +
    +
    + + +
    +

    Interpolate across the shortest arc between two angles.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a1 + + +number + + + +

    Description.

    a2 + + +number + + + +

    Description.

    weight + + +number + + + +

    Description.

    radians + + +boolean + + + +

    True if angle sizes are expressed in radians.

    ease + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    interpolateFloat(a, b, weight) → {number}

    + + +
    +
    + + +
    +

    A one dimensional linear interpolation of a value.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a + + +number + + + +
    b + + +number + + + +
    weight + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    isEven(n) → {boolean}

    + + +
    +
    + + +
    +

    Returns true if the number given is even.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +number + + + +

    The number to check.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the given number is even. False if the given number is odd.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    isOdd(n) → {boolean}

    + + +
    +
    + + +
    +

    Returns true if the number given is odd.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +number + + + +

    The number to check.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    True if the given number is odd. False if the given number is even.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    Linear(p0, p1, t) → {number}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    p0 + + +number + + + +
    p1 + + +number + + + +
    t + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    linearInterpolation(v, k) → {number}

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    v + + +number + + + +
    k + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    mapLinear(x, a1, a1, a2, b1, b2) → {number}

    + + +
    +
    + + +
    +

    Linear mapping from range <a1, a2> to range <b1, b2>

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    a1 + + +number + + + +
    a1 + + +number + + + +
    a2 + + +number + + + +
    b1 + + +number + + + +
    b2 + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    max() → {number}

    + + +
    +
    + + +
    +

    Significantly faster version of Math.max +See http://jsperf.com/math-s-min-max-vs-homemade/5

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The highest value from those given.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    maxAdd(value, amount, max-) → {number}

    + + +
    +
    + + +
    +

    Adds the given amount to the value, but never lets the value go over the specified maximum.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    value + + +number + + + +

    The value to add the amount to.

    amount + + +number + + + +

    The amount to add to the value.

    max- + + +number + + + +

    The maximum the value is allowed to be.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    min() → {number}

    + + +
    +
    + + +
    +

    Significantly faster version of Math.min +See http://jsperf.com/math-s-min-max-vs-homemade/5

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The lowest value from those given.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    minSub(value, amount, min) → {number}

    + + +
    +
    + + +
    +

    Subtracts the given amount from the value, but never lets the value go below the specified minimum.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    value + + +number + + + +

    The base value.

    amount + + +number + + + +

    The amount to subtract from the base value.

    min + + +number + + + +

    The minimum the value is allowed to be.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The new value.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    nearestAngleBetween(a1, a2, radians) → {number}

    + + +
    +
    + + +
    +

    Closest angle between two angles from a1 to a2 +absolute value the return for exact angle

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a1 + + +number + + + +
    a2 + + +number + + + +
    radians + + +boolean + + + +

    True if angle sizes are expressed in radians.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    normalizeAngle(angle, radians) → {number}

    + + +
    +
    + + +
    +

    Set an angle within the bounds of -π toπ.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +
    radians + + +boolean + + + +

    True if angle size is expressed in radians.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    numberArray(min, max) → {array}

    + + +
    +
    + + +
    +

    Returns an Array containing the numbers from min to max (inclusive).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    min + + +number + + + +

    The minimum value the array starts with.

    max + + +number + + + +

    The maximum value the array contains.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The array of number values.

    +
    + + + +
    +
    + Type +
    +
    + +array + + +
    +
    + + + + + +
    + + + +
    +

    PI2()

    + + +
    +
    + + +
    +

    = 2 π

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    radToDeg() → {function}

    + + +
    +
    + + +
    +

    Convert degrees to radians.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +function + + +
    +
    + + + + + +
    + + + +
    +

    randomSign() → {number}

    + + +
    +
    + + +
    +

    Randomly returns either a 1 or -1.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    1 or -1

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    roundTo(value, place, base) → {number}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    shear(n) → {number}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    n mod 1

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    shift(stack) → {any}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    stack + + +array + + + +

    The array to shift.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The shifted value.

    +
    + + + +
    +
    + Type +
    +
    + +any + + +
    +
    + + + + + +
    + + + +
    +

    shuffleArray(array) → {array}

    + + +
    +
    + + +
    +

    Shuffles the data in the given array into a new order

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    array + + +array + + + +

    The array to shuffle

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The array

    +
    + + + +
    +
    + Type +
    +
    + +array + + +
    +
    + + + + + +
    + + + +
    +

    sign(x) → {number}

    + + +
    +
    + + +
    +

    A value representing the sign of the value. +-1 for negative, +1 for positive, 0 if value is 0

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    sinCosGenerator(length, sinAmplitude, cosAmplitude, frequency) → {Array}

    + + +
    +
    + + +
    +

    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:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    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

    frequency + + +number + + + +

    The frequency of the sine and cosine table data

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    Returns the sine table

    +
    + + + +
    +
    + Type +
    +
    + +Array + + +
    +
    + + + + + +
    + + + +
    +

    smootherstep(x, min, max) → {number}

    + + +
    +
    + + +
    +

    Smootherstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    min + + +number + + + +
    max + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    smoothstep(x, min, max) → {number}

    + + +
    +
    + + +
    +

    Smoothstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    min + + +number + + + +
    max + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    snapTo(input, gap, start) → {number}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    input + + +number + + + + + + + + + +

    The value to snap.

    gap + + +number + + + + + + + + + +

    The interval gap of the grid.

    start + + +number + + + + + + <optional>
    + + + + + +

    Optional starting offset for gap.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    snapToCeil(input, gap, start) → {number}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    input + + +number + + + + + + + + + +

    The value to snap.

    gap + + +number + + + + + + + + + +

    The interval gap of the grid.

    start + + +number + + + + + + <optional>
    + + + + + +

    Optional starting offset for gap.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    snapToFloor(input, gap, start) → {number}

    + + +
    +
    + + +
    +

    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

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    input + + +number + + + + + + + + + +

    The value to snap.

    gap + + +number + + + + + + + + + +

    The interval gap of the grid.

    start + + +number + + + + + + <optional>
    + + + + + +

    Optional starting offset for gap.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    snapToInArray(input, arr, sort) → {number}

    + + +
    +
    + + +
    +

    Snaps a value to the nearest value in an array.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +number + + + +
    arr + + +array + + + +
    sort + + +boolean + + + +

    True if the array needs to be sorted.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    truncate(n) → {number}

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    wrap(value, min, max) → {number}

    + + +
    +
    + + +
    +

    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>

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    value + +

    The value to wrap

    min + +

    The minimum the value is allowed to be

    max + +

    The maximum the value is allowed to be

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The wrapped value

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    wrapAngle(angle) → {number}

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    The angle value to check

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The new angle value, returns the same as the input angle if it was within bounds.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    wrapValue(value, amount, max) → {number}

    + + +
    +
    + + +
    +

    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>

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    value + + +number + + + +

    The value to add the amount to.

    amount + + +number + + + +

    The amount to add to the value.

    max + + +number + + + +

    The maximum the value is allowed to be.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The wrapped value.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Mouse.html b/Docs/out/Phaser.Mouse.html new file mode 100644 index 00000000..5cb5eea9 --- /dev/null +++ b/Docs/out/Phaser.Mouse.html @@ -0,0 +1,2089 @@ + + + + + + Phaser Class: Mouse + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Mouse

    +
    + +
    +

    + Mouse +

    + +

    The Mouse class

    + +
    + +
    +
    + + + + +
    +

    new Mouse(game)

    + + +
    +
    + + +
    +

    Phaser - Mouse constructor.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    <static, constant> LEFT_BUTTON :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> MIDDLE_BUTTON :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> RIGHT_BUTTON :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    callbackContext

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callbackContext + + +Object + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    disabled

    + + +
    +
    + +
    +

    You can disable all Input by setting disabled = true. While set all new input related events will be ignored.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    disabled + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    locked

    + + +
    +
    + +
    +

    If the mouse has been Pointer Locked successfully this will be set to true.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    locked + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    mouseDownCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    mouseDownCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    mouseMoveCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    mouseMoveCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    mouseUpCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    mouseUpCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    onMouseDown(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +MouseEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onMouseMove(event)

    + + +
    +
    + + +
    +

    Description

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +MouseEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onMouseUp(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +MouseEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    pointerLockChange(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +MouseEvent + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    releasePointerLock()

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    requestPointerLock()

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start()

    + + +
    +
    + + +
    +

    Starts the event listeners running.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stop()

    + + +
    +
    + + +
    +

    Stop the event listeners.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Plugin.html b/Docs/out/Phaser.Plugin.html index 191b741c..b1ecd805 100644 --- a/Docs/out/Phaser.Plugin.html +++ b/Docs/out/Phaser.Plugin.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: PluginManager

    +
    + +
    +

    + PluginManager +

    + +

    Phaser - PluginManager

    + +
    + +
    +
    + + + + +
    +

    new PluginManager(game, parent)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    parent + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    plugins

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    plugins + + +array + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    add(plugin) → {Phaser.Plugin}

    + + +
    +
    + + +
    +

    Add a new Plugin to the PluginManager. +The plugin's game and parent reference are set to this game and pluginmanager parent.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    plugin + + +Phaser.Plugin + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    Description.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Plugin + + +
    +
    + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Clear down this PluginManager and null out references

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    postRender()

    + + +
    +
    + + +
    +

    Post-render is called after the Game Renderer and State.render have run. +It only calls plugins who have visible=true.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    remove(plugin)

    + + +
    +
    + + +
    +

    Remove a Plugin from the PluginManager.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    plugin + + +Phaser.Plugin + + + +

    The plugin to be removed.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    render()

    + + +
    +
    + + +
    +

    Render is called right after the Game Renderer completes, but before the State.render. +It only calls plugins who have visible=true.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    update()

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Point.html b/Docs/out/Phaser.Point.html index 03902aac..45ed2892 100644 --- a/Docs/out/Phaser.Point.html +++ b/Docs/out/Phaser.Point.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -4725,7 +4773,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 15:04:50 GMT+0100 (BST) using the DocStrap template. diff --git a/Docs/out/Phaser.Pointer.html b/Docs/out/Phaser.Pointer.html new file mode 100644 index 00000000..4a42eac4 --- /dev/null +++ b/Docs/out/Phaser.Pointer.html @@ -0,0 +1,4663 @@ + + + + + + Phaser Class: Pointer + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Pointer

    +
    + +
    +

    + Pointer +

    + +

    A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen.

    + +
    + +
    +
    + + + + +
    +

    new Pointer(game, id)

    + + +
    +
    + + +
    +

    Phaser - Pointer constructor.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    id + + +Description + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    active

    + + +
    +
    + +
    +

    Description.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isDown + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    circle

    + + +
    +
    + +
    +

    A Circle object centered on the x/y screen coordinates of the Pointer. +Default size of 44px (Apple's recommended "finger tip" size).

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    circle + + +Circle + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    circle

    + + +
    +
    + +
    +

    Description

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    circle + + +Phaser.Circle + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    clientX

    + + +
    +
    + +
    +

    The horizontal coordinate of point relative to the viewport in pixels, excluding any scroll offset.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    clientX + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    clientY

    + + +
    +
    + +
    +

    The vertical coordinate of point relative to the viewport in pixels, excluding any scroll offset.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    clientY + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> duration

    + + +
    +
    + +
    +

    How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    duration + + +number + + + +

    How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    id

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    id + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isDown

    + + +
    +
    + +
    +

    If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isDown + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isMouse :boolean

    + + +
    +
    + +
    +

    If the Pointer is a mouse this is true, otherwise false.

    +
    + + + +
    Type:
    +
      +
    • + +boolean + + +
    • +
    + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isMouse + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    isUp

    + + +
    +
    + +
    +

    If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    isUp + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    msSinceLastClick

    + + +
    +
    + +
    +

    The number of miliseconds since the last click.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    msSinceLastClick + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    pageX

    + + +
    +
    + +
    +

    The horizontal coordinate of point relative to the viewport in pixels, including any scroll offset.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pageX + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    pageY

    + + +
    +
    + +
    +

    The vertical coordinate of point relative to the viewport in pixels, including any scroll offset.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pageY + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    position

    + + +
    +
    + +
    +

    A Vector object containing the current position of the Pointer on the screen.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    position + + +Vec2 + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    position

    + + +
    +
    + +
    +

    Description

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    position + + +Phaser.Point + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    positionDown

    + + +
    +
    + +
    +

    A Vector object containing the initial position when the Pointer was engaged with the screen.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    positionDown + + +Vec2 + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    positionDown

    + + +
    +
    + +
    +

    Description

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    positionDown + + +Phaser.Point + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    previousTapTime

    + + +
    +
    + +
    +

    A timestamp representing when the Pointer was last tapped or clicked.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    previousTapTime + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    screenX

    + + +
    +
    + +
    +

    The horizontal coordinate of point relative to the screen in pixels.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    screenX + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    screenY

    + + +
    +
    + +
    +

    The vertical coordinate of point relative to the screen in pixels.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    screenY + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    targetObject

    + + +
    +
    + +
    +

    The Game Object this Pointer is currently over / touching / dragging.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    targetObject + + +Any + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    timeDown

    + + +
    +
    + +
    +

    A timestamp representing when the Pointer first touched the touchscreen.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    timeDown + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    timeUp

    + + +
    +
    + +
    +

    A timestamp representing when the Pointer left the touchscreen.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    timeUp + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    totalTouches

    + + +
    +
    + +
    +

    The total number of times this Pointer has been touched to the touchscreen.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    totalTouches + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    withinGame

    + + +
    +
    + +
    +

    Description.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    withinGame + + +boolean + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> worldX

    + + +
    +
    + +
    +

    Gets the X value of this Pointer in world coordinates based on the world camera.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    duration + + +number + + + +

    The X value of this Pointer in world coordinates based on the world camera.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> worldY

    + + +
    +
    + +
    +

    Gets the Y value of this Pointer in world coordinates based on the world camera.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    duration + + +number + + + +

    The Y value of this Pointer in world coordinates based on the world camera.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    x

    + + +
    +
    + +
    +

    The horizontal coordinate of point relative to the game element. This value is automatically scaled based on game size.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    y

    + + +
    +
    + +
    +

    The vertical coordinate of point relative to the game element. This value is automatically scaled based on game size.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    y + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    justPressed(duration) → {boolean}

    + + +
    +
    + + +
    +

    The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    duration + + +number + + + + + + <optional>
    + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    justReleased(duration) → {boolean}

    + + +
    +
    + + +
    +

    The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    duration + + +number + + + + + + <optional>
    + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    leave(event)

    + + +
    +
    + + +
    +

    Called when the Pointer leaves the target area.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    move(event)

    + + +
    +
    + + +
    +

    Called when the Pointer is moved

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reset()

    + + +
    +
    + + +
    +

    Resets the Pointer properties. Called by InputManager.reset when you perform a State change.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start(event)

    + + +
    +
    + + +
    +

    Called when the Pointer is pressed onto the touchscreen.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stop(event)

    + + +
    +
    + + +
    +

    Called when the Pointer leaves the touchscreen.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    toString() → {string}

    + + +
    +
    + + +
    +

    Returns a string representation of this object.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A string representation of the instance.

    +
    + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + +
    + + + +
    +

    update()

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.QuadTree.html b/Docs/out/Phaser.QuadTree.html new file mode 100644 index 00000000..790dd9b1 --- /dev/null +++ b/Docs/out/Phaser.QuadTree.html @@ -0,0 +1,1129 @@ + + + + + + Phaser Class: QuadTree + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: QuadTree

    +
    + +
    +

    + QuadTree +

    + +

    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)

    + + +
    +
    + + +
    +

    QuadTree Constructor

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    physicsManager + + +Description + + + +

    Description.

    x + + +Description + + + +

    Description.

    y + + +Description + + + +

    Description.

    width + + +number + + + +

    The width of your game in game pixels.

    height + + +number + + + +

    The height of your game in game pixels.

    maxObjects + + +number + + + +

    Description.

    maxLevels + + +number + + + +

    Description.

    level + + +number + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + +

    Methods

    + +
    + +
    +

    clear()

    + + +
    +
    + + +
    +

    /* +Clear the quadtree.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getIndex(rect) → {number}

    + + +
    +
    + + +
    +

    /* +Determine which node the object belongs to.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +object + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    index - Index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    insert(body)

    + + +
    +
    + + +
    +

    /* +Insert the object into the node. If the node +exceeds the capacity, it will split and add all +objects to their corresponding subnodes.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    body + + +object + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    retrieve(rect) → {array}

    + + +
    +
    + + +
    +

    /* +Return all objects that could collide with the given object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +object + + + +

    Description.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +
      +
    • Array with all detected objects.
    • +
    +
    + + + +
    +
    + Type +
    +
    + +array + + +
    +
    + + + + + +
    + + + +
    +

    split()

    + + +
    +
    + + +
    +

    /* +Split the node into 4 subnodes

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.RandomDataGenerator.html b/Docs/out/Phaser.RandomDataGenerator.html new file mode 100644 index 00000000..78a59b50 --- /dev/null +++ b/Docs/out/Phaser.RandomDataGenerator.html @@ -0,0 +1,1822 @@ + + + + + + Phaser Class: RandomDataGenerator + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: RandomDataGenerator

    +
    + +
    +

    + RandomDataGenerator +

    + +

    An extremely useful repeatable random data generator. Access it via Phaser.Game.rnd +Based on Nonsense by Josh Faul https://github.com/jocafa/Nonsense. +Random number generator from http://baagoe.org/en/wiki/Better_random_numbers_for_javascript

    + +
    + +
    +
    + + + + +
    +

    new RandomDataGenerator(seeds)

    + + +
    +
    + + +
    +

    Phaser.RandomDataGenerator constructor.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    seeds + + +array + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + +

    Methods

    + +
    + +
    +

    angle() → {number}

    + + +
    +
    + + +
    +

    Returns a random angle between -180 and 180.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    frac() → {number}

    + + +
    +
    + + +
    +

    Returns a random real number between 0 and 1.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    integer() → {number}

    + + +
    +
    + + +
    +

    Returns a random integer between 0 and 2^32.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    integerInRange(min, max) → {number}

    + + +
    +
    + + +
    +

    Returns a random integer between min and max.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    min + + +number + + + +
    max + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    normal() → {number}

    + + +
    +
    + + +
    +

    Returns a random real number between -1 and 1.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    pick(ary) → {number}

    + + +
    +
    + + +
    +

    Returns a random member of array.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    ary + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    real() → {number}

    + + +
    +
    + + +
    +

    Returns a random real number between 0 and 2^32.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    realInRange(min, max) → {number}

    + + +
    +
    + + +
    +

    Returns a random real number between min and max.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    min + + +number + + + +
    max + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    sow(seeds)

    + + +
    +
    + + +
    +

    Reset the seed of the random data generator.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    seeds + + +array + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    timestamp(min, max) → {number}

    + + +
    +
    + + +
    +

    Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    min + + +number + + + +
    max + + +number + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    uuid() → {string}

    + + +
    +
    + + +
    +

    Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + +
    + + + +
    +

    weightedPick(ary) → {number}

    + + +
    +
    + + +
    +

    Returns a random member of array, favoring the earlier entries.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    ary + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:50 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.Rectangle.html b/Docs/out/Phaser.Rectangle.html index 46b8f57d..86a9e11e 100644 --- a/Docs/out/Phaser.Rectangle.html +++ b/Docs/out/Phaser.Rectangle.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -2022,7 +2070,7 @@ already dispatched before.

    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.Stage.html b/Docs/out/Phaser.Stage.html index 636582f3..8a50f790 100644 --- a/Docs/out/Phaser.Stage.html +++ b/Docs/out/Phaser.Stage.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -3159,7 +3207,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 15:04:51 GMT+0100 (BST) using the DocStrap template. diff --git a/Docs/out/Phaser.Touch.html b/Docs/out/Phaser.Touch.html new file mode 100644 index 00000000..dac11cc5 --- /dev/null +++ b/Docs/out/Phaser.Touch.html @@ -0,0 +1,2369 @@ + + + + + + Phaser Class: Touch + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Touch

    +
    + +
    +

    + Touch +

    + +

    The Touch class handles touch interactions with the game and the resulting Pointer objects.

    + +
    + +
    +
    + + + + +
    +

    new Touch(game)

    + + +
    +
    + + +
    +

    Phaser.Touch handles touch events with your game. Note: Android 2.x only supports 1 touch event at once, no multi-touch.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    callbackContext

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callbackContext + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    Local reference to game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    preventDefault

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    preventDefault + + +boolean + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    touchCancelCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    touchCancelCallback + + +Description + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    touchEndCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    touchEndCallback + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    touchEnterCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    touchEnterCallback + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    touchLeaveCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    touchLeaveCallback + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    touchMoveCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    touchMoveCallback + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    touchStartCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    touchStartCallback + + +Phaser.Game + + + +

    Description.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    consumeTouchMove()

    + + +
    +
    + + +
    +

    Consumes all touchmove events on the document (only enable this if you know you need it!).

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    disabled() → {boolean}

    + + +
    +
    + + +
    +

    You can disable all Input by setting disabled = true. While set all new input related events will be ignored.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + + + +
    +

    onTouchCancel(event)

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onTouchEnd(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onTouchEnter(event)

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onTouchLeave(event)

    + + +
    +
    + + +
    +

    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.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onTouchMove(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    onTouchStart(event)

    + + +
    +
    + + +
    +

    Description.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    event + + +Any + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    start()

    + + +
    +
    + + +
    +

    Starts the event listeners running.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    stop()

    + + +
    +
    + + +
    +

    Stop the event listeners.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:51 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Docs/out/Phaser.World.html b/Docs/out/Phaser.World.html index 020bb9f1..eeaae839 100644 --- a/Docs/out/Phaser.World.html +++ b/Docs/out/Phaser.World.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -213,7 +261,7 @@ PIXI.InteractionManager = function (dummy) { 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/Plugin.js.html b/Docs/out/Plugin.js.html index 032662d5..11600412 100644 --- a/Docs/out/Plugin.js.html +++ b/Docs/out/Plugin.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - Input -
  • -
  • LinkedList
  • @@ -122,6 +118,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -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 -
  • - Input -
  • -
  • LinkedList
  • @@ -122,6 +118,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -253,7 +253,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.js.html b/Docs/out/PluginManager.js.html index e8a5418e..347f0f6b 100644 --- a/Docs/out/PluginManager.js.html +++ b/Docs/out/PluginManager.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -155,14 +203,13 @@ * @author Richard Davey <rich@photonstorm.com> * @copyright 2013 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} -* @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. @@ -405,7 +452,7 @@ Phaser.PluginManager.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/Point.js.html b/Docs/out/Point.js.html index cdf3f1bd..df77bb88 100644 --- a/Docs/out/Point.js.html +++ b/Docs/out/Point.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -567,7 +615,7 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) { 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/Pointer.js.html b/Docs/out/Pointer.js.html new file mode 100644 index 00000000..24330770 --- /dev/null +++ b/Docs/out/Pointer.js.html @@ -0,0 +1,954 @@ + + + + + + Phaser Source: input/Pointer.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: input/Pointer.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}
    +*/
    +
    +/**
    +* Phaser - Pointer constructor.
    +*
    +* @class Phaser.Pointer
    +* @classdesc A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen.
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +* @param {Description} id - Description.
    +*/
    +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
    +    * @private
    +    * @default
    +    */
    +    this._holdSent = false;
    +
    +    /**
    +    * Local private variable storing the short-term history of pointer movements.
    +    * @property {array} _history
    +    * @private
    +    */
    +    this._history = [];
    +
    +    /**
    +    * Local private variable storing the time at which the next history drop should occur
    +    * @property {number} _lastDrop
    +    * @private
    +    * @default
    +    */
    +    this._nextDrop = 0;
    +
    +    /**
    +     * Monitor events outside of a state reset loop.
    +     * @property {boolean} _stateReset
    +     * @private
    +     * @default
    +     */
    +    this._stateReset = false;
    +
    +    /**
    +    * A Vector object containing the initial position when the Pointer was engaged with the screen.
    +    * @property {Vec2} positionDown
    +    * @default 
    +    **/
    +    this.positionDown = null;
    +
    +    /**
    +    * A Vector object containing the current position of the Pointer on the screen.
    +    * @property {Vec2} position
    +    * @default
    +    **/
    +    this.position = null;
    +
    +    /**
    +    * A Circle object centered on the x/y screen coordinates of the Pointer.
    +    * Default size of 44px (Apple's recommended "finger tip" size).
    +    * @property {Circle} circle
    +    * @default
    +    **/
    +    this.circle = null;
    +
    +    /**
    +    * Description.
    +    * @property {boolean} withinGame
    +    */
    +    this.withinGame = false;
    +
    +    /**
    +    * The horizontal coordinate of point relative to the viewport in pixels, excluding any scroll offset.
    +    * @property {number} clientX
    +    * @default
    +    */
    +    this.clientX = -1;
    +
    +    /**
    +    * The vertical coordinate of point relative to the viewport in pixels, excluding any scroll offset.
    +    * @property {number} clientY
    +    * @default
    +    */
    +    this.clientY = -1;
    +
    +    /**
    +    * The horizontal coordinate of point relative to the viewport in pixels, including any scroll offset.
    +    * @property {number} pageX
    +    * @default
    +    */
    +    this.pageX = -1;
    +
    +    /**
    +    * The vertical coordinate of point relative to the viewport in pixels, including any scroll offset.
    +    * @property {number} pageY
    +    * @default
    +    */
    +    this.pageY = -1;
    +
    +    /**
    +    * The horizontal coordinate of point relative to the screen in pixels.
    +    * @property {number} screenX
    +    * @default
    +    */
    +    this.screenX = -1;
    +
    +    /**
    +    * The vertical coordinate of point relative to the screen in pixels.
    +    * @property {number} screenY
    +    * @default
    +    */
    +    this.screenY = -1;
    +
    +    /**
    +    * The horizontal coordinate of point relative to the game element. This value is automatically scaled based on game size.
    +    * @property {number} x
    +    * @default
    +    */
    +    this.x = -1;
    +
    +    /**
    +    * The vertical coordinate of point relative to the game element. This value is automatically scaled based on game size.
    +    * @property {number} y
    +    * @default
    +    */
    +    this.y = -1;
    +
    +    /**
    +    * If the Pointer is a mouse this is true, otherwise false.
    +    * @property {boolean} isMouse
    +    * @type {boolean}
    +    */
    +    this.isMouse = false;
    +
    +    /**
    +    * If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.
    +    * @property {boolean} isDown
    +    * @default
    +    */
    +    this.isDown = false;
    +
    +    /**
    +    * If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true.
    +    * @property {boolean} isUp
    +    * @default
    +    */
    +    this.isUp = true;
    +
    +    /**
    +    * A timestamp representing when the Pointer first touched the touchscreen.
    +    * @property {number} timeDown
    +    * @default
    +    */
    +    this.timeDown = 0;
    +
    +    /**
    +    * A timestamp representing when the Pointer left the touchscreen.
    +    * @property {number} timeUp
    +    * @default
    +    */
    +    this.timeUp = 0;
    +
    +    /**
    +    * A timestamp representing when the Pointer was last tapped or clicked.
    +    * @property {number} previousTapTime
    +    * @default
    +    */
    +    this.previousTapTime = 0;
    +
    +    /**
    +    * The total number of times this Pointer has been touched to the touchscreen.
    +    * @property {number} totalTouches
    +    * @default
    +    */
    +    this.totalTouches = 0;
    +
    +    /**
    +    * The number of miliseconds since the last click.
    +    * @property {number} msSinceLastClick
    +    * @default
    +    */
    +    this.msSinceLastClick = Number.MAX_VALUE;
    +
    +    /**
    +    * The Game Object this Pointer is currently over / touching / dragging.
    +    * @property {Any} targetObject
    +    * @default
    +    */
    +    this.targetObject = null;
    +
    +    /**
    +    * Description.
    +    * @property {boolean} isDown - Description.
    +    * @default
    +    */
    +    this.active = false;
    +
    +    /**
    +    * Description
    +    * @property {Phaser.Point} position
    +    */
    +    this.position = new Phaser.Point();
    +    
    +    /**
    +    * Description
    +    * @property {Phaser.Point} positionDown
    +    */
    +    this.positionDown = new Phaser.Point();
    +
    +    /**
    +    * Description
    +    * @property {Phaser.Circle} circle
    +    */
    +    this.circle = new Phaser.Circle(0, 0, 44);
    +
    +    if (id == 0)
    +    {
    +        this.isMouse = true;
    +    }
    +
    +};
    +
    +Phaser.Pointer.prototype = {
    +
    +	/**
    +    * Called when the Pointer is pressed onto the touchscreen.
    +    * @method Phaser.Pointer#start
    +    * @param {Any} event
    +    */
    +    start: function (event) {
    +
    +        this.identifier = event.identifier;
    +        this.target = event.target;
    +
    +        if (event.button)
    +        {
    +            this.button = event.button;
    +        }
    +
    +        //  Fix to stop rogue browser plugins from blocking the visibility state event
    +        if (this.game.paused == true && this.game.stage.scale.incorrectOrientation == false)
    +        {
    +            this.game.paused = false;
    +            return this;
    +        }
    +
    +        this._history.length = 0;
    +        this.active = true;
    +        this.withinGame = true;
    +        this.isDown = true;
    +        this.isUp = false;
    +
    +        //  Work out how long it has been since the last click
    +        this.msSinceLastClick = this.game.time.now - this.timeDown;
    +        this.timeDown = this.game.time.now;
    +        this._holdSent = false;
    +
    +        //  This sets the x/y and other local values
    +        this.move(event);
    +
    +        // x and y are the old values here?
    +        this.positionDown.setTo(this.x, this.y);
    +
    +        if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0))
    +        {
    +            this.game.input.x = this.x * this.game.input.scale.x;
    +            this.game.input.y = this.y * this.game.input.scale.y;
    +            this.game.input.position.setTo(this.x, this.y);
    +            this.game.input.onDown.dispatch(this);
    +            this.game.input.resetSpeed(this.x, this.y);
    +        }
    +
    +        this._stateReset = false;
    +        this.totalTouches++;
    +
    +        if (this.isMouse == false)
    +        {
    +            this.game.input.currentPointers++;
    +        }
    +
    +        if (this.targetObject !== null)
    +        {
    +            this.targetObject._touchedHandler(this);
    +        }
    +
    +        return this;
    +
    +    },
    +
    +	/**
    +    * Description.
    +    * @method Phaser.Pointer#update
    +    */
    +    update: function () {
    +
    +        if (this.active)
    +        {
    +            if (this._holdSent == false && this.duration >= this.game.input.holdRate)
    +            {
    +                if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0))
    +                {
    +                    this.game.input.onHold.dispatch(this);
    +                }
    +
    +                this._holdSent = true;
    +            }
    +
    +            //  Update the droppings history
    +            if (this.game.input.recordPointerHistory && this.game.time.now >= this._nextDrop)
    +            {
    +                this._nextDrop = this.game.time.now + this.game.input.recordRate;
    +
    +                this._history.push({
    +                    x: this.position.x,
    +                    y: this.position.y
    +                });
    +            
    +                if (this._history.length > this.game.input.recordLimit)
    +                {
    +                    this._history.shift();
    +                }
    +            }
    +        }
    +
    +    },
    +
    +	/**
    +    * Called when the Pointer is moved
    +    * @method Phaser.Pointer#move
    +    * @param {Any} event
    +    */
    +    move: function (event) {
    +
    +        if (this.game.input.pollLocked)
    +        {
    +            return;
    +        }
    +
    +        if (event.button)
    +        {
    +            this.button = event.button;
    +        }
    +
    +        this.clientX = event.clientX;
    +        this.clientY = event.clientY;
    +
    +        this.pageX = event.pageX;
    +        this.pageY = event.pageY;
    +
    +        this.screenX = event.screenX;
    +        this.screenY = event.screenY;
    +
    +        this.x = (this.pageX - this.game.stage.offset.x) * this.game.input.scale.x;
    +        this.y = (this.pageY - this.game.stage.offset.y) * this.game.input.scale.y;
    +
    +        this.position.setTo(this.x, this.y);
    +        this.circle.x = this.x;
    +        this.circle.y = this.y;
    +
    +        if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0))
    +        {
    +            this.game.input.activePointer = this;
    +            this.game.input.x = this.x;
    +            this.game.input.y = this.y;
    +            this.game.input.position.setTo(this.game.input.x, this.game.input.y);
    +            this.game.input.circle.x = this.game.input.x;
    +            this.game.input.circle.y = this.game.input.y;
    +        }
    +
    +        //  If the game is paused we don't process any target objects
    +        if (this.game.paused)
    +        {
    +            return this;
    +        }
    +
    +        //  Easy out if we're dragging something and it still exists
    +        if (this.targetObject !== null && this.targetObject.isDragged == true)
    +        {
    +            if (this.targetObject.update(this) == false)
    +            {
    +                this.targetObject = null;
    +            }
    +
    +            return this;
    +
    +        }
    +
    +        //  Work out which object is on the top
    +        this._highestRenderOrderID = -1;
    +        this._highestRenderObject = null;
    +        this._highestInputPriorityID = -1;
    +
    +        //  Just run through the linked list
    +        if (this.game.input.interactiveItems.total > 0)
    +        {
    +            var currentNode = this.game.input.interactiveItems.next;
    +
    +            do  
    +            {
    +                //  If the object is using pixelPerfect checks, or has a higher InputManager.PriorityID OR if the priority ID is the same as the current highest AND it has a higher renderOrderID, then set it to the top
    +                if (currentNode.pixelPerfect || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID == this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID))
    +                {
    +                    if (currentNode.checkPointerOver(this))
    +                    {
    +                        // console.log('HRO set', currentNode.sprite.name);
    +                        this._highestRenderOrderID = currentNode.sprite.renderOrderID;
    +                        this._highestInputPriorityID = currentNode.priorityID;
    +                        this._highestRenderObject = currentNode;
    +                    }
    +                }
    +                currentNode = currentNode.next;
    +            }
    +            while (currentNode != null)
    +        }
    +
    +        if (this._highestRenderObject == null)
    +        {
    +            // console.log("HRO null");
    +
    +            //  The pointer isn't currently over anything, check if we've got a lingering previous target
    +            if (this.targetObject)
    +            {
    +                // console.log("The pointer isn't currently over anything, check if we've got a lingering previous target");
    +                this.targetObject._pointerOutHandler(this);
    +                this.targetObject = null;
    +            }
    +        }
    +        else
    +        {
    +            if (this.targetObject == null)
    +            {
    +                //  And now set the new one
    +                // console.log('And now set the new one');
    +                this.targetObject = this._highestRenderObject;
    +                this._highestRenderObject._pointerOverHandler(this);
    +            }
    +            else
    +            {
    +                //  We've got a target from the last update
    +                // console.log("We've got a target from the last update");
    +                if (this.targetObject == this._highestRenderObject)
    +                {
    +                    //  Same target as before, so update it
    +                    // console.log("Same target as before, so update it");
    +                    if (this._highestRenderObject.update(this) == false)
    +                    {
    +                        this.targetObject = null;
    +                    }
    +                }
    +                else
    +                {
    +                    //  The target has changed, so tell the old one we've left it
    +                    // console.log("The target has changed, so tell the old one we've left it");
    +                    this.targetObject._pointerOutHandler(this);
    +
    +                    //  And now set the new one
    +                    this.targetObject = this._highestRenderObject;
    +                    this.targetObject._pointerOverHandler(this);
    +                }
    +            }
    +        }
    +
    +        return this;
    +
    +    },
    +
    +	/**
    +    * Called when the Pointer leaves the target area.
    +    * @method Phaser.Pointer#leave
    +    * @param {Any} event
    +    */
    +    leave: function (event) {
    +
    +        this.withinGame = false;
    +        this.move(event);
    +
    +    },
    +
    +	/**
    +    * Called when the Pointer leaves the touchscreen.
    +    * @method Phaser.Pointer#stop
    +    * @param {Any} event
    +    */
    +    stop: function (event) {
    +
    +        if (this._stateReset)
    +        {
    +            event.preventDefault();
    +            return;
    +        }
    +
    +        this.timeUp = this.game.time.now;
    +
    +        if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers == 0))
    +        {
    +            this.game.input.onUp.dispatch(this);
    +
    +            //  Was it a tap?
    +            if (this.duration >= 0 && this.duration <= this.game.input.tapRate)
    +            {
    +                //  Was it a double-tap?
    +                if (this.timeUp - this.previousTapTime < this.game.input.doubleTapRate)
    +                {
    +                    //  Yes, let's dispatch the signal then with the 2nd parameter set to true
    +                    this.game.input.onTap.dispatch(this, true);
    +                }
    +                else
    +                {
    +                    //  Wasn't a double-tap, so dispatch a single tap signal
    +                    this.game.input.onTap.dispatch(this, false);
    +                }
    +
    +                this.previousTapTime = this.timeUp;
    +            }
    +        }
    +
    +        //  Mouse is always active
    +        if (this.id > 0)
    +        {
    +            this.active = false;
    +        }
    +
    +        this.withinGame = false;
    +        this.isDown = false;
    +        this.isUp = true;
    +
    +        if (this.isMouse == false)
    +        {
    +            this.game.input.currentPointers--;
    +        }
    +
    +        if (this.game.input.interactiveItems.total > 0)
    +        {
    +            var currentNode = this.game.input.interactiveItems.next;
    +            
    +            do  
    +            {
    +                if (currentNode)
    +                {
    +                    currentNode._releasedHandler(this);
    +                }
    +                
    +                currentNode = currentNode.next;
    +            }
    +            while (currentNode != null)
    +        }
    +
    +        if (this.targetObject)
    +        {
    +            this.targetObject._releasedHandler(this);
    +        }
    +
    +        this.targetObject = null;
    +        return this;
    +
    +    },
    +
    +	/**
    +    * The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate.
    +    * @method Phaser.Pointer#justPressed
    +    * @param {number} [duration]
    +    * @return {boolean}
    +    */
    +    justPressed: function (duration) {
    +
    +        duration = duration || this.game.input.justPressedRate;
    +
    +        return (this.isDown === true && (this.timeDown + duration) > this.game.time.now);
    +
    +    },
    +
    +	/**
    +    * The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate.
    +    * @method Phaser.Pointer#justReleased
    +    * @param {number} [duration]
    +    * @return {boolean}
    +    */
    +    justReleased: function (duration) {
    +
    +        duration = duration || this.game.input.justReleasedRate;
    +
    +        return (this.isUp === true && (this.timeUp + duration) > this.game.time.now);
    +
    +    },
    +
    +	/**
    +    * Resets the Pointer properties. Called by InputManager.reset when you perform a State change.
    +    * @method Phaser.Pointer#reset
    +    */
    +    reset: function () {
    +
    +        if (this.isMouse == false)
    +        {
    +            this.active = false;
    +        }
    +
    +        this.identifier = null;
    +        this.isDown = false;
    +        this.isUp = true;
    +        this.totalTouches = 0;
    +        this._holdSent = false;
    +        this._history.length = 0;
    +        this._stateReset = true;
    +
    +        if (this.targetObject)
    +        {
    +            this.targetObject._releasedHandler(this);
    +        }
    +
    +        this.targetObject = null;
    +
    +    },
    +
    +	/**
    +    * Returns a string representation of this object.
    +    * @method Phaser.Pointer#toString
    +    * @return {string} A string representation of the instance.
    +    **/
    +    toString: function () {
    +        return "[{Pointer (id=" + this.id + " identifer=" + this.identifier + " active=" + this.active + " duration=" + this.duration + " withinGame=" + this.withinGame + " x=" + this.x + " y=" + this.y + " clientX=" + this.clientX + " clientY=" + this.clientY + " screenX=" + this.screenX + " screenY=" + this.screenY + " pageX=" + this.pageX + " pageY=" + this.pageY + ")}]";
    +    }
    +
    +};
    +
    +/**
    +* How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
    +* @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", {
    +
    +    get: function () {
    +
    +        if (this.isUp)
    +        {
    +            return -1;
    +        }
    +
    +        return this.game.time.now - this.timeDown;
    +
    +    }
    +
    +});
    +
    +/**
    +* 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 () {
    +
    +		return this.game.world.camera.x + this.x;
    +
    +    }
    +
    +});
    +
    +/**
    +* 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 () {
    +
    +		return this.game.world.camera.y + this.y;
    +
    +    }
    +
    +});
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/QuadTree.js.html b/Docs/out/QuadTree.js.html new file mode 100644 index 00000000..ac549748 --- /dev/null +++ b/Docs/out/QuadTree.js.html @@ -0,0 +1,528 @@ + + + + + + Phaser Source: math/QuadTree.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: math/QuadTree.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}
    +*/
    +
    +/**
    + * Javascript QuadTree 
    + * @version 1.0
    + * @author Timo Hausmann
    + *
    + * @version 1.2, September 4th 2013
    + * @author Richard Davey
    + * 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/
    + */
    + 
    +/**
    +* @overview
    +* @copyright © 2012 Timo Hausmann
    +*
    +* Permission is hereby granted, free of charge, to any person obtaining
    +* a copy of this software and associated documentation files (the
    +* "Software"), to deal in the Software without restriction, including
    +* without limitation the rights to use, copy, modify, merge, publish,
    +* distribute, sublicense, and/or sell copies of the Software, and to
    +* permit persons to whom the Software is furnished to do so, subject to
    +* the following conditions:
    +*
    +* The above copyright notice and this permission notice shall be
    +* included in all copies or substantial portions of the Software.
    +*
    +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    +* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    +* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    +* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    +*/
    +
    +/**
    + * QuadTree Constructor
    + * 
    + * @class Phaser.QuadTree
    + * @classdesc 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/
    + * @constructor
    + * @param {Description} physicsManager - Description.
    + * @param {Description} x - Description.
    + * @param {Description} y - Description.
    + * @param {number} width - The width of your game in game pixels.
    + * @param {number} height - The height of your game in game pixels.
    + * @param {number} maxObjects - Description.
    + * @param {number} maxLevels - Description.
    + * @param {number} level - Description.
    + */
    +Phaser.QuadTree = function (physicsManager, x, y, width, height, maxObjects, maxLevels, level) {
    +		
    +	this.physicsManager = physicsManager;
    +	this.ID = physicsManager.quadTreeID;
    +	physicsManager.quadTreeID++;
    +
    +	this.maxObjects = maxObjects || 10;
    +	this.maxLevels = maxLevels || 4;
    +	this.level = level || 0;
    +
    +	this.bounds = { 
    +		x: Math.round(x), 
    +		y: Math.round(y), 
    +		width: width, 
    +		height: height, 
    +		subWidth: Math.floor(width / 2),
    +		subHeight: Math.floor(height / 2),
    +		right: Math.round(x) + Math.floor(width / 2),
    +		bottom: Math.round(y) + Math.floor(height / 2)
    +	};
    +	
    +	this.objects = [];
    +	this.nodes = [];
    +
    +};
    +
    +Phaser.QuadTree.prototype = {
    +
    +	/*
    +	* Split the node into 4 subnodes
    +	* 
    +	* @method Phaser.QuadTree#split
    +	*/
    +	split: function() {
    +
    +		this.level++;
    +		
    +	 	//	top right node
    +		this.nodes[0] = new Phaser.QuadTree(this.physicsManager, this.bounds.right, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
    +		
    +		//	top left node
    +		this.nodes[1] = new Phaser.QuadTree(this.physicsManager, this.bounds.x, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
    +		
    +		//	bottom left node
    +		this.nodes[2] = new Phaser.QuadTree(this.physicsManager, this.bounds.x, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
    +		
    +		//	bottom right node
    +		this.nodes[3] = new Phaser.QuadTree(this.physicsManager, this.bounds.right, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
    +
    +	},
    +
    +	/*
    +	 * Insert the object into the node. If the node
    +	 * exceeds the capacity, it will split and add all
    +	 * objects to their corresponding subnodes.
    +	 * 
    +	 * @method Phaser.QuadTree#insert
    +	 * @param {object} body - Description.
    +	 */
    +	insert: function (body) {
    +		
    +		var i = 0;
    +		var index;
    +	 	
    +	 	//	if we have subnodes ...
    +		if (this.nodes[0] != null)
    +		{
    +			index = this.getIndex(body);
    +	 
    +		  	if (index !== -1)
    +		  	{
    +				this.nodes[index].insert(body);
    +			 	return;
    +			}
    +		}
    +	 
    +	 	this.objects.push(body);
    +		
    +		if (this.objects.length > this.maxObjects && this.level < this.maxLevels)
    +		{
    +			//	Split if we don't already have subnodes
    +			if (this.nodes[0] == null)
    +			{
    +				this.split();
    +			}
    +			
    +			//	Add objects to subnodes
    +			while (i < this.objects.length)
    +			{
    +				index = this.getIndex(this.objects[i]);
    +				
    +				if (index !== -1)
    +				{
    +					//	this is expensive - see what we can do about it
    +					this.nodes[index].insert(this.objects.splice(i, 1)[0]);
    +				}
    +				else
    +				{
    +					i++;
    +			 	}
    +		 	}
    +		}
    +	 },
    +	 
    +	/*
    +	 * Determine which node the object belongs to.
    +	 * 
    +	 * @method Phaser.QuadTree#getIndex
    +	 * @param {object} rect	- Description.
    +	 * @return {number} index -	Index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node.
    +	 */
    +	getIndex: function (rect) {
    +		
    +		//	default is that rect doesn't fit, i.e. it straddles the internal quadrants
    +		var index = -1;
    +
    +		if (rect.x < this.bounds.right && rect.right < this.bounds.right)
    +		{
    +			if ((rect.y < this.bounds.bottom && rect.bottom < this.bounds.bottom))
    +			{
    +				//	rect fits within the top-left quadrant of this quadtree
    +				index = 1;
    +			}
    +			else if ((rect.y > this.bounds.bottom))
    +			{
    +				//	rect fits within the bottom-left quadrant of this quadtree
    +				index = 2;
    +			}
    +		}
    +		else if (rect.x > this.bounds.right)
    +		{
    +			//	rect can completely fit within the right quadrants
    +			if ((rect.y < this.bounds.bottom && rect.bottom < this.bounds.bottom))
    +			{
    +				//	rect fits within the top-right quadrant of this quadtree
    +				index = 0;
    +			}
    +			else if ((rect.y > this.bounds.bottom))
    +			{
    +				//	rect fits within the bottom-right quadrant of this quadtree
    +				index = 3;
    +			}
    +		}
    +	 
    +		return index;
    +
    +	},
    +
    +	 /*
    +	 * Return all objects that could collide with the given object.
    +	 * 
    +	 * @method Phaser.QuadTree#retrieve
    +	 * @param {object} rect	- Description.
    +	 * @Return {array} - Array with all detected objects.
    +	 */
    +	retrieve: function (sprite) {
    +	 	
    +		var returnObjects = this.objects;
    +
    +		sprite.body.quadTreeIndex = this.getIndex(sprite.body);
    +
    +		//	Temp store for the node IDs this sprite is in, we can use this for fast elimination later
    +		sprite.body.quadTreeIDs.push(this.ID);
    +
    +		if (this.nodes[0])
    +		{
    +			//	if rect fits into a subnode ..
    +			if (sprite.body.quadTreeIndex !== -1)
    +			{
    +				returnObjects = returnObjects.concat(this.nodes[sprite.body.quadTreeIndex].retrieve(sprite));
    +			}
    +			else
    +			{
    +				//	if rect does not fit into a subnode, check it against all subnodes (unrolled for speed)
    +				returnObjects = returnObjects.concat(this.nodes[0].retrieve(sprite));
    +				returnObjects = returnObjects.concat(this.nodes[1].retrieve(sprite));
    +				returnObjects = returnObjects.concat(this.nodes[2].retrieve(sprite));
    +				returnObjects = returnObjects.concat(this.nodes[3].retrieve(sprite));
    +			}
    +		}
    +	 
    +		return returnObjects;
    +
    +	},
    +
    +	/*
    +	 * Clear the quadtree.
    +	 * @method Phaser.QuadTree#clear
    +	 */
    +	clear: function () {
    +		
    +		this.objects = [];
    +	 
    +		for (var i = 0, len = this.nodes.length; i < len; i++)
    +		{
    +			// if (typeof this.nodes[i] !== 'undefined')
    +			if (this.nodes[i])
    +			{
    +				this.nodes[i].clear();
    +				delete this.nodes[i];
    +		  	}
    +		}
    +	}
    +
    +};
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:47 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/RandomDataGenerator.js.html b/Docs/out/RandomDataGenerator.js.html new file mode 100644 index 00000000..37b59a96 --- /dev/null +++ b/Docs/out/RandomDataGenerator.js.html @@ -0,0 +1,510 @@ + + + + + + Phaser Source: math/RandomDataGenerator.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: math/RandomDataGenerator.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}
    +*/
    +
    +/**
    +* Phaser.RandomDataGenerator constructor.
    +* 
    +* @class Phaser.RandomDataGenerator
    +* @classdesc An extremely useful repeatable random data generator. Access it via Phaser.Game.rnd
    +* Based on Nonsense by Josh Faul https://github.com/jocafa/Nonsense.
    +* Random number generator from http://baagoe.org/en/wiki/Better_random_numbers_for_javascript
    +* 
    +* @constructor
    +* @param {array} seeds
    +*/
    +Phaser.RandomDataGenerator = function (seeds) {
    +	
    +	if (typeof seeds === "undefined") { seeds = []; }
    +
    +	this.sow(seeds);
    +
    +};
    +
    +Phaser.RandomDataGenerator.prototype = {
    +
    +	/**
    +	* @property {number} c
    +	* @private
    +	*/
    +	c: 1,
    +
    +	/**
    +	* @property {number} s0
    +	* @private
    +	*/
    +	s0: 0,
    +
    +	/**
    +	* @property {number} s1
    +	* @private
    +	*/
    +	s1: 0,
    +
    +	/**
    +	* @property {number} s2
    +	* @private
    +	*/
    +	s2: 0,
    +
    +	/**
    +	* Private random helper.
    +	* @method Phaser.RandomDataGenerator#rnd
    +	* @private
    +	* @return {number} Description.
    +	*/
    +	rnd: function () {
    +
    +		var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32
    +
    +		this.c = t | 0;
    +		this.s0 = this.s1;
    +		this.s1 = this.s2;
    +		this.s2 = t - this.c;
    +
    +		return this.s2;
    +	},
    +
    +	/**
    +	* Reset the seed of the random data generator.
    +	* 
    +	* @method Phaser.RandomDataGenerator#sow
    +	* @param {array} seeds
    +	*/
    +	sow: function (seeds) {
    +
    +		if (typeof seeds === "undefined") { seeds = []; }
    +
    +		this.s0 = this.hash(' ');
    +		this.s1 = this.hash(this.s0);
    +		this.s2 = this.hash(this.s1);
    +
    +		var seed;
    +
    +		for (var i = 0; seed = seeds[i++]; ) {
    +			this.s0 -= this.hash(seed);
    +			this.s0 += ~~(this.s0 < 0);
    +			this.s1 -= this.hash(seed);
    +			this.s1 += ~~(this.s1 < 0);
    +			this.s2 -= this.hash(seed);
    +			this.s2 += ~~(this.s2 < 0);
    +		}
    +		
    +	},
    +
    +	/**
    +	* Description.
    +	* @method Phaser.RandomDataGenerator#hash
    +	* @param {Any} data
    +	* @private
    +	* @return {number} Description.
    +	*/
    +	hash: function (data) {
    +
    +		var h, i, n;
    +		n = 0xefc8249d;
    +		data = data.toString();
    +
    +		for (i = 0; i < data.length; i++) {
    +			n += data.charCodeAt(i);
    +			h = 0.02519603282416938 * n;
    +			n = h >>> 0;
    +			h -= n;
    +			h *= n;
    +			n = h >>> 0;
    +			h -= n;
    +			n += h * 0x100000000;// 2^32
    +		}
    +
    +		return (n >>> 0) * 2.3283064365386963e-10;// 2^-32
    +
    +	},
    +
    +	/**
    +	* Returns a random integer between 0 and 2^32.
    +	* @method Phaser.RandomDataGenerator#integer
    +	* @return {number}
    +	*/
    +	integer: function() {
    +		return this.rnd.apply(this) * 0x100000000;// 2^32
    +	},
    +
    +	/**
    +	* Returns a random real number between 0 and 1.
    +	* @method Phaser.RandomDataGenerator#frac
    +	* @return {number}
    +	*/	
    +	frac: function() {
    +		return this.rnd.apply(this) + (this.rnd.apply(this) * 0x200000 | 0) * 1.1102230246251565e-16;// 2^-53
    +	},
    +
    +	/**
    +	* Returns a random real number between 0 and 2^32.
    +	* @method Phaser.RandomDataGenerator#real
    +	* @return {number}
    +	*/
    +	real: function() {
    +		return this.integer() + this.frac();
    +	},
    +
    +	/**
    +	* Returns a random integer between min and max.
    +	* @method Phaser.RandomDataGenerator#integerInRange
    +	* @param {number} min
    +	* @param {number} max
    +	* @return {number}
    +	*/
    +	integerInRange: function (min, max) {
    +		return Math.floor(this.realInRange(min, max));
    +	},
    +
    +	/**
    +	* Returns a random real number between min and max.
    +	* @method Phaser.RandomDataGenerator#realInRange
    +	* @param {number} min
    +	* @param {number} max
    +	* @return {number}
    +	*/
    +	realInRange: function (min, max) {
    +
    +		min = min || 0;
    +		max = max || 0;
    +
    +		return this.frac() * (max - min) + min;
    +
    +	},
    +
    +	/**
    +	* Returns a random real number between -1 and 1.
    +	* @method Phaser.RandomDataGenerator#normal
    +	* @return {number}
    +	*/
    +	normal: function () {
    +		return 1 - 2 * this.frac();
    +	},
    +
    +	/**
    +	* Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368
    +	* @method Phaser.RandomDataGenerator#uuid
    +	* @return {string}
    +	*/
    +	uuid: function () {
    +
    +		var a, b;
    +
    +		for (
    +			b=a='';
    +			a++<36;
    +			b+=~a%5|a*3&4?(a^15?8^this.frac()*(a^20?16:4):4).toString(16):'-'
    +		);
    +
    +		return b;
    +
    +	},
    +
    +	/**
    +	* Returns a random member of `array`.
    +	* @method Phaser.RandomDataGenerator#pick
    +	* @param {Any} ary
    +	* @return {number}
    +	*/
    +	pick: function (ary) {
    +		return ary[this.integerInRange(0, ary.length)];
    +	},
    +
    +	/**
    +	* Returns a random member of `array`, favoring the earlier entries.
    +	* @method Phaser.RandomDataGenerator#weightedPick
    +	* @param {Any} ary
    +	* @return {number}
    +	*/
    +	weightedPick: function (ary) {
    +		return ary[~~(Math.pow(this.frac(), 2) * ary.length)];
    +	},
    +
    +	/**
    +	* Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified.
    +	* @method Phaser.RandomDataGenerator#timestamp
    +	* @param {number} min
    +	* @param {number} max
    +	* @return {number}
    +	*/
    +	timestamp: function (a, b) {
    +		return this.realInRange(a || 946684800000, b || 1577862000000);
    +	},
    +
    +	/**
    +	* Returns a random angle between -180 and 180.
    +	* @method Phaser.RandomDataGenerator#angle
    +	* @return {number}
    +	*/
    +	angle: function() {
    +		return this.integerInRange(-180, 180);
    +	}
    +
    +};
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/Rectangle.js.html b/Docs/out/Rectangle.js.html index 9515f5a4..ad1654e8 100644 --- a/Docs/out/Rectangle.js.html +++ b/Docs/out/Rectangle.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -836,7 +884,7 @@ Phaser.Rectangle.union = function (a, b, out) { 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/Signal.js.html b/Docs/out/Signal.js.html index 92e4f6aa..1749b9bb 100644 --- a/Docs/out/Signal.js.html +++ b/Docs/out/Signal.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -469,7 +517,7 @@ Phaser.Signal.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/SignalBinding.html b/Docs/out/SignalBinding.html index 3d41330f..db9d72c1 100644 --- a/Docs/out/SignalBinding.html +++ b/Docs/out/SignalBinding.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -469,7 +517,7 @@ 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/SignalBinding.js.html b/Docs/out/SignalBinding.js.html index e2bf2418..701b8c5b 100644 --- a/Docs/out/SignalBinding.js.html +++ b/Docs/out/SignalBinding.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -334,7 +382,7 @@ Phaser.SignalBinding.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/Stage.js.html b/Docs/out/Stage.js.html index 4e5f83e6..0555f468 100644 --- a/Docs/out/Stage.js.html +++ b/Docs/out/Stage.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -318,7 +366,7 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { 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/State.js.html b/Docs/out/State.js.html index 4f2ebac7..af1fa1d8 100644 --- a/Docs/out/State.js.html +++ b/Docs/out/State.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -341,7 +389,7 @@ Phaser.State.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/StateManager.js.html b/Docs/out/StateManager.js.html index b3636079..6d60f53f 100644 --- a/Docs/out/StateManager.js.html +++ b/Docs/out/StateManager.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -697,7 +745,7 @@ Phaser.StateManager.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/Touch.js.html b/Docs/out/Touch.js.html new file mode 100644 index 00000000..c16cb815 --- /dev/null +++ b/Docs/out/Touch.js.html @@ -0,0 +1,596 @@ + + + + + + Phaser Source: input/Touch.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: input/Touch.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}
    +*/
    +
    +/**
    +* Phaser.Touch handles touch events with your game. Note: Android 2.x only supports 1 touch event at once, no multi-touch.
    +*
    +* @class Phaser.Touch
    +* @classdesc The Touch class handles touch interactions with the game and the resulting Pointer objects.
    +* @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;
    +    
    +    /**
    +    * 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
    +    */
    +    this.touchStartCallback = null;
    +    
    +    /**
    +    * @property {Phaser.Game} touchMoveCallback - Description.
    +    * @default
    +    */
    +    this.touchMoveCallback = null;
    +    
    +    /**
    +    * @property {Phaser.Game} touchEndCallback - Description.
    +    * @default
    +    */
    +    this.touchEndCallback = null;
    +    
    +    /**
    +    * @property {Phaser.Game} touchEnterCallback - Description.
    +    * @default
    +    */
    +    this.touchEnterCallback = null;
    +    
    +    /**
    +    * @property {Phaser.Game} touchLeaveCallback - Description.
    +    * @default
    +    */
    +    this.touchLeaveCallback = null;
    +    
    +    /**
    +    * @property {Description} touchCancelCallback - Description.
    +    * @default
    +    */
    +    this.touchCancelCallback = null;
    +    
    +    /**
    +    * @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 = {
    +
    +    /**
    +    * Starts the event listeners running.
    +    * @method Phaser.Touch#start
    +    */
    +    start: function () {
    +
    +        var _this = this;
    +
    +        if (this.game.device.touch)
    +        {
    +            this._onTouchStart = function (event) {
    +                return _this.onTouchStart(event);
    +            };
    +
    +            this._onTouchMove = function (event) {
    +                return _this.onTouchMove(event);
    +            };
    +
    +            this._onTouchEnd = function (event) {
    +                return _this.onTouchEnd(event);
    +            };
    +
    +            this._onTouchEnter = function (event) {
    +                return _this.onTouchEnter(event);
    +            };
    +
    +            this._onTouchLeave = function (event) {
    +                return _this.onTouchLeave(event);
    +            };
    +
    +            this._onTouchCancel = function (event) {
    +                return _this.onTouchCancel(event);
    +            };
    +
    +            this.game.renderer.view.addEventListener('touchstart', this._onTouchStart, false);
    +            this.game.renderer.view.addEventListener('touchmove', this._onTouchMove, false);
    +            this.game.renderer.view.addEventListener('touchend', this._onTouchEnd, false);
    +            this.game.renderer.view.addEventListener('touchenter', this._onTouchEnter, false);
    +            this.game.renderer.view.addEventListener('touchleave', this._onTouchLeave, false);
    +            this.game.renderer.view.addEventListener('touchcancel', this._onTouchCancel, false);
    +        }
    +
    +    },
    +
    +    /**
    +    * Consumes all touchmove events on the document (only enable this if you know you need it!).
    +    * @method Phaser.Touch#consumeTouchMove
    +    */
    +    consumeDocumentTouches: function () {
    +
    +        this._documentTouchMove = function (event) {
    +            event.preventDefault();
    +        };
    +
    +        document.addEventListener('touchmove', this._documentTouchMove, false);
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.Touch#onTouchStart
    +    * @param {Any} event
    +    */
    +    onTouchStart: function (event) {
    +
    +        if (this.touchStartCallback)
    +        {
    +            this.touchStartCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        if (this.preventDefault)
    +        {
    +            event.preventDefault();
    +        }
    +
    +        //  event.targetTouches = list of all touches on the TARGET ELEMENT (i.e. game dom element)
    +        //  event.touches = list of all touches on the ENTIRE DOCUMENT, not just the target element
    +        //  event.changedTouches = the touches that CHANGED in this event, not the total number of them
    +        for (var i = 0; i < event.changedTouches.length; i++)
    +        {
    +            this.game.input.startPointer(event.changedTouches[i]);
    +        }
    +
    +    },
    +
    +    /**
    +    * 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 Phaser.Touch#onTouchCancel
    +    * @param {Any} event
    +    */
    +    onTouchCancel: function (event) {
    +
    +        if (this.touchCancelCallback)
    +        {
    +            this.touchCancelCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        if (this.preventDefault)
    +        {
    +            event.preventDefault();
    +        }
    +
    +        //  Touch cancel - touches that were disrupted (perhaps by moving into a plugin or browser chrome)
    +        //  http://www.w3.org/TR/touch-events/#dfn-touchcancel
    +        for (var i = 0; i < event.changedTouches.length; i++)
    +        {
    +            this.game.input.stopPointer(event.changedTouches[i]);
    +        }
    +
    +    },
    +
    +    /**
    +    * 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 Phaser.Touch#onTouchEnter
    +    * @param {Any} event
    +    */
    +    onTouchEnter: function (event) {
    +
    +        if (this.touchEnterCallback)
    +        {
    +            this.touchEnterCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.game.input.disabled || this.disabled)
    +        {
    +            return;
    +        }
    +
    +        if (this.preventDefault)
    +        {
    +            event.preventDefault();
    +        }
    +
    +        for (var i = 0; i < event.changedTouches.length; i++)
    +        {
    +            //console.log('touch enter');
    +        }
    +
    +    },
    +
    +    /**
    +    * 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 Phaser.Touch#onTouchLeave
    +    * @param {Any} event
    +    */    
    +    onTouchLeave: function (event) {
    +
    +        if (this.touchLeaveCallback)
    +        {
    +            this.touchLeaveCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.preventDefault)
    +        {
    +            event.preventDefault();
    +        }
    +
    +        for (var i = 0; i < event.changedTouches.length; i++)
    +        {
    +            //console.log('touch leave');
    +        }
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.Touch#onTouchMove
    +    * @param {Any} event
    +    */
    +    onTouchMove: function (event) {
    +
    +        if (this.touchMoveCallback)
    +        {
    +            this.touchMoveCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.preventDefault)
    +        {
    +            event.preventDefault();
    +        }
    +
    +        for (var i = 0; i < event.changedTouches.length; i++)
    +        {
    +            this.game.input.updatePointer(event.changedTouches[i]);
    +        }
    +
    +    },
    +
    +    /**
    +    * Description.
    +    * @method Phaser.Touch#onTouchEnd
    +    * @param {Any} event
    +    */
    +    onTouchEnd: function (event) {
    +
    +        if (this.touchEndCallback)
    +        {
    +            this.touchEndCallback.call(this.callbackContext, event);
    +        }
    +
    +        if (this.preventDefault)
    +        {
    +            event.preventDefault();
    +        }
    +
    +        //  For touch end its a list of the touch points that have been removed from the surface
    +        //  https://developer.mozilla.org/en-US/docs/DOM/TouchList
    +        //  event.changedTouches = the touches that CHANGED in this event, not the total number of them
    +        for (var i = 0; i < event.changedTouches.length; i++)
    +        {
    +            this.game.input.stopPointer(event.changedTouches[i]);
    +        }
    +
    +    },
    +
    +    /**
    +    * Stop the event listeners.
    +    * @method Phaser.Touch#stop
    +    */
    +    stop: function () {
    +
    +        if (this.game.device.touch)
    +        {
    +            this.game.stage.canvas.removeEventListener('touchstart', this._onTouchStart);
    +            this.game.stage.canvas.removeEventListener('touchmove', this._onTouchMove);
    +            this.game.stage.canvas.removeEventListener('touchend', this._onTouchEnd);
    +            this.game.stage.canvas.removeEventListener('touchenter', this._onTouchEnter);
    +            this.game.stage.canvas.removeEventListener('touchleave', this._onTouchLeave);
    +            this.game.stage.canvas.removeEventListener('touchcancel', this._onTouchCancel);
    +        }
    +
    +    }
    +
    +};
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2013 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.2.0-dev + on Wed Oct 02 2013 15:04:48 GMT+0100 (BST) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/Docs/out/World.js.html b/Docs/out/World.js.html index e950278a..71d7538b 100644 --- a/Docs/out/World.js.html +++ b/Docs/out/World.js.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -414,7 +462,7 @@ Object.defineProperty(Phaser.World.prototype, "randomY", { 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/classes.list.html b/Docs/out/classes.list.html index 09d1aa16..59e6e1bd 100644 --- a/Docs/out/classes.list.html +++ b/Docs/out/classes.list.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -223,6 +271,9 @@
    AnimationManager
    +
    Cache
    +
    +
    Camera
    @@ -238,18 +289,51 @@
    Input
    +
    InputHandler
    +
    + +
    Key
    +
    + +
    Keyboard
    +
    +
    LinkedList
    -
    PluginManager
    +
    Loader
    +
    + +
    Parser
    +
    + +
    Math
    +
    + +
    Mouse
    +
    + +
    MSPointer
    Plugin
    +
    PluginManager
    +
    +
    Point
    +
    Pointer
    +
    + +
    QuadTree
    +
    + +
    RandomDataGenerator
    +
    +
    Rectangle
    @@ -265,6 +349,9 @@
    StateManager
    +
    Touch
    +
    +
    World
    @@ -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/Docs/out/index.html b/Docs/out/index.html index 19393359..84a0957c 100644 --- a/Docs/out/index.html +++ b/Docs/out/index.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -172,6 +220,90 @@ + + + + + +

    Index

    +
    + +
    +

    + math/QuadTree.js +

    + +
    + +
    +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + +
    + +
    @@ -189,7 +321,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/Docs/out/module-Phaser.html b/Docs/out/module-Phaser.html index 55118b51..3b69260f 100644 --- a/Docs/out/module-Phaser.html +++ b/Docs/out/module-Phaser.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -240,7 +288,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/Docs/out/modules.list.html b/Docs/out/modules.list.html index 88985847..c4ac2397 100644 --- a/Docs/out/modules.list.html +++ b/Docs/out/modules.list.html @@ -32,10 +32,6 @@ Phaser -
  • - PluginManager -
  • - @@ -66,6 +62,10 @@ AnimationManager +
  • + Cache +
  • +
  • Camera
  • @@ -86,22 +86,66 @@ Input +
  • + InputHandler +
  • + +
  • + Key +
  • + +
  • + Keyboard +
  • +
  • LinkedList
  • - PluginManager + Loader +
  • + +
  • + Parser +
  • + +
  • + Math +
  • + +
  • + Mouse +
  • + +
  • + MSPointer
  • Plugin
  • +
  • + PluginManager +
  • +
  • Point
  • +
  • + Pointer +
  • + +
  • + QuadTree +
  • + +
  • + RandomDataGenerator +
  • +
  • Rectangle
  • @@ -122,6 +166,10 @@ StateManager +
  • + Touch +
  • +
  • World
  • @@ -223,6 +271,9 @@
    AnimationManager
    +
    Cache
    +
    +
    Camera
    @@ -238,18 +289,51 @@
    Input
    +
    InputHandler
    +
    + +
    Key
    +
    + +
    Keyboard
    +
    +
    LinkedList
    -
    PluginManager
    +
    Loader
    +
    + +
    Parser
    +
    + +
    Math
    +
    + +
    Mouse
    +
    + +
    MSPointer
    Plugin
    +
    PluginManager
    +
    +
    Point
    +
    Pointer
    +
    + +
    QuadTree
    +
    + +
    RandomDataGenerator
    +
    +
    Rectangle
    @@ -265,6 +349,9 @@
    StateManager
    +
    Touch
    +
    +
    World
    @@ -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

    - * 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 {@link https://github.com/timohausmann/quadtree-js/} + * @classdesc 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/ * @constructor * @param {Description} physicsManager - Description. * @param {Description} x - Description. @@ -93,7 +89,7 @@ Phaser.QuadTree.prototype = { /* * Split the node into 4 subnodes * - * @method split + * @method Phaser.QuadTree#split */ split: function() { @@ -118,7 +114,7 @@ Phaser.QuadTree.prototype = { * exceeds the capacity, it will split and add all * objects to their corresponding subnodes. * - * @method insert + * @method Phaser.QuadTree#insert * @param {object} body - Description. */ insert: function (body) { @@ -169,7 +165,7 @@ Phaser.QuadTree.prototype = { /* * Determine which node the object belongs to. * - * @method getIndex + * @method Phaser.QuadTree#getIndex * @param {object} rect - Description. * @return {number} index - Index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node. */ @@ -213,7 +209,7 @@ Phaser.QuadTree.prototype = { /* * Return all objects that could collide with the given object. * - * @method retrieve + * @method Phaser.QuadTree#retrieve * @param {object} rect - Description. * @Return {array} - Array with all detected objects. */ @@ -249,7 +245,7 @@ Phaser.QuadTree.prototype = { /* * Clear the quadtree. - * @method clear + * @method Phaser.QuadTree#clear */ clear: function () { diff --git a/src/math/RandomDataGenerator.js b/src/math/RandomDataGenerator.js index 9f3c7d32..6b0dbccd 100644 --- a/src/math/RandomDataGenerator.js +++ b/src/math/RandomDataGenerator.js @@ -2,17 +2,15 @@ * @author Richard Davey * @copyright 2013 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} -* @module Phaser.RandomDataGenerator */ - /** * Phaser.RandomDataGenerator constructor. * * @class Phaser.RandomDataGenerator * @classdesc An extremely useful repeatable random data generator. Access it via Phaser.Game.rnd -* Based on Nonsense by Josh Faul {@link https://github.com/jocafa/Nonsense}. -* Random number generator from {@link http://baagoe.org/en/wiki/Better_random_numbers_for_javascript} +* Based on Nonsense by Josh Faul https://github.com/jocafa/Nonsense. +* Random number generator from http://baagoe.org/en/wiki/Better_random_numbers_for_javascript * * @constructor * @param {array} seeds @@ -53,7 +51,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Private random helper. - * @method rnd + * @method Phaser.RandomDataGenerator#rnd * @private * @return {number} Description. */ @@ -72,7 +70,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Reset the seed of the random data generator. * - * @method sow + * @method Phaser.RandomDataGenerator#sow * @param {array} seeds */ sow: function (seeds) { @@ -98,7 +96,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Description. - * @method hash + * @method Phaser.RandomDataGenerator#hash * @param {Any} data * @private * @return {number} Description. @@ -126,7 +124,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random integer between 0 and 2^32. - * @method integer + * @method Phaser.RandomDataGenerator#integer * @return {number} */ integer: function() { @@ -135,7 +133,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random real number between 0 and 1. - * @method frac + * @method Phaser.RandomDataGenerator#frac * @return {number} */ frac: function() { @@ -144,7 +142,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random real number between 0 and 2^32. - * @method real + * @method Phaser.RandomDataGenerator#real * @return {number} */ real: function() { @@ -153,7 +151,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random integer between min and max. - * @method integerInRange + * @method Phaser.RandomDataGenerator#integerInRange * @param {number} min * @param {number} max * @return {number} @@ -164,7 +162,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random real number between min and max. - * @method realInRange + * @method Phaser.RandomDataGenerator#realInRange * @param {number} min * @param {number} max * @return {number} @@ -180,7 +178,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random real number between -1 and 1. - * @method normal + * @method Phaser.RandomDataGenerator#normal * @return {number} */ normal: function () { @@ -188,8 +186,8 @@ Phaser.RandomDataGenerator.prototype = { }, /** - * Returns a valid RFC4122 version4 ID hex string (from {@link https://gist.github.com/1308368}). - * @method uuid + * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 + * @method Phaser.RandomDataGenerator#uuid * @return {string} */ uuid: function () { @@ -208,7 +206,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random member of `array`. - * @method pick + * @method Phaser.RandomDataGenerator#pick * @param {Any} ary * @return {number} */ @@ -218,7 +216,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random member of `array`, favoring the earlier entries. - * @method weightedPick + * @method Phaser.RandomDataGenerator#weightedPick * @param {Any} ary * @return {number} */ @@ -228,7 +226,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. - * @method timestamp + * @method Phaser.RandomDataGenerator#timestamp * @param {number} min * @param {number} max * @return {number} @@ -239,7 +237,7 @@ Phaser.RandomDataGenerator.prototype = { /** * Returns a random angle between -180 and 180. - * @method angle + * @method Phaser.RandomDataGenerator#angle * @return {number} */ angle: function() {