mirror of
https://github.com/photonstorm/phaser
synced 2024-11-17 02:08:40 +00:00
Merge pull request #1386 from pnstickne/wip-docs-1130
Assorted documentation/consistency updates
This commit is contained in:
commit
81f356c235
43 changed files with 586 additions and 397 deletions
|
@ -49,6 +49,7 @@
|
|||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu ">
|
||||
<li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Group.html">Group</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.World.html">World</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Loader.html">Loader</a></li>
|
||||
|
@ -71,6 +72,7 @@
|
|||
<li class="class-depth-1"><a href="Phaser.Image.html">Image</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Sound.html">Sound</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Emitter.html">Emitter</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Text.html">Text</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.Tween.html">Tween</a></li>
|
||||
<li class="class-depth-1"><a href="Phaser.BitmapText.html">BitmapText</a></li>
|
||||
|
|
|
@ -741,7 +741,7 @@ Object.defineProperty(Phaser.Animation.prototype, 'enableUpdate', {
|
|||
* @param {number} stop - The number to count to. If your frames are named 'explosion_0001' to 'explosion_0034' the stop value is 34.
|
||||
* @param {string} [suffix=''] - The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'.
|
||||
* @param {number} [zeroPad=0] - The number of zeroes to pad the min and max values with. If your frames are named 'explosion_0001' to 'explosion_0034' then the zeroPad is 4.
|
||||
* @return {array} An array of framenames.
|
||||
* @return {string[]} An array of framenames.
|
||||
*/
|
||||
Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zeroPad) {
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ Phaser.AnimationParser = {
|
|||
*
|
||||
* @method Phaser.AnimationParser.JSONData
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Object} json - The JSON data from the Texture Atlas. Must be in Array format.
|
||||
* @param {object} json - The JSON data from the Texture Atlas. Must be in Array format.
|
||||
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
|
||||
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||
*/
|
||||
|
@ -166,7 +166,7 @@ Phaser.AnimationParser = {
|
|||
*
|
||||
* @method Phaser.AnimationParser.JSONDataHash
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Object} json - The JSON data from the Texture Atlas. Must be in JSON Hash format.
|
||||
* @param {object} json - The JSON data from the Texture Atlas. Must be in JSON Hash format.
|
||||
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
|
||||
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||
*/
|
||||
|
@ -234,7 +234,7 @@ Phaser.AnimationParser = {
|
|||
*
|
||||
* @method Phaser.AnimationParser.XMLData
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Object} xml - The XML data from the Texture Atlas. Must be in Starling XML format.
|
||||
* @param {object} xml - The XML data from the Texture Atlas. Must be in Starling XML format.
|
||||
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
|
||||
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||
*/
|
||||
|
|
|
@ -99,7 +99,7 @@ Phaser.Camera = function (game, id, x, y, width, height) {
|
|||
|
||||
/**
|
||||
* @property {number} totalInView - The total number of Sprites with `autoCull` set to `true` that are visible by this Camera.
|
||||
* @readOnly
|
||||
* @readonly
|
||||
*/
|
||||
this.totalInView = 0;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* @class Phaser.Filter
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Object} uniforms - Uniform mappings object
|
||||
* @param {object} uniforms - Uniform mappings object
|
||||
* @param {Array} fragmentSrc - The fragment shader code.
|
||||
*/
|
||||
Phaser.Filter = function (game, uniforms, fragmentSrc) {
|
||||
|
|
|
@ -107,7 +107,7 @@ Phaser.FlexGrid.prototype = {
|
|||
* @method Phaser.FlexGrid#createCustomLayer
|
||||
* @param {number} width - Width of this layer in pixels.
|
||||
* @param {number} height - Height of this layer in pixels.
|
||||
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
|
||||
* @param {PIXI.DisplayObject[]} [children] - An array of children that are used to populate the FlexLayer.
|
||||
* @return {Phaser.FlexLayer} The Layer object.
|
||||
*/
|
||||
createCustomLayer: function (width, height, children, addToWorld) {
|
||||
|
@ -195,7 +195,7 @@ Phaser.FlexGrid.prototype = {
|
|||
* A fixed layer is centered on the game and is the size of the required dimensions and is never scaled.
|
||||
*
|
||||
* @method Phaser.FlexGrid#createFixedLayer
|
||||
* @param {array} [children] - An array of children that are used to populate the FlexLayer.
|
||||
* @param {PIXI.DisplayObject[]} [children] - An array of children that are used to populate the FlexLayer.
|
||||
* @return {Phaser.FlexLayer} The Layer object.
|
||||
*/
|
||||
createFixedLayer: function (children) {
|
||||
|
|
|
@ -26,6 +26,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
|||
|
||||
/**
|
||||
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
|
||||
* @readonly
|
||||
*/
|
||||
this.id = Phaser.GAMES.push(this) - 1;
|
||||
|
||||
|
@ -99,11 +100,13 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
|||
|
||||
/**
|
||||
* @property {PIXI.CanvasRenderer|PIXI.WebGLRenderer} renderer - The Pixi Renderer.
|
||||
* @protected
|
||||
*/
|
||||
this.renderer = null;
|
||||
|
||||
/**
|
||||
* @property {number} renderType - The Renderer this game will use. Either Phaser.AUTO, Phaser.CANVAS or Phaser.WEBGL.
|
||||
* @readonly
|
||||
*/
|
||||
this.renderType = Phaser.AUTO;
|
||||
|
||||
|
@ -114,18 +117,19 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
|||
|
||||
/**
|
||||
* @property {boolean} isBooted - Whether the game engine is booted, aka available.
|
||||
* @default
|
||||
* @readonly
|
||||
*/
|
||||
this.isBooted = false;
|
||||
|
||||
/**
|
||||
* @property {boolean} id -Is game running or paused?
|
||||
* @default
|
||||
* @property {boolean} isRunning - Is game running or paused?
|
||||
* @readonly
|
||||
*/
|
||||
this.isRunning = false;
|
||||
|
||||
/**
|
||||
* @property {Phaser.RequestAnimationFrame} raf - Automatically handles the core game loop via requestAnimationFrame or setTimeout
|
||||
* @protected
|
||||
*/
|
||||
this.raf = null;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,7 @@
|
|||
* @class Phaser.Plugin
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {Any} parent - The object that owns this plugin, usually Phaser.PluginManager.
|
||||
* @param {any} parent - The object that owns this plugin, usually Phaser.PluginManager.
|
||||
*/
|
||||
Phaser.Plugin = function (game, parent) {
|
||||
|
||||
|
@ -22,7 +22,7 @@ Phaser.Plugin = function (game, parent) {
|
|||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Any} parent - The parent of this plugin. If added to the PluginManager the parent will be set to that, otherwise it will be null.
|
||||
* @property {any} parent - The parent of this plugin. If added to the PluginManager the parent will be set to that, otherwise it will be null.
|
||||
*/
|
||||
this.parent = parent;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ Phaser.PluginManager = function(game) {
|
|||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {array} plugins - An array of all the plugins being managed by this PluginManager.
|
||||
* @property {Phaser.Plugin[]} plugins - An array of all the plugins being managed by this PluginManager.
|
||||
*/
|
||||
this.plugins = [];
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* A Signal is used for object communication via a custom broadcaster instead of Events.
|
||||
* A Signal is an event dispatch mechansim than supports broadcasting to multiple listeners.
|
||||
*
|
||||
* Event listeners are uniquely identified by the listener/callback function and the context.
|
||||
*
|
||||
* @class Phaser.Signal
|
||||
* @constructor
|
||||
|
@ -29,9 +31,11 @@ Phaser.Signal.prototype = {
|
|||
_prevParams: null,
|
||||
|
||||
/**
|
||||
* If Signal should keep record of previously dispatched parameters and
|
||||
* automatically execute listener during `add()`/`addOnce()` if Signal was
|
||||
* already dispatched before.
|
||||
* Memorize the previously dispatched event?
|
||||
*
|
||||
* If an event has been memorized it is automatically dispatched when a new listener is added with {@link #add} or {@link #addOnce}.
|
||||
* Use {@link #forget} to clear any currently memorized event.
|
||||
*
|
||||
* @property {boolean} memorize
|
||||
*/
|
||||
memorize: false,
|
||||
|
@ -43,8 +47,10 @@ Phaser.Signal.prototype = {
|
|||
_shouldPropagate: true,
|
||||
|
||||
/**
|
||||
* If Signal is active and should broadcast events.
|
||||
* IMPORTANT: Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.
|
||||
* Is the Signal active? Only active signal will broadcast dispatched events.
|
||||
*
|
||||
* Setting this property during a dispatch will only affect the next dispatch. To stop the propagation of a signal from a listener use {@link #halt}.
|
||||
*
|
||||
* @property {boolean} active
|
||||
* @default
|
||||
*/
|
||||
|
@ -167,7 +173,7 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Check if listener was attached to Signal.
|
||||
* Check if a specific listener is attached.
|
||||
*
|
||||
* @method Phaser.Signal#has
|
||||
* @param {function} listener - Signal handler function.
|
||||
|
@ -181,7 +187,7 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Add a listener to the signal.
|
||||
* Add an event listener.
|
||||
*
|
||||
* @method Phaser.Signal#add
|
||||
* @param {function} listener - The function to call when this Signal is dispatched.
|
||||
|
@ -198,7 +204,10 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Add listener to the signal that should be removed after first execution (will be executed only once).
|
||||
* Add a one-time listener - the listener is automatically removed after the first execution.
|
||||
*
|
||||
* If there is as {@link Phaser.Signal#memorize memorized} event then it will be dispatched and
|
||||
* the listener will be removed immediately.
|
||||
*
|
||||
* @method Phaser.Signal#addOnce
|
||||
* @param {function} listener - The function to call when this Signal is dispatched.
|
||||
|
@ -215,7 +224,7 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Remove a single listener from the dispatch queue.
|
||||
* Remove a single event listener.
|
||||
*
|
||||
* @method Phaser.Signal#remove
|
||||
* @param {function} listener - Handler function that should be removed.
|
||||
|
@ -239,7 +248,7 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Remove all listeners from the Signal.
|
||||
* Remove all event listeners.
|
||||
*
|
||||
* @method Phaser.Signal#removeAll
|
||||
* @param {object} [context=null] - If specified only listeners for the given context will be removed.
|
||||
|
@ -282,7 +291,7 @@ Phaser.Signal.prototype = {
|
|||
* Gets the total number of listeners attached to this Signal.
|
||||
*
|
||||
* @method Phaser.Signal#getNumListeners
|
||||
* @return {number} Number of listeners attached to the Signal.
|
||||
* @return {integer} Number of listeners attached to the Signal.
|
||||
*/
|
||||
getNumListeners: function () {
|
||||
|
||||
|
@ -292,8 +301,9 @@ Phaser.Signal.prototype = {
|
|||
|
||||
/**
|
||||
* Stop propagation of the event, blocking the dispatch to next listener on the queue.
|
||||
* IMPORTANT: should be called only during signal dispatch, calling it before/after dispatch won't affect signal broadcast.
|
||||
* @see Signal.prototype.disable
|
||||
*
|
||||
* This should be called only during event dispatch as calling it before/after dispatch won't affect other broadcast.
|
||||
* See {@link #active} to enable/disable the signal entirely.
|
||||
*
|
||||
* @method Phaser.Signal#halt
|
||||
*/
|
||||
|
@ -304,9 +314,9 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Dispatch/Broadcast Signal to all listeners added to the queue.
|
||||
* Dispatch / broadcast the event to all listeners.
|
||||
*
|
||||
* To create a bound dispatch for this Signal, use {@link Phaser.Signal#boundDispatch}.
|
||||
* To create an instance-bound dispatch for this Signal, use {@link #boundDispatch}.
|
||||
*
|
||||
* @method Phaser.Signal#dispatch
|
||||
* @param {any} [params] - Parameters that should be passed to each handler.
|
||||
|
@ -346,8 +356,7 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Forget memorized arguments.
|
||||
* @see Signal.memorize
|
||||
* Forget the currently {@link Phaser.Signal#memorize memorized} event, if any.
|
||||
*
|
||||
* @method Phaser.Signal#forget
|
||||
*/
|
||||
|
@ -361,8 +370,10 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).
|
||||
* IMPORTANT: calling any method on the signal instance after calling dispose will throw errors.
|
||||
* Dispose the signal - no more events can be dispatched.
|
||||
*
|
||||
* This removes all event listeners and clears references to external objects.
|
||||
* Calling methods on a disposed objects results in undefined behavior.
|
||||
*
|
||||
* @method Phaser.Signal#dispose
|
||||
*/
|
||||
|
@ -379,6 +390,7 @@ Phaser.Signal.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* A string representation of the object.
|
||||
*
|
||||
* @method Phaser.Signal#toString
|
||||
* @return {string} String representation of the object.
|
||||
|
@ -392,8 +404,10 @@ Phaser.Signal.prototype = {
|
|||
};
|
||||
|
||||
/**
|
||||
* If the dispatch function needs to be passed somewhere, or called independently
|
||||
* of the Signal object, use this function.
|
||||
* Create a `dispatch` function that maintains a binding to the original Signal context.
|
||||
*
|
||||
* Use the resulting value if the dispatch function needs to be passed somewhere
|
||||
* or called independently of the Signal object.
|
||||
*
|
||||
* @memberof Phaser.Signal
|
||||
* @property {function} boundDispatch
|
||||
|
|
|
@ -91,7 +91,7 @@ Phaser.SignalBinding.prototype = {
|
|||
* Call listener passing arbitrary parameters.
|
||||
* If binding was added using `Signal.addOnce()` it will be automatically removed from signal dispatch queue, this method is used internally for the signal dispatch.
|
||||
* @method Phaser.SignalBinding#execute
|
||||
* @param {array} [paramsArr] - Array of parameters that should be passed to the listener.
|
||||
* @param {any[]} [paramsArr] - Array of parameters that should be passed to the listener.
|
||||
* @return {any} Value returned by the listener.
|
||||
*/
|
||||
execute: function(paramsArr) {
|
||||
|
|
|
@ -22,7 +22,7 @@ Phaser.StateManager = function (game, pendingState) {
|
|||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Object} states - The object containing Phaser.States.
|
||||
* @property {object} states - The object containing Phaser.States.
|
||||
*/
|
||||
this.states = {};
|
||||
|
||||
|
@ -56,7 +56,7 @@ Phaser.StateManager = function (game, pendingState) {
|
|||
this._created = false;
|
||||
|
||||
/**
|
||||
* @property {array} _args - Temporary container when you pass vars from one State to another.
|
||||
* @property {any[]} _args - Temporary container when you pass vars from one State to another.
|
||||
* @private
|
||||
*/
|
||||
this._args = [];
|
||||
|
|
|
@ -164,7 +164,7 @@ Phaser.BitmapData = function (game, key, width, height) {
|
|||
this._rotate = 0;
|
||||
|
||||
/**
|
||||
* @property {Object} _alpha - Internal cache var.
|
||||
* @property {object} _alpha - Internal cache var.
|
||||
* @private
|
||||
*/
|
||||
this._alpha = { prev: 1, current: 1 };
|
||||
|
@ -1792,7 +1792,7 @@ Object.defineProperty(Phaser.BitmapData.prototype, "smoothed", {
|
|||
* @param {number} scaleY - The scale y value.
|
||||
* @param {number} skewX - The skew x value.
|
||||
* @param {number} skewY - The skew y value.
|
||||
* @return {Object} A JavaScript object containing all of the properties BitmapData needs for transforms.
|
||||
* @return {object} A JavaScript object containing all of the properties BitmapData needs for transforms.
|
||||
*/
|
||||
Phaser.BitmapData.getTransform = function (translateX, translateY, scaleX, scaleY, skewX, skewY) {
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The Game Object Creator is a quick way to create all of the different sorts of core objects that Phaser uses, but not add them to the game world.
|
||||
* Use the GameObjectFactory to create and add the objects into the world.
|
||||
* The GameObjectCreator is a quick way to create common game objects _without_ adding them to the game world.
|
||||
* The object creator can be accessed with {@linkcode Phaser.Game#make `game.make`}.
|
||||
*
|
||||
* @class Phaser.GameObjectCreator
|
||||
* @constructor
|
||||
|
@ -16,11 +16,13 @@ Phaser.GameObjectCreator = function (game) {
|
|||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||
* @protected
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.World} world - A reference to the game world.
|
||||
* @protected
|
||||
*/
|
||||
this.world = this.game.world;
|
||||
|
||||
|
@ -29,7 +31,9 @@ Phaser.GameObjectCreator = function (game) {
|
|||
Phaser.GameObjectCreator.prototype = {
|
||||
|
||||
/**
|
||||
* Create a new `Image` object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
|
||||
* Create a new Image object.
|
||||
*
|
||||
* An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
|
||||
* It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
|
||||
*
|
||||
* @method Phaser.GameObjectCreator#image
|
||||
|
@ -37,7 +41,7 @@ Phaser.GameObjectCreator.prototype = {
|
|||
* @param {number} y - Y position of the image.
|
||||
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||
* @returns {Phaser.Sprite} the newly created sprite object.
|
||||
* @returns {Phaser.Image} the newly created sprite object.
|
||||
*/
|
||||
image: function (x, y, key, frame) {
|
||||
|
||||
|
@ -62,7 +66,9 @@ Phaser.GameObjectCreator.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
* Create a tween object for a specific object.
|
||||
*
|
||||
* The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @method Phaser.GameObjectCreator#tween
|
||||
* @param {object} obj - Object the tween will be run on.
|
||||
|
@ -92,13 +98,13 @@ Phaser.GameObjectCreator.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
|
||||
* Create a new SpriteBatch.
|
||||
*
|
||||
* @method Phaser.GameObjectCreator#spriteBatch
|
||||
* @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
|
||||
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
|
||||
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
|
||||
* @return {Phaser.Group} The newly created group.
|
||||
* @return {Phaser.SpriteBatch} The newly created group.
|
||||
*/
|
||||
spriteBatch: function (parent, name, addToStage) {
|
||||
|
||||
|
@ -242,7 +248,9 @@ Phaser.GameObjectCreator.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
|
||||
* Creat a new Emitter.
|
||||
*
|
||||
* An Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
|
||||
* continuous effects like rain and fire. All it really does is launch Particle objects out
|
||||
* at set intervals, and fixes their positions and velocities accorindgly.
|
||||
*
|
||||
|
@ -259,7 +267,9 @@ Phaser.GameObjectCreator.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Create a new RetroFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* Create a new RetroFont object.
|
||||
*
|
||||
* A RetroFont can be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* A RetroFont uses a bitmap which contains fixed with characters for the font set. You use character spacing to define the set.
|
||||
* If you need variable width character support then use a BitmapText object instead. The main difference between a RetroFont and a BitmapText
|
||||
* is that a RetroFont creates a single texture that you can apply to a game object, where-as a BitmapText creates one Sprite object per letter of text.
|
||||
|
@ -302,7 +312,9 @@ Phaser.GameObjectCreator.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Creates a new Phaser.Tilemap object. The map can either be populated with data from a Tiled JSON file or from a CSV file.
|
||||
* Creates a new Phaser.Tilemap object.
|
||||
*
|
||||
* The map can either be populated with data from a Tiled JSON file or from a CSV file.
|
||||
* To do this pass the Cache key as the first parameter. When using Tiled data you need only provide the key.
|
||||
* When using CSV data you must provide the key and the tileWidth and tileHeight parameters.
|
||||
* If creating a blank tilemap to be populated later, you can either specify no parameters at all and then use `Tilemap.create` or pass the map and tile dimensions here.
|
||||
|
@ -348,7 +360,9 @@ Phaser.GameObjectCreator.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
|
||||
* Create a BitmpaData object.
|
||||
*
|
||||
* A BitmapData object can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
|
||||
*
|
||||
* @method Phaser.GameObjectCreator#bitmapData
|
||||
* @param {number} [width=256] - The width of the BitmapData in pixels.
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The Game Object Factory is a quick way to create all of the different sorts of core objects that Phaser uses.
|
||||
* The GameObjectFactory is a quick way to create mamy common game objects
|
||||
* using {@linkcode Phaser.Game#add `game.add`}.
|
||||
*
|
||||
* Created objects are _automtically added_ to the appropriate Manager, World, or manually specified parent Group.
|
||||
*
|
||||
* @class Phaser.GameObjectFactory
|
||||
* @constructor
|
||||
|
@ -15,11 +18,13 @@ Phaser.GameObjectFactory = function (game) {
|
|||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||
* @protected
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Phaser.World} world - A reference to the game world.
|
||||
* @protected
|
||||
*/
|
||||
this.world = this.game.world;
|
||||
|
||||
|
@ -30,8 +35,8 @@ Phaser.GameObjectFactory.prototype = {
|
|||
/**
|
||||
* Adds an existing object to the game world.
|
||||
* @method Phaser.GameObjectFactory#existing
|
||||
* @param {*} object - An instance of Phaser.Sprite, Phaser.Button or any other display object..
|
||||
* @return {*} The child that was added to the Group.
|
||||
* @param {any} object - An instance of Phaser.Sprite, Phaser.Button or any other display object..
|
||||
* @return {any} The child that was added to the Group.
|
||||
*/
|
||||
existing: function (object) {
|
||||
|
||||
|
@ -257,15 +262,15 @@ Phaser.GameObjectFactory.prototype = {
|
|||
* Creates a new Button object.
|
||||
*
|
||||
* @method Phaser.GameObjectFactory#button
|
||||
* @param {number} [x] X position of the new button object.
|
||||
* @param {number} [y] Y position of the new button object.
|
||||
* @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
|
||||
* @param {function} [callback] The function to call when this button is pressed
|
||||
* @param {object} [callbackContext] The context in which the callback will be called (usually 'this')
|
||||
* @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {string|number} [upFrame] This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {number} [x] - X position of the new button object.
|
||||
* @param {number} [y] - Y position of the new button object.
|
||||
* @param {string} [key] - The image key as defined in the Game.Cache to use as the texture for this button.
|
||||
* @param {function} [callback] - The function to call when this button is pressed
|
||||
* @param {object} [callbackContext] - The context in which the callback will be called (usually 'this')
|
||||
* @param {string|number} [overFrame] - This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {string|number} [outFrame] - This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {string|number} [downFrame] - This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {string|number} [upFrame] - This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||
* @return {Phaser.Button} The newly created button object.
|
||||
*/
|
||||
|
@ -295,7 +300,9 @@ Phaser.GameObjectFactory.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
|
||||
* Create a new Emitter.
|
||||
*
|
||||
* A particle emitter can be used for one-time explosions or for
|
||||
* continuous effects like rain and fire. All it really does is launch Particle objects out
|
||||
* at set intervals, and fixes their positions and velocities accorindgly.
|
||||
*
|
||||
|
@ -312,7 +319,9 @@ Phaser.GameObjectFactory.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Create a new RetroFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* Create a new RetroFont object.
|
||||
*
|
||||
* A RetroFont can be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* A RetroFont uses a bitmap which contains fixed with characters for the font set. You use character spacing to define the set.
|
||||
* If you need variable width character support then use a BitmapText object instead. The main difference between a RetroFont and a BitmapText
|
||||
* is that a RetroFont creates a single texture that you can apply to a game object, where-as a BitmapText creates one Sprite object per letter of text.
|
||||
|
@ -358,7 +367,9 @@ Phaser.GameObjectFactory.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Creates a new Phaser.Tilemap object. The map can either be populated with data from a Tiled JSON file or from a CSV file.
|
||||
* Creates a new Phaser.Tilemap object.
|
||||
*
|
||||
* The map can either be populated with data from a Tiled JSON file or from a CSV file.
|
||||
* To do this pass the Cache key as the first parameter. When using Tiled data you need only provide the key.
|
||||
* When using CSV data you must provide the key and the tileWidth and tileHeight parameters.
|
||||
* If creating a blank tilemap to be populated later, you can either specify no parameters at all and then use `Tilemap.create` or pass the map and tile dimensions here.
|
||||
|
@ -405,7 +416,9 @@ Phaser.GameObjectFactory.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
|
||||
* Create a BitmapData object.
|
||||
*
|
||||
* A BitmapData object can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
|
||||
*
|
||||
* @method Phaser.GameObjectFactory#bitmapData
|
||||
* @param {number} [width=256] - The width of the BitmapData in pixels.
|
||||
|
@ -452,7 +465,8 @@ Phaser.GameObjectFactory.prototype = {
|
|||
|
||||
/**
|
||||
* Add a new Plugin into the PluginManager.
|
||||
* The Plugin must have 2 properties: game and parent. Plugin.game is set to the game reference the PluginManager uses, and parent is set to the PluginManager.
|
||||
*
|
||||
* The Plugin must have 2 properties: `game` and `parent`. Plugin.game is set to the game reference the PluginManager uses, and parent is set to the PluginManager.
|
||||
*
|
||||
* @method Phaser.GameObjectFactory#plugin
|
||||
* @param {object|Phaser.Plugin} plugin - The Plugin to add into the PluginManager. This can be a function or an existing object.
|
||||
|
|
|
@ -791,7 +791,7 @@ Object.defineProperty(Phaser.Rope.prototype, "updateAnimation", {
|
|||
* The segments that make up the rope body as an array of Phaser.Rectangles
|
||||
*
|
||||
* @name Phaser.Rope#segments
|
||||
* @property {array} updateAnimation - Returns an array of Phaser.Rectangles that represent the segments of the given rope
|
||||
* @property {Phaser.Rectangles[]} updateAnimation - Returns an array of Phaser.Rectangles that represent the segments of the given rope
|
||||
*/
|
||||
Object.defineProperty(Phaser.Rope.prototype, "segments", {
|
||||
get: function() {
|
||||
|
|
|
@ -317,7 +317,7 @@ Phaser.Text.prototype.setShadow = function (x, y, color, blur) {
|
|||
* Set the style of the text by passing a single style object to it.
|
||||
*
|
||||
* @method Phaser.Text#setStyle
|
||||
* @param {Object} [style] - The style properties to be set on the Text.
|
||||
* @param {object} [style] - The style properties to be set on the Text.
|
||||
* @param {string} [style.font='bold 20pt Arial'] - The style and size of the font.
|
||||
* @param {string} [style.fill='black'] - A canvas fillstyle that will be used on the text eg 'red', '#00FF00'.
|
||||
* @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text.
|
||||
|
|
|
@ -108,7 +108,7 @@ Phaser.Circle.prototype = {
|
|||
* Copies the x, y and diameter properties from this Circle to any given object.
|
||||
* @method Phaser.Circle#copyTo
|
||||
* @param {any} dest - The object to copy to.
|
||||
* @return {Object} This dest object.
|
||||
* @return {object} This dest object.
|
||||
*/
|
||||
copyTo: function (dest) {
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ Phaser.Ellipse.prototype = {
|
|||
* Copies the x, y, width and height properties from this Ellipse to any given object.
|
||||
* @method Phaser.Ellipse#copyTo
|
||||
* @param {any} dest - The object to copy to.
|
||||
* @return {Object} This dest object.
|
||||
* @return {object} This dest object.
|
||||
*/
|
||||
copyTo: function(dest) {
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ Phaser.Point.prototype = {
|
|||
*
|
||||
* @method Phaser.Point#copyTo
|
||||
* @param {any} dest - The object to copy to.
|
||||
* @return {Object} The dest object.
|
||||
* @return {object} The dest object.
|
||||
*/
|
||||
copyTo: function (dest) {
|
||||
|
||||
|
@ -886,7 +886,7 @@ Phaser.Point.centroid = function (points, out) {
|
|||
*
|
||||
* @method Phaser.Point.parse
|
||||
* @static
|
||||
* @param {Object} obj - The object to parse.
|
||||
* @param {object} obj - The object to parse.
|
||||
* @param {string} [xProp='x'] - The property used to set the Point.x value.
|
||||
* @param {string} [yProp='y'] - The property used to set the Point.y value.
|
||||
* @return {Phaser.Point} The new Point object.
|
||||
|
|
|
@ -26,7 +26,7 @@ Phaser.Gamepad = function (game) {
|
|||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Object} _gamepadIndexMap - Maps the browsers gamepad indices to our Phaser Gamepads
|
||||
* @property {object} _gamepadIndexMap - Maps the browsers gamepad indices to our Phaser Gamepads
|
||||
* @private
|
||||
*/
|
||||
this._gamepadIndexMap = {};
|
||||
|
@ -75,7 +75,7 @@ Phaser.Gamepad = function (game) {
|
|||
this._prevTimestamps = [];
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which the callbacks are run.
|
||||
* @property {object} callbackContext - The context under which the callbacks are run.
|
||||
*/
|
||||
this.callbackContext = this;
|
||||
|
||||
|
@ -140,8 +140,8 @@ Phaser.Gamepad.prototype = {
|
|||
* Add callbacks to the main Gamepad handler to handle connect/disconnect/button down/button up/axis change/float value buttons.
|
||||
*
|
||||
* @method Phaser.Gamepad#addCallbacks
|
||||
* @param {Object} context - The context under which the callbacks are run.
|
||||
* @param {Object} callbacks - Object that takes six different callback methods:
|
||||
* @param {object} context - The context under which the callbacks are run.
|
||||
* @param {object} callbacks - Object that takes six different callback methods:
|
||||
* onConnectCallback, onDisconnectCallback, onDownCallback, onUpCallback, onAxisCallback, onFloatCallback
|
||||
*/
|
||||
addCallbacks: function (context, callbacks) {
|
||||
|
|
|
@ -587,7 +587,7 @@ Phaser.Input.prototype = {
|
|||
*
|
||||
* @method Phaser.Input#startPointer
|
||||
* @protected
|
||||
* @param {Any} event - The event data from the Touch event.
|
||||
* @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) {
|
||||
|
@ -625,7 +625,7 @@ Phaser.Input.prototype = {
|
|||
*
|
||||
* @method Phaser.Input#updatePointer
|
||||
* @protected
|
||||
* @param {Any} event - The event data from the Touch event.
|
||||
* @param {any} event - The event data from the Touch event.
|
||||
* @return {Phaser.Pointer} The Pointer object that was updated; null if no pointer was updated.
|
||||
*/
|
||||
updatePointer: function (event) {
|
||||
|
@ -657,7 +657,7 @@ Phaser.Input.prototype = {
|
|||
*
|
||||
* @method Phaser.Input#stopPointer
|
||||
* @protected
|
||||
* @param {Any} event - The event data from the Touch event.
|
||||
* @param {any} event - The event data from the Touch event.
|
||||
* @return {Phaser.Pointer} The Pointer object that was stopped or null if no Pointer object is available.
|
||||
*/
|
||||
stopPointer: function (event) {
|
||||
|
|
|
@ -29,17 +29,17 @@ Phaser.Keyboard = function (game) {
|
|||
this.enabled = true;
|
||||
|
||||
/**
|
||||
* @property {Object} event - The most recent DOM event from keydown or keyup. This is updated every time a new key is pressed or released.
|
||||
* @property {object} event - The most recent DOM event from keydown or keyup. This is updated every time a new key is pressed or released.
|
||||
*/
|
||||
this.event = null;
|
||||
|
||||
/**
|
||||
* @property {Object} pressEvent - The most recent DOM event from keypress.
|
||||
* @property {object} pressEvent - The most recent DOM event from keypress.
|
||||
*/
|
||||
this.pressEvent = null;
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which the callbacks are run.
|
||||
* @property {object} callbackContext - The context under which the callbacks are run.
|
||||
*/
|
||||
this.callbackContext = this;
|
||||
|
||||
|
@ -111,7 +111,7 @@ Phaser.Keyboard.prototype = {
|
|||
* Add callbacks to the Keyboard handler so that each time a key is pressed down or released the callbacks are activated.
|
||||
*
|
||||
* @method Phaser.Keyboard#addCallbacks
|
||||
* @param {Object} context - The context under which the callbacks are run.
|
||||
* @param {object} context - The context under which the callbacks are run.
|
||||
* @param {function} [onDown=null] - 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.
|
||||
* @param {function} [onPress=null] - This callback is invoked every time the onkeypress event is raised.
|
||||
|
|
|
@ -22,7 +22,7 @@ Phaser.MSPointer = function (game) {
|
|||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which callbacks are called (defaults to game).
|
||||
* @property {object} callbackContext - The context under which callbacks are called (defaults to game).
|
||||
*/
|
||||
this.callbackContext = this.game;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Phaser.Mouse = function (game) {
|
|||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which callbacks are called.
|
||||
* @property {object} callbackContext - The context under which callbacks are called.
|
||||
*/
|
||||
this.callbackContext = this.game;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* @class Phaser.SinglePad
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - Current game instance.
|
||||
* @param {Object} padParent - The parent Phaser.Gamepad object (all gamepads reside under this)
|
||||
* @param {object} padParent - The parent Phaser.Gamepad object (all gamepads reside under this)
|
||||
*/
|
||||
Phaser.SinglePad = function (game, padParent) {
|
||||
|
||||
|
@ -33,7 +33,7 @@ Phaser.SinglePad = function (game, padParent) {
|
|||
this.connected = false;
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which the callbacks are run.
|
||||
* @property {object} callbackContext - The context under which the callbacks are run.
|
||||
*/
|
||||
this.callbackContext = this;
|
||||
|
||||
|
@ -79,7 +79,7 @@ Phaser.SinglePad = function (game, padParent) {
|
|||
this._padParent = padParent;
|
||||
|
||||
/**
|
||||
* @property {Object} _rawPad - The 'raw' gamepad data.
|
||||
* @property {object} _rawPad - The 'raw' gamepad data.
|
||||
* @private
|
||||
*/
|
||||
this._rawPad = null;
|
||||
|
@ -122,8 +122,8 @@ Phaser.SinglePad.prototype = {
|
|||
* Add callbacks to this Gamepad to handle connect / disconnect / button down / button up / axis change / float value buttons.
|
||||
*
|
||||
* @method Phaser.SinglePad#addCallbacks
|
||||
* @param {Object} context - The context under which the callbacks are run.
|
||||
* @param {Object} callbacks - Object that takes six different callbak methods:
|
||||
* @param {object} context - The context under which the callbacks are run.
|
||||
* @param {object} callbacks - Object that takes six different callbak methods:
|
||||
* onConnectCallback, onDisconnectCallback, onDownCallback, onUpCallback, onAxisCallback, onFloatCallback
|
||||
*/
|
||||
addCallbacks: function (context, callbacks) {
|
||||
|
@ -216,7 +216,7 @@ Phaser.SinglePad.prototype = {
|
|||
* Gamepad connect function, should be called by Phaser.Gamepad.
|
||||
*
|
||||
* @method Phaser.SinglePad#connect
|
||||
* @param {Object} rawPad - The raw gamepad object
|
||||
* @param {object} rawPad - The raw gamepad object
|
||||
*/
|
||||
connect: function (rawPad) {
|
||||
|
||||
|
@ -327,7 +327,7 @@ Phaser.SinglePad.prototype = {
|
|||
* Handles changes in axis.
|
||||
*
|
||||
* @method Phaser.SinglePad#processAxisChange
|
||||
* @param {Object} axisState - State of the relevant axis
|
||||
* @param {object} axisState - State of the relevant axis
|
||||
*/
|
||||
processAxisChange: function (index, value) {
|
||||
|
||||
|
@ -355,7 +355,7 @@ Phaser.SinglePad.prototype = {
|
|||
*
|
||||
* @method Phaser.SinglePad#processButtonDown
|
||||
* @param {number} buttonCode - Which buttonCode of this button
|
||||
* @param {Object} value - Button value
|
||||
* @param {object} value - Button value
|
||||
*/
|
||||
processButtonDown: function (buttonCode, value) {
|
||||
|
||||
|
@ -381,7 +381,7 @@ Phaser.SinglePad.prototype = {
|
|||
*
|
||||
* @method Phaser.SinglePad#processButtonUp
|
||||
* @param {number} buttonCode - Which buttonCode of this button
|
||||
* @param {Object} value - Button value
|
||||
* @param {object} value - Button value
|
||||
*/
|
||||
processButtonUp: function (buttonCode, value) {
|
||||
|
||||
|
@ -407,7 +407,7 @@ Phaser.SinglePad.prototype = {
|
|||
*
|
||||
* @method Phaser.SinglePad#processButtonFloat
|
||||
* @param {number} buttonCode - Which buttonCode of this button
|
||||
* @param {Object} value - Button value (will range somewhere between 0 and 1, but not specifically 0 or 1.
|
||||
* @param {object} value - Button value (will range somewhere between 0 and 1, but not specifically 0 or 1.
|
||||
*/
|
||||
processButtonFloat: function (buttonCode, value) {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Phaser.Touch = function (game) {
|
|||
this.enabled = true;
|
||||
|
||||
/**
|
||||
* @property {Object} callbackContext - The context under which callbacks are called.
|
||||
* @property {object} callbackContext - The context under which callbacks are called.
|
||||
*/
|
||||
this.callbackContext = this.game;
|
||||
|
||||
|
|
|
@ -959,7 +959,7 @@ Phaser.Cache.prototype = {
|
|||
*
|
||||
* @method Phaser.Cache#getTilemapData
|
||||
* @param {string} key - Asset key of the tilemap data to retrieve from the Cache.
|
||||
* @return {Object} The raw tilemap data in CSV or JSON format.
|
||||
* @return {object} The raw tilemap data in CSV or JSON format.
|
||||
*/
|
||||
getTilemapData: function (key) {
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ Phaser.Math = {
|
|||
* @method Phaser.Math#numberArray
|
||||
* @param {number} start - The minimum value the array starts with.
|
||||
* @param {number} end - The maximum value the array contains.
|
||||
* @return {array} The array of number values.
|
||||
* @return {number[]} The array of number values.
|
||||
* @deprecated 2.2.0 - See {@link Phaser.ArrayUtils.numberArray}
|
||||
*/
|
||||
numberArray: function (start, end) {
|
||||
|
@ -933,10 +933,10 @@ Phaser.Math = {
|
|||
* 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 {any[]} 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.
|
||||
* @return {any} The random object that was selected.
|
||||
* @deprecated 2.2.0 - Use {@link Phaser.ArrayUtils.getRandomItem}
|
||||
*/
|
||||
getRandom: function (objects, startIndex, length) {
|
||||
|
@ -948,10 +948,10 @@ Phaser.Math = {
|
|||
* Will return null if random selection is missing, or array has no entries.
|
||||
*
|
||||
* @method Phaser.Math#removeRandom
|
||||
* @param {array} objects - An array of objects.
|
||||
* @param {any[]} 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 removed.
|
||||
* @return {any} The random object that was removed.
|
||||
* @deprecated 2.2.0 - Use {@link Phaser.ArrayUtils.removeRandomItem}
|
||||
*/
|
||||
removeRandom: function (objects, startIndex, length) {
|
||||
|
@ -1062,8 +1062,8 @@ Phaser.Math = {
|
|||
/**
|
||||
* 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
|
||||
* @param {any[]} array - The array to shuffle
|
||||
* @return {any[]} The array
|
||||
* @deprecated 2.2.0 - Use {@link Phaser.ArrayUtils.shuffle}
|
||||
*/
|
||||
shuffleArray: function (array) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @class Phaser.RandomDataGenerator
|
||||
* @constructor
|
||||
* @param {array} [seeds] - An array of values to use as the seed.
|
||||
* @param {any[]} [seeds] - An array of values to use as the seed.
|
||||
*/
|
||||
Phaser.RandomDataGenerator = function (seeds) {
|
||||
|
||||
|
@ -72,7 +72,7 @@ Phaser.RandomDataGenerator.prototype = {
|
|||
* Reset the seed of the random data generator.
|
||||
*
|
||||
* @method Phaser.RandomDataGenerator#sow
|
||||
* @param {array} seeds
|
||||
* @param {any[]} seeds
|
||||
*/
|
||||
sow: function (seeds) {
|
||||
|
||||
|
@ -102,7 +102,7 @@ Phaser.RandomDataGenerator.prototype = {
|
|||
*
|
||||
* @method Phaser.RandomDataGenerator#hash
|
||||
* @private
|
||||
* @param {Any} data
|
||||
* @param {any} data
|
||||
* @return {number} hashed value.
|
||||
*/
|
||||
hash: function (data) {
|
||||
|
|
|
@ -1398,7 +1398,7 @@ Phaser.Physics.Arcade.prototype = {
|
|||
* @param {Phaser.Group} group - The Group to check.
|
||||
* @param {function} [callback] - A callback function that is called if the object overlaps with the Pointer. The callback will be sent two parameters: the Pointer and the Object that overlapped with it.
|
||||
* @param {object} [callbackContext] - The context in which to run the callback.
|
||||
* @return {array} An array of the Sprites from the Group that overlapped the Pointer coordinates.
|
||||
* @return {PIXI.DisplayObject[]} An array of the Sprites from the Group that overlapped the Pointer coordinates.
|
||||
*/
|
||||
getObjectsUnderPointer: function (pointer, group, callback, callbackContext) {
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ Phaser.Physics.Arcade.prototype = {
|
|||
* @param {function} [callback] - A callback function that is called if the object overlaps the coordinates. The callback will be sent two parameters: the callbackArg and the Object that overlapped the location.
|
||||
* @param {object} [callbackContext] - The context in which to run the callback.
|
||||
* @param {object} [callbackArg] - An argument to pass to the callback.
|
||||
* @return {array} An array of the Sprites from the Group that overlapped the coordinates.
|
||||
* @return {PIXI.DisplayObject[]} An array of the Sprites from the Group that overlapped the coordinates.
|
||||
*/
|
||||
getObjectsAtLocation: function (x, y, group, callback, callbackContext, callbackArg) {
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ Phaser.Canvas = {
|
|||
*
|
||||
* @method Phaser.Canvas.setTouchAction
|
||||
* @param {HTMLCanvasElement} canvas - The canvas to set the touch action on.
|
||||
* @param {String} [value] - The touch action to set. Defaults to 'none'.
|
||||
* @param {string} [value] - The touch action to set. Defaults to 'none'.
|
||||
* @return {HTMLCanvasElement} The source canvas.
|
||||
*/
|
||||
setTouchAction: function (canvas, value) {
|
||||
|
@ -85,7 +85,7 @@ Phaser.Canvas = {
|
|||
*
|
||||
* @method Phaser.Canvas.setUserSelect
|
||||
* @param {HTMLCanvasElement} canvas - The canvas to set the touch action on.
|
||||
* @param {String} [value] - The touch action to set. Defaults to 'none'.
|
||||
* @param {string} [value] - The touch action to set. Defaults to 'none'.
|
||||
* @return {HTMLCanvasElement} The source canvas.
|
||||
*/
|
||||
setUserSelect: function (canvas, value) {
|
||||
|
|
|
@ -79,9 +79,9 @@ Phaser.DOM = {
|
|||
*
|
||||
* @method Phaser.DOM.calibrate
|
||||
* @private
|
||||
* @param {Object} coords - An object containing the following properties: `{top: number, right: number, bottom: number, left: number}`
|
||||
* @param {object} coords - An object containing the following properties: `{top: number, right: number, bottom: number, left: number}`
|
||||
* @param {number} [cushion] - A value to adjust the coordinates by.
|
||||
* @return {Object} The calibrated element coordinates
|
||||
* @return {object} The calibrated element coordinates
|
||||
*/
|
||||
calibrate: function (coords, cushion) {
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ Phaser.Time = function (game) {
|
|||
this._justResumed = false;
|
||||
|
||||
/**
|
||||
* @property {array} _timers - Internal store of Phaser.Timer objects.
|
||||
* @property {Phaser.Timer[]} _timers - Internal store of Phaser.Timer objects.
|
||||
* @private
|
||||
*/
|
||||
this._timers = [];
|
||||
|
|
|
@ -196,7 +196,7 @@ Phaser.Timer.prototype = {
|
|||
* @param {number} repeatCount - The number of times the event will repeat.
|
||||
* @param {function} callback - The callback that will be called when the Timer event occurs.
|
||||
* @param {object} callbackContext - The context in which the callback will be called.
|
||||
* @param {array} arguments - The values to be sent to your callback function when it is called.
|
||||
* @param {any[]} arguments - The values to be sent to your callback function when it is called.
|
||||
* @return {Phaser.TimerEvent} The Phaser.TimerEvent object that was created.
|
||||
*/
|
||||
create: function (delay, loop, repeatCount, callback, callbackContext, args) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* @param {boolean} loop - True if this TimerEvent loops, otherwise false.
|
||||
* @param {function} callback - The callback that will be called when the TimerEvent occurs.
|
||||
* @param {object} callbackContext - The context in which the callback will be called.
|
||||
* @param {array} arguments - Additional arguments to be passed to the callback.
|
||||
* @param {any[]} arguments - Additional arguments to be passed to the callback.
|
||||
*/
|
||||
Phaser.TimerEvent = function (timer, delay, tick, repeatCount, loop, callback, callbackContext, args) {
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ Phaser.Tween = function (target, game, manager) {
|
|||
/**
|
||||
* @property {boolean} pendingDelete - True if this Tween is ready to be deleted by the TweenManager.
|
||||
* @default
|
||||
* @readOnly
|
||||
* @readonly
|
||||
*/
|
||||
this.pendingDelete = false;
|
||||
|
||||
|
@ -119,12 +119,12 @@ Phaser.Tween = function (target, game, manager) {
|
|||
/**
|
||||
* @property {number} current - The current Tween child being run.
|
||||
* @default
|
||||
* @readOnly
|
||||
* @readonly
|
||||
*/
|
||||
this.current = 0;
|
||||
|
||||
/**
|
||||
* @property {Object} properties - Target property cache used when building the child data values.
|
||||
* @property {object} properties - Target property cache used when building the child data values.
|
||||
*/
|
||||
this.properties = {};
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ Phaser.TweenData = function (parent) {
|
|||
|
||||
/**
|
||||
* @property {number} percent - A value between 0 and 1 that represents how far through the duration this tween is.
|
||||
* @readOnly
|
||||
* @readonly
|
||||
*/
|
||||
this.percent = 0;
|
||||
|
||||
/**
|
||||
* @property {number} value - The current calculated value.
|
||||
* @readOnly
|
||||
* @readonly
|
||||
*/
|
||||
this.value = 0;
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ Phaser.TweenManager.prototype = {
|
|||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @method Phaser.TweenManager#create
|
||||
* @param {Object} object - Object the tween will be run on.
|
||||
* @param {object} object - Object the tween will be run on.
|
||||
* @returns {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
create: function (object) {
|
||||
|
|
|
@ -40,8 +40,8 @@ Phaser.ArraySet.prototype = {
|
|||
* If the item already exists in the list it is not moved.
|
||||
*
|
||||
* @method Phaser.ArraySet#add
|
||||
* @param {*} item - The element to add to this list.
|
||||
* @return {*} The item that was added.
|
||||
* @param {any} item - The element to add to this list.
|
||||
* @return {any} The item that was added.
|
||||
*/
|
||||
add: function (item) {
|
||||
|
||||
|
@ -58,8 +58,8 @@ Phaser.ArraySet.prototype = {
|
|||
* Gets the index of the item in the list, or -1 if it isn't in the list.
|
||||
*
|
||||
* @method Phaser.ArraySet#getIndex
|
||||
* @param {*} item - The element to get the list index for.
|
||||
* @return {number} The index of the item or -1 if not found.
|
||||
* @param {any} item - The element to get the list index for.
|
||||
* @return {integer} The index of the item or -1 if not found.
|
||||
*/
|
||||
getIndex: function (item) {
|
||||
|
||||
|
@ -71,7 +71,7 @@ Phaser.ArraySet.prototype = {
|
|||
* Checks for the item within this list.
|
||||
*
|
||||
* @method Phaser.ArraySet#exists
|
||||
* @param {*} item - The element to get the list index for.
|
||||
* @param {any} item - The element to get the list index for.
|
||||
* @return {boolean} True if the item is found in the list, otherwise false.
|
||||
*/
|
||||
exists: function (item) {
|
||||
|
@ -95,8 +95,8 @@ Phaser.ArraySet.prototype = {
|
|||
* Removes the given element from this list if it exists.
|
||||
*
|
||||
* @method Phaser.ArraySet#remove
|
||||
* @param {*} item - The item to be removed from the list.
|
||||
* @return {*} item - The item that was removed.
|
||||
* @param {any} item - The item to be removed from the list.
|
||||
* @return {any} item - The item that was removed.
|
||||
*/
|
||||
remove: function (item) {
|
||||
|
||||
|
@ -114,8 +114,8 @@ Phaser.ArraySet.prototype = {
|
|||
* Sets the property `key` to the given value on all members of this list.
|
||||
*
|
||||
* @method Phaser.ArraySet#setAll
|
||||
* @param {*} key - The propety of the item to set.
|
||||
* @param {*} value - The value to set the property to.
|
||||
* @param {any} key - The propety of the item to set.
|
||||
* @param {any} value - The value to set the property to.
|
||||
*/
|
||||
setAll: function (key, value) {
|
||||
|
||||
|
@ -177,7 +177,7 @@ Object.defineProperty(Phaser.ArraySet.prototype, "total", {
|
|||
* Returns the first item and resets the cursor to the start.
|
||||
*
|
||||
* @name Phaser.ArraySet#first
|
||||
* @property {*} first
|
||||
* @property {any} first
|
||||
*/
|
||||
Object.defineProperty(Phaser.ArraySet.prototype, "first", {
|
||||
|
||||
|
@ -202,7 +202,7 @@ Object.defineProperty(Phaser.ArraySet.prototype, "first", {
|
|||
* Returns the the next item (based on the cursor) and advances the cursor.
|
||||
*
|
||||
* @name Phaser.ArraySet#next
|
||||
* @property {*} next
|
||||
* @property {any} next
|
||||
*/
|
||||
Object.defineProperty(Phaser.ArraySet.prototype, "next", {
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ Phaser.ArrayUtils = {
|
|||
* A standard Fisher-Yates Array shuffle implementation which modifies the array in place.
|
||||
*
|
||||
* @method
|
||||
* @param {array} array - The array to shuffle.
|
||||
* @return {array} The original array, now shuffled.
|
||||
* @param {any[]} array - The array to shuffle.
|
||||
* @return {any[]} The original array, now shuffled.
|
||||
*/
|
||||
shuffle: function (array) {
|
||||
|
||||
|
@ -93,8 +93,8 @@ Phaser.ArrayUtils = {
|
|||
* Transposes the elements of the given Array.
|
||||
*
|
||||
* @method
|
||||
* @param {array} array - The array to transpose.
|
||||
* @return {array} The transposed array.
|
||||
* @param {array[]} array - The array to transpose.
|
||||
* @return {array[]} The transposed array.
|
||||
*/
|
||||
transposeMatrix: function (array) {
|
||||
|
||||
|
@ -119,9 +119,9 @@ Phaser.ArrayUtils = {
|
|||
* Based on the routine from http://jsfiddle.net/MrPolywhirl/NH42z/
|
||||
*
|
||||
* @method
|
||||
* @param {array} matrix - The array to rotate.
|
||||
* @param {array[]} matrix - The array to rotate.
|
||||
* @param {number|string} direction - The amount to rotate. Either a number: 90, -90, 270, -270, 180 or a string: 'rotateLeft', 'rotateRight' or 'rotate180'
|
||||
* @return {array} The rotated array
|
||||
* @return {array[]} The rotated array
|
||||
*/
|
||||
rotateMatrix: function (matrix, direction) {
|
||||
|
||||
|
@ -210,7 +210,7 @@ Phaser.ArrayUtils = {
|
|||
* @method Phaser.Math#numberArray
|
||||
* @param {number} start - The minimum value the array starts with.
|
||||
* @param {number} end - The maximum value the array contains.
|
||||
* @return {array} The array of number values.
|
||||
* @return {number[]} The array of number values.
|
||||
*/
|
||||
numberArray: function (start, end) {
|
||||
|
||||
|
|
|
@ -105,8 +105,8 @@ Phaser.Utils = {
|
|||
* Transposes the elements of the given Array.
|
||||
*
|
||||
* @method Phaser.Utils.transposeArray
|
||||
* @param {array} array - The array to transpose.
|
||||
* @return {array} The transposed array.
|
||||
* @param {array[]} array - The array to transpose.
|
||||
* @return {array[]} The transposed array.
|
||||
* @deprecated 2.2.0 - Use Phaser.ArrayUtils.transposeMatrix
|
||||
*/
|
||||
transposeArray: function (array) {
|
||||
|
@ -118,9 +118,9 @@ Phaser.Utils = {
|
|||
* Based on the routine from http://jsfiddle.net/MrPolywhirl/NH42z/
|
||||
*
|
||||
* @method Phaser.Utils.rotateArray
|
||||
* @param {array} matrix - The array to rotate.
|
||||
* @param {array[]} matrix - The array to rotate.
|
||||
* @param {number|string} direction - The amount to rotate. Either a number: 90, -90, 270, -270, 180 or a string: 'rotateLeft', 'rotateRight' or 'rotate180'
|
||||
* @return {array} The rotated array
|
||||
* @return {array[]} The rotated array
|
||||
* @deprecated 2.2.0 - Use Phaser.ArrayUtils.rotateMatrix
|
||||
*/
|
||||
rotateArray: function (matrix, direction) {
|
||||
|
@ -131,8 +131,8 @@ Phaser.Utils = {
|
|||
* A standard Fisher-Yates Array shuffle implementation.
|
||||
*
|
||||
* @method Phaser.Utils.shuffle
|
||||
* @param {array} array - The array to shuffle.
|
||||
* @return {array} The shuffled array.
|
||||
* @param {any[]} array - The array to shuffle.
|
||||
* @return {any[]} The shuffled array.
|
||||
* @deprecated 2.2.0 - User Phaser.ArrayUtils.shuffle
|
||||
*/
|
||||
shuffle: function (array) {
|
||||
|
|
Loading…
Reference in a new issue