This commit is contained in:
Richard Davey 2018-06-06 23:05:48 +01:00
commit ada4656601
16 changed files with 242 additions and 175 deletions

View file

@ -231,7 +231,7 @@ var UpdateList = new Class({
* @method Phaser.GameObjects.UpdateList#removeAll
* @since 3.0.0
*
* @return {Phaser.GameObjects.UpdateList} The UpdateList object.
* @return {Phaser.GameObjects.UpdateList} This UpdateList.
*/
removeAll: function ()
{
@ -285,7 +285,7 @@ var UpdateList = new Class({
},
/**
* [description]
* The length of the list.
*
* @name Phaser.GameObjects.UpdateList#length
* @type {integer}

View file

@ -7,20 +7,24 @@
/**
* @typedef {object} BitmapTextSize
*
* @property {GlobalBitmapTextSize} global - The position and size of the BitmapText, taking into consideration the position and scale of the Game Object.
* @property {LocalBitmapTextSize} local - The position and size of the BitmapText, taking just the font size into consideration.
* @property {GlobalBitmapTextSize} global - The position and size of the BitmapText, taking into account the position and scale of the Game Object.
* @property {LocalBitmapTextSize} local - The position and size of the BitmapText, taking just the font size into account.
*/
/**
* The position and size of the Bitmap Text in global space, taking into account the Game Object's scale and world position.
*
* @typedef {object} GlobalBitmapTextSize
*
* @property {number} x - The x position of the BitmapText, taking into consideration the x coordinate of the Game Object.
* @property {number} y - The y position of the BitmapText, taking into consideration the y coordinate of the Game Object.
* @property {number} width - The width of the BitmapText, taking into consideration the x scale of the Game Object.
* @property {number} width - The height of the BitmapText, taking into consideration the y scale of the Game Object.
* @property {number} x - The x position of the BitmapText, taking into account the x position and scale of the Game Object.
* @property {number} y - The y position of the BitmapText, taking into account the y position and scale of the Game Object.
* @property {number} width - The width of the BitmapText, taking into account the x scale of the Game Object.
* @property {number} width - The height of the BitmapText, taking into account the y scale of the Game Object.
*/
/**
* The position and size of the Bitmap Text in local space, taking just the font size into account.
*
* @typedef {object} LocalBitmapTextSize
*
* @property {number} x - The x position of the BitmapText.
@ -35,16 +39,16 @@
* Returns a BitmapTextSize object that contains global and local variants of the Game Objects x and y coordinates and
* its width and height.
*
* The global position and size take into consideration the Game Object's position and scale.
* The global position and size take into account the Game Object's position and scale.
*
* The local position and size just takes into consideration the font data.
* The local position and size just takes into account the font data.
*
* @function GetBitmapTextSize
* @since 3.0.0
* @private
*
* @param {(Phaser.GameObjects.DynamicBitmapText|Phaser.GameObjects.BitmapText)} src - The BitmapText to calculate the position, width and height of.
* @param {boolean} round - Whether to round the results to the nearest integer.
* @param {boolean} [round] - Whether to round the results to the nearest integer.
*
* @return {BitmapTextSize} The calculated position, width and height of the BitmapText.
*/

View file

@ -9,6 +9,8 @@ var ParseXMLBitmapFont = require('./ParseXMLBitmapFont');
/**
* Parse an XML Bitmap Font from an Atlas.
*
* Adds the parsed Bitmap Font data to the cache with the `fontName` key.
*
* @function ParseFromAtlas
* @since 3.0.0
* @private
@ -20,6 +22,8 @@ var ParseXMLBitmapFont = require('./ParseXMLBitmapFont');
* @param {string} xmlKey - The key of the XML data of the font to parse.
* @param {integer} xSpacing - The x-axis spacing to add between each letter.
* @param {integer} ySpacing - The y-axis spacing to add to the line height.
*
* @return {boolean} Whether the parsing was successful or not.
*/
var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing)
{

View file

@ -15,6 +15,8 @@ var GetValue = require('../../utils/object/GetValue');
*
* @param {Phaser.Scene} scene - A reference to the Phaser Scene.
* @param {Phaser.GameObjects.RetroFont.Config} config - The font configuration object.
*
* @return {object} A parsed Bitmap Font data entry for the Bitmap Font cache.
*/
var ParseRetroFont = function (scene, config)
{

View file

@ -5,9 +5,16 @@
*/
/**
* Read an integer value from an XML Node.
*
* @function getValue
* @since 3.0.0
* @private
*
* @param {Node} node - The XML Node.
* @param {string} attribute - The attribute to read.
*
* @return {integer} The parsed value.
*/
function getValue (node, attribute)
{
@ -15,6 +22,8 @@ function getValue (node, attribute)
}
/**
* Parse an XML font to Bitmap Font data for the Bitmap Font cache.
*
* @function ParseXMLBitmapFont
* @since 3.0.0
* @private
@ -23,6 +32,8 @@ function getValue (node, attribute)
* @param {integer} [xSpacing=0] - The x-axis spacing to add between each letter.
* @param {integer} [ySpacing=0] - The y-axis spacing to add to the line height.
* @param {Phaser.Textures.Frame} [frame] - The texture frame to take into account while parsing.
*
* @return {BitmapFontData} The parsed Bitmap Font data.
*/
var ParseXMLBitmapFont = function (xml, xSpacing, ySpacing, frame)
{

View file

@ -10,7 +10,7 @@ var Extend = require('../../utils/object/Extend');
/**
* @typedef {object} Phaser.GameObjects.RetroFont.Config
*
* @property {string} image - [description]
* @property {string} image - The key of the image containing the font.
* @property {number} offset.x - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
* @property {number} offset.y - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
* @property {number} width - The width of each character in the font set.

View file

@ -12,20 +12,22 @@ var Render = require('./DynamicBitmapTextRender');
/**
* @typedef {object} DisplayCallbackConfig
* @property {{topLeft:number,topRight:number,bottomLeft:number,bottomRight:number}} tint - [description]
* @property {number} index - [description]
* @property {number} charCode - [description]
* @property {number} x - [description]
* @property {number} y - [description]
* @property {number} scale - [description]
* @property {number} rotation - [description]
* @property {any} data - [description]
* @property {{topLeft:number,topRight:number,bottomLeft:number,bottomRight:number}} tint - The tint of the character being rendered.
* @property {number} index - The index of the character being rendered.
* @property {number} charCode - The character code of the character being rendered.
* @property {number} x - The x position of the character being rendered.
* @property {number} y - The y position of the character being rendered.
* @property {number} scale - The scale of the character being rendered.
* @property {number} rotation - The rotation of the character being rendered.
* @property {any} data - Custom data stored with the character being rendered.
*/
/**
* @callback DisplayCallback
*
* @param {DisplayCallbackConfig} display - [description]
* @param {DisplayCallbackConfig} display - Settings of the character that is about to be rendered.
*
* @return {{x:number, y:number, scale:number, rotation:number}} Altered position, scale and rotation values for the character that is about to be rendered.
*/
/**
@ -53,9 +55,9 @@ var Render = require('./DynamicBitmapTextRender');
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
* @param {number} x - The x coordinate of this Game Object in world space.
* @param {number} y - The y coordinate of this Game Object in world space.
* @param {string} font - [description]
* @param {(string|string[])} [text] - [description]
* @param {number} [size] - [description]
* @param {string} font - The key of the font to use from the Bitmap Font cache.
* @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
* @param {number} [size] - The font size of this Bitmap Text.
*/
var DynamicBitmapText = new Class({
@ -85,7 +87,7 @@ var DynamicBitmapText = new Class({
GameObject.call(this, scene, 'DynamicBitmapText');
/**
* [description]
* The key of the Bitmap Font used by this Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#font
* @type {string}
@ -96,16 +98,16 @@ var DynamicBitmapText = new Class({
var entry = this.scene.sys.cache.bitmapFont.get(font);
/**
* [description]
* The data of the Bitmap Font used by this Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#fontData
* @type {object}
* @type {BitmapFontData}
* @since 3.0.0
*/
this.fontData = entry.data;
/**
* [description]
* The text that this Bitmap Text object displays.
*
* @name Phaser.GameObjects.DynamicBitmapText#text
* @type {string}
@ -114,7 +116,7 @@ var DynamicBitmapText = new Class({
this.text = '';
/**
* [description]
* The font size of this Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#fontSize
* @type {number}
@ -140,17 +142,17 @@ var DynamicBitmapText = new Class({
this.initPipeline('TextureTintPipeline');
/**
* [description]
* An object that describes the size of this BitmapText.
*
* @name Phaser.GameObjects.DynamicBitmapText#_bounds
* @type {TextBounds}
* @type {BitmapTextSize}
* @private
* @since 3.0.0
*/
this._bounds = this.getTextBounds();
/**
* [description]
* The horizontal scroll position of the Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#scrollX
* @type {number}
@ -160,7 +162,7 @@ var DynamicBitmapText = new Class({
this.scrollX = 0;
/**
* [description]
* The vertical scroll position of the Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#scrollY
* @type {number}
@ -170,7 +172,7 @@ var DynamicBitmapText = new Class({
this.scrollY = 0;
/**
* [description]
* The crop width of the Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#cropWidth
* @type {number}
@ -180,7 +182,7 @@ var DynamicBitmapText = new Class({
this.cropWidth = 0;
/**
* [description]
* The crop height of the Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#cropHeight
* @type {number}
@ -190,7 +192,7 @@ var DynamicBitmapText = new Class({
this.cropHeight = 0;
/**
* [description]
* A callback that alters how each character of the Bitmap Text is rendered.
*
* @name Phaser.GameObjects.DynamicBitmapText#displayCallback;
* @type {DisplayCallback}
@ -200,13 +202,13 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Set the crop size of this Bitmap Text.
*
* @method Phaser.GameObjects.DynamicBitmapText#setSize
* @since 3.0.0
*
* @param {number} width - [description]
* @param {number} height - [description]
* @param {number} width - The width of the crop.
* @param {number} height - The height of the crop.
*
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
*/
@ -219,12 +221,18 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Set a callback that alters how each character of the Bitmap Text is rendered.
*
* The callback receives a {@link DisplayCallbackConfig} object that contains information about the character that's
* about to be rendered.
*
* It should return an object with `x`, `y`, `scale` and `rotation` properties that will be used instead of the
* usual values when rendering.
*
* @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback
* @since 3.0.0
*
* @param {DisplayCallback} callback - [description]
* @param {DisplayCallback} callback - The display callback to set.
*
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
*/
@ -236,12 +244,12 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Set the font size of this Bitmap Text.
*
* @method Phaser.GameObjects.DynamicBitmapText#setFontSize
* @since 3.0.0
*
* @param {number} size - [description]
* @param {number} size - The font size to set.
*
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
*/
@ -253,7 +261,9 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Set the content of this BitmapText.
*
* An array of strings will be converted multi-line text.
*
* @method Phaser.GameObjects.DynamicBitmapText#setText
* @since 3.0.0
@ -285,12 +295,12 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Set the horizontal scroll position of this Bitmap Text.
*
* @method Phaser.GameObjects.DynamicBitmapText#setScrollX
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The horizontal scroll position to set.
*
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
*/
@ -302,12 +312,12 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Set the vertical scroll position of this Bitmap Text.
*
* @method Phaser.GameObjects.DynamicBitmapText#setScrollY
* @since 3.0.0
*
* @param {number} value - [description]
* @param {number} value - The vertical scroll position to set.
*
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
*/
@ -319,14 +329,21 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Calculate the bounds of this Bitmap Text.
*
* An object is returned that contains the position, width and height of the Bitmap Text in local and global
* contexts.
*
* Local size is based on just the font size and a [0, 0] position.
*
* Global size takes into account the Game Object's scale and world position.
*
* @method Phaser.GameObjects.DynamicBitmapText#getTextBounds
* @since 3.0.0
*
* @param {boolean} round - [description]
* @param {boolean} [round] - Whether to round the results to the nearest integer.
*
* @return {TextBounds} [description]
* @return {BitmapTextSize} An object that describes the size of this Bitmap Text.
*/
getTextBounds: function (round)
{
@ -339,10 +356,11 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* The width of this Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#width
* @type {number}
* @readOnly
* @since 3.0.0
*/
width: {
@ -356,10 +374,11 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* The height of this Bitmap Text.
*
* @name Phaser.GameObjects.DynamicBitmapText#height
* @type {number}
* @readOnly
* @since 3.0.0
*/
height: {
@ -373,12 +392,12 @@ var DynamicBitmapText = new Class({
},
/**
* [description]
* Build a JSON representation of this Bitmap Text.
*
* @method Phaser.GameObjects.DynamicBitmapText#toJSON
* @since 3.0.0
*
* @return {JSONBitmapText} [description]
* @return {JSONBitmapText} The JSON representation of this Bitmap Text.
*/
toJSON: function ()
{

View file

@ -13,10 +13,9 @@ var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue');
* @typedef {object} BitmapTextConfig
* @extends GameObjectConfig
*
* @property {string} [font=''] - [description]
* @property {string} [text=''] - [description]
* @property {(number|false)} [size=false] - [description]
* @property {string} [align='left'] - [description]
* @property {string} [font=''] - The key of the font to use from the BitmapFont cache.
* @property {string} [text=''] - The string, or array of strings, to be set as the content of this Bitmap Text.
* @property {(number|false)} [size=false] - The font size to set.
*/
/**
@ -39,9 +38,8 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene)
var font = GetAdvancedValue(config, 'font', '');
var text = GetAdvancedValue(config, 'text', '');
var size = GetAdvancedValue(config, 'size', false);
var align = GetAdvancedValue(config, 'align', 'left');
var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size, align);
var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size);
if (addToScene !== undefined)
{

View file

@ -17,9 +17,9 @@ var GameObjectFactory = require('../../GameObjectFactory');
*
* @param {number} x - The x position of the Game Object.
* @param {number} y - The y position of the Game Object.
* @param {string} font - [description]
* @param {(string|string[])} [text] - [description]
* @param {number} [size] - [description]
* @param {string} font - The key of the font to use from the BitmapFont cache.
* @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
* @param {number} [size] - The font size to set.
*
* @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created.
*/

View file

@ -12,27 +12,43 @@ var ParseFromAtlas = require('../ParseFromAtlas');
var Render = require('./BitmapTextRender');
/**
* @typedef {object} TextBounds
* The font data for an individual character of a Bitmap Font.
*
* @property {object} local - [description]
* @property {number} local.x - [description]
* @property {number} local.y - [description]
* @property {number} local.width - [description]
* @property {number} local.height - [description]
* @property {object} global - [description]
* @property {number} global.x - [description]
* @property {number} global.y - [description]
* @property {number} global.width - [description]
* @property {number} global.height - [description]
* Describes the character's position, size, offset and kerning.
*
* @typedef {object} BitmapFontCharacterData
*
* @property {number} x - The x position of the character.
* @property {number} y - The y position of the character.
* @property {number} width - The width of the character.
* @property {number} height - The height of the character.
* @property {number} centerX - The center x position of the character.
* @property {number} centerY - The center y position of the character.
* @property {number} xOffset - The x offset of the character.
* @property {number} yOffset - The y offset of the character.
* @property {object} data - Extra data for the character.
* @property {Object.<integer, number>} kerning - Kerning values, keyed by character code.
*/
/**
* Bitmap Font data that can be used by a BitmapText Game Object.
*
* @typedef {object} BitmapFontData
*
* @property {string} font - The name of the font.
* @property {number} size - The size of the font.
* @property {number} lineHeight - The line height of the font.
* @property {boolean} retroFont - Whether this font is a retro font (monospace).
* @property {Object.<integer, BitmapFontCharacterData>} chars - The character data of the font, keyed by character code. Each character datum includes a position, size, offset and more.
*/
/**
* @typedef {object} JSONBitmapText
* @extends {JSONGameObject}
*
* @property {string} font - [description]
* @property {string} text - [description]
* @property {number} fontSize - [description]
* @property {string} font - The name of the font.
* @property {string} text - The text that this Bitmap Text displays.
* @property {number} fontSize - The size of the font.
* @property {number} letterSpacing - Adds/Removes spacing between characters
*/
@ -58,13 +74,13 @@ var Render = require('./BitmapTextRender');
* @extends Phaser.GameObjects.Components.Tint
* @extends Phaser.GameObjects.Components.Transform
* @extends Phaser.GameObjects.Components.Visible
*
*
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
* @param {number} x - The x coordinate of this Game Object in world space.
* @param {number} y - The y coordinate of this Game Object in world space.
* @param {string} font - [description]
* @param {(string|string[])} [text] - [description]
* @param {number} [size] - [description]
* @param {string} font - The key of the font to use from the Bitmap Font cache.
* @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
* @param {number} [size] - The font size of this Bitmap Text.
*/
var BitmapText = new Class({
@ -95,7 +111,7 @@ var BitmapText = new Class({
GameObject.call(this, scene, 'BitmapText');
/**
* [description]
* The key of the Bitmap Font used by this Bitmap Text.
*
* @name Phaser.GameObjects.BitmapText#font
* @type {string}
@ -106,16 +122,16 @@ var BitmapText = new Class({
var entry = this.scene.sys.cache.bitmapFont.get(font);
/**
* [description]
* The data of the Bitmap Font used by this Bitmap Text.
*
* @name Phaser.GameObjects.BitmapText#fontData
* @type {object}
* @type {BitmapFontData}
* @since 3.0.0
*/
this.fontData = entry.data;
/**
* [description]
* The text that this Bitmap Text object displays.
*
* @name Phaser.GameObjects.BitmapText#text
* @type {string}
@ -124,7 +140,7 @@ var BitmapText = new Class({
this.text = '';
/**
* [description]
* The font size of this Bitmap Text.
*
* @name Phaser.GameObjects.BitmapText#fontSize
* @type {number}
@ -133,8 +149,9 @@ var BitmapText = new Class({
this.fontSize = size || this.fontData.size;
/**
* Adds/Removes spacing between characters
* Can be a negative or positive number
* Adds/Removes spacing between characters.
*
* Can be a negative or positive number.
*
* @name Phaser.GameObjects.BitmapText#letterSpacing
* @type {number}
@ -150,10 +167,10 @@ var BitmapText = new Class({
this.initPipeline('TextureTintPipeline');
/**
* [description]
* An object that describes the size of this Bitmap Text.
*
* @name Phaser.GameObjects.BitmapText#_bounds
* @type {TextBounds}
* @type {BitmapTextSize}
* @private
* @since 3.0.0
*/
@ -161,12 +178,12 @@ var BitmapText = new Class({
},
/**
* [description]
* Set the font size of this Bitmap Text.
*
* @method Phaser.GameObjects.BitmapText#setFontSize
* @since 3.0.0
*
* @param {number} size - [description]
* @param {number} size - The font size to set.
*
* @return {Phaser.GameObjects.BitmapText} This Game Object.
*/
@ -199,7 +216,9 @@ var BitmapText = new Class({
},
/**
* [description]
* Set the content of this BitmapText.
*
* An array of strings will be converted multi-line text.
*
* @method Phaser.GameObjects.BitmapText#setText
* @since 3.0.0
@ -231,14 +250,21 @@ var BitmapText = new Class({
},
/**
* [description]
* Calculate the bounds of this Bitmap Text.
*
* An object is returned that contains the position, width and height of the Bitmap Text in local and global
* contexts.
*
* Local size is based on just the font size and a [0, 0] position.
*
* Global size takes into account the Game Object's scale and world position.
*
* @method Phaser.GameObjects.BitmapText#getTextBounds
* @since 3.0.0
*
* @param {boolean} round - [description]
* @param {boolean} [round] - Whether to round the results to the nearest integer.
*
* @return {TextBounds} [description]
* @return {BitmapTextSize} An object that describes the size of this Bitmap Text.
*/
getTextBounds: function (round)
{
@ -251,10 +277,11 @@ var BitmapText = new Class({
},
/**
* [description]
* The width of this Bitmap Text.
*
* @name Phaser.GameObjects.BitmapText#width
* @type {number}
* @readOnly
* @since 3.0.0
*/
width: {
@ -269,10 +296,11 @@ var BitmapText = new Class({
},
/**
* [description]
* The height of this bitmap text.
*
* @name Phaser.GameObjects.BitmapText#height
* @type {number}
* @readOnly
* @since 3.0.0
*/
height: {
@ -287,12 +315,12 @@ var BitmapText = new Class({
},
/**
* [description]
* Build a JSON representation of this Bitmap Text.
*
* @method Phaser.GameObjects.BitmapText#toJSON
* @since 3.0.0
*
* @return {JSONBitmapText} [description]
* @return {JSONBitmapText} The JSON representation of this Bitmap Text.
*/
toJSON: function ()
{

View file

@ -17,9 +17,9 @@ var GameObjectFactory = require('../../GameObjectFactory');
*
* @param {number} x - The x position of the Game Object.
* @param {number} y - The y position of the Game Object.
* @param {string} font - [description]
* @param {(string|string[])} [text] - [description]
* @param {number} [size] - [description]
* @param {string} font - The key of the font to use from the BitmapFont cache.
* @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
* @param {number} [size] - The font size to set.
*
* @return {Phaser.GameObjects.BitmapText} The Game Object that was created.
*/

View file

@ -12,7 +12,7 @@ var _FLAG = 2; // 0010
/**
* Provides methods used for setting the alpha properties of a Game Object.
* Should be applied as a mixin and not used directly.
*
*
* @name Phaser.GameObjects.Components.Alpha
* @since 3.0.0
*/
@ -21,7 +21,7 @@ var Alpha = {
/**
* Private internal value. Holds the global alpha value.
*
*
* @name Phaser.GameObjects.Components.Alpha#_alpha
* @type {float}
* @private
@ -32,7 +32,7 @@ var Alpha = {
/**
* Private internal value. Holds the top-left alpha value.
*
*
* @name Phaser.GameObjects.Components.Alpha#_alphaTL
* @type {float}
* @private
@ -43,7 +43,7 @@ var Alpha = {
/**
* Private internal value. Holds the top-right alpha value.
*
*
* @name Phaser.GameObjects.Components.Alpha#_alphaTR
* @type {float}
* @private
@ -54,7 +54,7 @@ var Alpha = {
/**
* Private internal value. Holds the bottom-left alpha value.
*
*
* @name Phaser.GameObjects.Components.Alpha#_alphaBL
* @type {float}
* @private
@ -65,7 +65,7 @@ var Alpha = {
/**
* Private internal value. Holds the bottom-right alpha value.
*
*
* @name Phaser.GameObjects.Components.Alpha#_alphaBR
* @type {float}
* @private
@ -76,11 +76,12 @@ var Alpha = {
/**
* Clears all alpha values associated with this Game Object.
* Immediately sets the alpha levels back to 1 (fully opaque)
*
* Immediately sets the alpha levels back to 1 (fully opaque).
*
* @method Phaser.GameObjects.Components.Alpha#clearAlpha
* @since 3.0.0
*
*
* @return {this} This Game Object instance.
*/
clearAlpha: function ()
@ -97,12 +98,12 @@ var Alpha = {
*
* @method Phaser.GameObjects.Components.Alpha#setAlpha
* @since 3.0.0
*
*
* @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object.
* @param {float} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only.
* @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only.
* @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only.
*
*
* @return {this} This Game Object instance.
*/
setAlpha: function (topLeft, topRight, bottomLeft, bottomRight)
@ -129,7 +130,7 @@ var Alpha = {
* The alpha value of the Game Object.
*
* This is a global value, impacting the entire Game Object, not just a region of it.
*
*
* @name Phaser.GameObjects.Components.Alpha#alpha
* @type {float}
* @since 3.0.0
@ -166,7 +167,7 @@ var Alpha = {
/**
* The alpha value starting from the top-left of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*
*
* @name Phaser.GameObjects.Components.Alpha#alphaTopLeft
* @type {float}
* @webglOnly
@ -196,7 +197,7 @@ var Alpha = {
/**
* The alpha value starting from the top-right of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*
*
* @name Phaser.GameObjects.Components.Alpha#alphaTopRight
* @type {float}
* @webglOnly
@ -226,7 +227,7 @@ var Alpha = {
/**
* The alpha value starting from the bottom-left of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*
*
* @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft
* @type {float}
* @webglOnly
@ -256,7 +257,7 @@ var Alpha = {
/**
* The alpha value starting from the bottom-right of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*
*
* @name Phaser.GameObjects.Components.Alpha#alphaBottomRight
* @type {float}
* @webglOnly

View file

@ -30,16 +30,16 @@
*/
/**
* Export a Game Object as a JSON object.
* Build a JSON representation of the given Game Object.
*
* This is typically extended further by Game Object specific implementations.
*
* @method Phaser.GameObjects.Components.ToJSON
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export.
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON.
*
* @return {JSONGameObject} The exported Game Object.
* @return {JSONGameObject} The JSON representation of the Game Object.
*/
var ToJSON = function (gameObject)
{

View file

@ -23,7 +23,7 @@ var Vector2 = require('../../math/Vector2');
* By default it will be removed from the Display List and instead added to the Containers own internal list.
*
* The position of the Game Object automatically becomes relative to the position of the Container.
*
*
* When the Container is rendered, all of its children are rendered as well, in the order in which they exist
* within the Container. Container children can be repositioned using methods such as `MoveUp`, `MoveDown` and `SendToBack`.
*
@ -102,10 +102,10 @@ var Container = new Class({
/**
* Does this Container exclusively manage its children?
*
*
* The default is `true` which means a child added to this Container cannot
* belong in another Container, which includes the Scene display list.
*
*
* If you disable this then this Container will no longer exclusively manage its children.
* This allows you to create all kinds of interesting graphical effects, such as replicating
* Game Objects without reparenting them all over the Scene.
@ -159,7 +159,7 @@ var Container = new Class({
* @since 3.4.0
*/
this.tempTransformMatrix = new Components.TransformMatrix();
/**
* A reference to the Scene Display List.
*
@ -274,10 +274,10 @@ var Container = new Class({
/**
* Does this Container exclusively manage its children?
*
*
* The default is `true` which means a child added to this Container cannot
* belong in another Container, which includes the Scene display list.
*
*
* If you disable this then this Container will no longer exclusively manage its children.
* This allows you to create all kinds of interesting graphical effects, such as replicating
* Game Objects without reparenting them all over the Scene.
@ -308,10 +308,10 @@ var Container = new Class({
*
* Some children are unable to return their bounds, such as Graphics objects, in which case
* they are skipped.
*
*
* Depending on the quantity of children in this Container it could be a really expensive call,
* so cache it and only poll it as needed.
*
*
* The values are stored and returned in a Rectangle object.
*
* @method Phaser.GameObjects.Container#getBounds
@ -394,7 +394,7 @@ var Container = new Class({
if (this.exclusive)
{
gameObject.parentContainer = null;
this._sysEvents.once('shutdown', gameObject.destroy, gameObject);
}
},
@ -448,7 +448,7 @@ var Container = new Class({
/**
* Adds the given Game Object, or array of Game Objects, to this Container.
*
*
* Each Game Object must be unique within the Container.
*
* @method Phaser.GameObjects.Container#add
@ -467,9 +467,9 @@ var Container = new Class({
/**
* Adds the given Game Object, or array of Game Objects, to this Container at the specified position.
*
*
* Existing Game Objects in the Container are shifted up.
*
*
* Each Game Object must be unique within the Container.
*
* @method Phaser.GameObjects.Container#addAt
@ -594,7 +594,7 @@ var Container = new Class({
*
* You can also specify a property and value to search for, in which case it will return the first
* Game Object in this Container with a matching property and / or value.
*
*
* For example: `getFirst('visible', true)` would return the first Game Object that had its `visible` property set.
*
* You can limit the search to the `startIndex` - `endIndex` range.
@ -622,7 +622,7 @@ var Container = new Class({
* For example: `getAll('body')` would return only Game Objects that have a body property.
*
* You can also specify a value to compare the property to:
*
*
* `getAll('visible', true)` would return only Game Objects that have their visible property set to `true`.
*
* Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
@ -647,16 +647,16 @@ var Container = new Class({
/**
* Returns the total number of Game Objects in this Container that have a property
* matching the given value.
*
*
* For example: `count('visible', true)` would count all the elements that have their visible property set.
*
*
* You can optionally limit the operation to the `startIndex` - `endIndex` range.
*
* @method Phaser.GameObjects.Container#count
* @since 3.4.0
*
* @param {string} property - [description]
* @param {any} value - [description]
* @param {string} property - The property to check.
* @param {any} value - The value to check.
* @param {integer} [startIndex=0] - An optional start index to search from.
* @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
*
@ -676,7 +676,7 @@ var Container = new Class({
*
* @param {Phaser.GameObjects.GameObject} child1 - The first Game Object to swap.
* @param {Phaser.GameObjects.GameObject} child2 - The second Game Object to swap.
*
*
* @return {Phaser.GameObjects.Container} This Container instance.
*/
swap: function (child1, child2)
@ -688,7 +688,7 @@ var Container = new Class({
/**
* Moves a Game Object to a new position within this Container.
*
*
* The Game Object must already be a child of this Container.
*
* The Game Object is removed from its old position and inserted into the new one.
@ -711,7 +711,7 @@ var Container = new Class({
/**
* Removes the given Game Object, or array of Game Objects, from this Container.
*
*
* The Game Objects must already be children of this Container.
*
* You can also optionally call `destroy` on each Game Object that is removed from the Container.
@ -746,7 +746,7 @@ var Container = new Class({
/**
* Removes the Game Object at the given position in this Container.
*
*
* You can also optionally call `destroy` on the Game Object, if one is found.
*
* @method Phaser.GameObjects.Container#removeAt
@ -771,7 +771,7 @@ var Container = new Class({
/**
* Removes the Game Objects between the given positions in this Container.
*
*
* You can also optionally call `destroy` on each Game Object that is removed from the Container.
*
* @method Phaser.GameObjects.Container#removeBetween
@ -800,7 +800,7 @@ var Container = new Class({
/**
* Removes all Game Objects from this Container.
*
*
* You can also optionally call `destroy` on each Game Object that is removed from the Container.
*
* @method Phaser.GameObjects.Container#removeAll
@ -958,7 +958,7 @@ var Container = new Class({
/**
* Returns `true` if the given Game Object is a direct child of this Container.
*
*
* This check does not scan nested Containers.
*
* @method Phaser.GameObjects.Container#exists
@ -975,7 +975,7 @@ var Container = new Class({
/**
* Sets the property to the given value on all Game Objects in this Container.
*
*
* Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
* and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
* the first 50 Game Objects.
@ -987,7 +987,7 @@ var Container = new Class({
* @param {any} value - The value to get the property to.
* @param {integer} [startIndex=0] - An optional start index to search from.
* @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
*
*
* @return {Phaser.GameObjects.Container} This Container instance.
*/
setAll: function (property, value, startIndex, endIndex)
@ -1010,7 +1010,7 @@ var Container = new Class({
*
* A copy of the Container is made before passing each entry to your callback.
* This protects against the callback itself modifying the Container.
*
*
* If you know for sure that the callback will not change the size of this Container
* then you can use the more performant `Container.iterate` method instead.
*
@ -1020,7 +1020,7 @@ var Container = new Class({
* @param {function} callback - The function to call.
* @param {object} [context] - Value to use as `this` when executing callback.
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
*
*
* @return {Phaser.GameObjects.Container} This Container instance.
*/
each: function (callback, context)
@ -1057,7 +1057,7 @@ var Container = new Class({
* @param {function} callback - The function to call.
* @param {object} [context] - Value to use as `this` when executing callback.
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
*
*
* @return {Phaser.GameObjects.Container} This Container instance.
*/
iterate: function (callback, context)
@ -1099,7 +1099,7 @@ var Container = new Class({
/**
* Returns the first Game Object within the Container, or `null` if it is empty.
*
*
* You can move the cursor by calling `Container.next` and `Container.previous`.
*
* @name Phaser.GameObjects.Container#first
@ -1127,7 +1127,7 @@ var Container = new Class({
/**
* Returns the last Game Object within the Container, or `null` if it is empty.
*
*
* You can move the cursor by calling `Container.next` and `Container.previous`.
*
* @name Phaser.GameObjects.Container#last
@ -1155,7 +1155,7 @@ var Container = new Class({
/**
* Returns the next Game Object within the Container, or `null` if it is empty.
*
*
* You can move the cursor by calling `Container.next` and `Container.previous`.
*
* @name Phaser.GameObjects.Container#next
@ -1183,7 +1183,7 @@ var Container = new Class({
/**
* Returns the previous Game Object within the Container, or `null` if it is empty.
*
*
* You can move the cursor by calling `Container.next` and `Container.previous`.
*
* @name Phaser.GameObjects.Container#previous

View file

@ -33,7 +33,7 @@ var Render = require('./GraphicsRender');
* @extends Phaser.GameObjects.Components.Visible
* @extends Phaser.GameObjects.Components.ScrollFactor
*
* @param {Phaser.Scene} scene - [description]
* @param {Phaser.Scene} scene - The Scene to which this Graphics object belongs.
* @param {object} options - [description]
*/
var Graphics = new Class({
@ -85,7 +85,7 @@ var Graphics = new Class({
this.displayOriginY = 0;
/**
* [description]
* The array of commands used to render the Graphics.
*
* @name Phaser.GameObjects.Graphics#commandBuffer
* @type {array}
@ -95,7 +95,7 @@ var Graphics = new Class({
this.commandBuffer = [];
/**
* [description]
* The default fill color for shapes rendered by this Graphics object.
*
* @name Phaser.GameObjects.Graphics#defaultFillColor
* @type {number}
@ -105,7 +105,7 @@ var Graphics = new Class({
this.defaultFillColor = -1;
/**
* [description]
* The default fill alpha for shapes rendered by this Graphics object.
*
* @name Phaser.GameObjects.Graphics#defaultFillAlpha
* @type {number}
@ -115,7 +115,7 @@ var Graphics = new Class({
this.defaultFillAlpha = 1;
/**
* [description]
* The default stroke width for shapes rendered by this Graphics object.
*
* @name Phaser.GameObjects.Graphics#defaultStrokeWidth
* @type {number}
@ -125,7 +125,7 @@ var Graphics = new Class({
this.defaultStrokeWidth = 1;
/**
* [description]
* The default stroke color for shapes rendered by this Graphics object.
*
* @name Phaser.GameObjects.Graphics#defaultStrokeColor
* @type {number}
@ -135,7 +135,7 @@ var Graphics = new Class({
this.defaultStrokeColor = -1;
/**
* [description]
* The default stroke alpha for shapes rendered by this Graphics object.
*
* @name Phaser.GameObjects.Graphics#defaultStrokeAlpha
* @type {number}
@ -158,12 +158,12 @@ var Graphics = new Class({
},
/**
* [description]
* Set the default styles for this Graphics object.
*
* @method Phaser.GameObjects.Graphics#setDefaultStyles
* @since 3.0.0
*
* @param {object} options - [description]
* @param {object} options - The styles to set as defaults.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/

View file

@ -89,7 +89,7 @@ var RenderTexture = new Class({
this.renderer = scene.sys.game.renderer;
/**
* [description]
* The tint of the Render Texture when rendered.
*
* @name Phaser.GameObjects.RenderTexture#globalTint
* @type {number}
@ -99,10 +99,10 @@ var RenderTexture = new Class({
this.globalTint = 0xffffff;
/**
* [description]
* The alpha of the Render Texture when rendered.
*
* @name Phaser.GameObjects.RenderTexture#globalAlpha
* @type {float}
* @type {number}
* @default 1
* @since 3.2.0
*/
@ -167,7 +167,7 @@ var RenderTexture = new Class({
/**
* Resizes the Render Texture to the new dimensions given.
*
*
* In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture.
* In Canvas it will resize the underlying canvas element.
* Both approaches will erase everything currently drawn to the Render Texture.
@ -211,14 +211,14 @@ var RenderTexture = new Class({
},
/**
* [description]
* Set the tint to use when rendering this Render Texture.
*
* @method Phaser.GameObjects.RenderTexture#setGlobalTint
* @since 3.2.0
*
* @param {integer} tint [description]
* @param {integer} tint - The tint value.
*
* @return {Phaser.GameObjects.RenderTexture} [description]
* @return {this} This Render Texture.
*/
setGlobalTint: function (tint)
{
@ -228,14 +228,14 @@ var RenderTexture = new Class({
},
/**
* [description]
* Set the alpha to use when rendering this Render Texture.
*
* @method Phaser.GameObjects.RenderTexture#setGlobalAlpha
* @since 3.2.0
*
* @param {float} alpha [description]
* @param {number} alpha - The alpha value.
*
* @return {Phaser.GameObjects.RenderTexture} [description]
* @return {this} This Render Texture.
*/
setGlobalAlpha: function (alpha)
{