mirror of
https://github.com/photonstorm/phaser
synced 2024-12-01 00:49:41 +00:00
Documented the Text game object and its TextStyle companion.
Minor update to JSON representation descriptions.
This commit is contained in:
parent
28851ff69b
commit
a6b8b8ed31
5 changed files with 215 additions and 158 deletions
|
@ -397,7 +397,7 @@ var DynamicBitmapText = new Class({
|
||||||
* @method Phaser.GameObjects.DynamicBitmapText#toJSON
|
* @method Phaser.GameObjects.DynamicBitmapText#toJSON
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {JSONBitmapText} The JSON representation of this Bitmap Text.
|
* @return {JSONBitmapText} A JSON representation of this Bitmap Text.
|
||||||
*/
|
*/
|
||||||
toJSON: function ()
|
toJSON: function ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -320,7 +320,7 @@ var BitmapText = new Class({
|
||||||
* @method Phaser.GameObjects.BitmapText#toJSON
|
* @method Phaser.GameObjects.BitmapText#toJSON
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {JSONBitmapText} The JSON representation of this Bitmap Text.
|
* @return {JSONBitmapText} A JSON representation of this Bitmap Text.
|
||||||
*/
|
*/
|
||||||
toJSON: function ()
|
toJSON: function ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON.
|
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON.
|
||||||
*
|
*
|
||||||
* @return {JSONGameObject} The JSON representation of the Game Object.
|
* @return {JSONGameObject} A JSON representation of the Game Object.
|
||||||
*/
|
*/
|
||||||
var ToJSON = function (gameObject)
|
var ToJSON = function (gameObject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ var propertyMap = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* [description]
|
* Style settings for a Text object.
|
||||||
*
|
*
|
||||||
* @class TextStyle
|
* @class TextStyle
|
||||||
* @memberOf Phaser.GameObjects.Text
|
* @memberOf Phaser.GameObjects.Text
|
||||||
|
@ -60,7 +60,7 @@ var propertyMap = {
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.Text} text - The Text object that this TextStyle is styling.
|
* @param {Phaser.GameObjects.Text} text - The Text object that this TextStyle is styling.
|
||||||
* @param {object} style - [description]
|
* @param {CSSStyleRule} style - The style settings to set.
|
||||||
*/
|
*/
|
||||||
var TextStyle = new Class({
|
var TextStyle = new Class({
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ var TextStyle = new Class({
|
||||||
this.parent = text;
|
this.parent = text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The font family.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#fontFamily
|
* @name Phaser.GameObjects.Text.TextStyle#fontFamily
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -88,7 +88,7 @@ var TextStyle = new Class({
|
||||||
this.fontFamily;
|
this.fontFamily;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The font size.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#fontSize
|
* @name Phaser.GameObjects.Text.TextStyle#fontSize
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -98,7 +98,7 @@ var TextStyle = new Class({
|
||||||
this.fontSize;
|
this.fontSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The font style.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#fontStyle
|
* @name Phaser.GameObjects.Text.TextStyle#fontStyle
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -107,7 +107,7 @@ var TextStyle = new Class({
|
||||||
this.fontStyle;
|
this.fontStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The background color.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#backgroundColor
|
* @name Phaser.GameObjects.Text.TextStyle#backgroundColor
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -116,7 +116,7 @@ var TextStyle = new Class({
|
||||||
this.backgroundColor;
|
this.backgroundColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The text fill color.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#color
|
* @name Phaser.GameObjects.Text.TextStyle#color
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -126,7 +126,7 @@ var TextStyle = new Class({
|
||||||
this.color;
|
this.color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The text stroke color.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#stroke
|
* @name Phaser.GameObjects.Text.TextStyle#stroke
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -136,7 +136,7 @@ var TextStyle = new Class({
|
||||||
this.stroke;
|
this.stroke;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The text stroke thickness.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#strokeThickness
|
* @name Phaser.GameObjects.Text.TextStyle#strokeThickness
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -146,7 +146,7 @@ var TextStyle = new Class({
|
||||||
this.strokeThickness;
|
this.strokeThickness;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The horizontal shadow offset.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#shadowOffsetX
|
* @name Phaser.GameObjects.Text.TextStyle#shadowOffsetX
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -156,7 +156,7 @@ var TextStyle = new Class({
|
||||||
this.shadowOffsetX;
|
this.shadowOffsetX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The vertical shadow offset.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#shadowOffsetY
|
* @name Phaser.GameObjects.Text.TextStyle#shadowOffsetY
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -166,7 +166,7 @@ var TextStyle = new Class({
|
||||||
this.shadowOffsetY;
|
this.shadowOffsetY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The shadow color.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#shadowColor
|
* @name Phaser.GameObjects.Text.TextStyle#shadowColor
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -176,7 +176,7 @@ var TextStyle = new Class({
|
||||||
this.shadowColor;
|
this.shadowColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The shadow blur radius.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#shadowBlur
|
* @name Phaser.GameObjects.Text.TextStyle#shadowBlur
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -186,7 +186,7 @@ var TextStyle = new Class({
|
||||||
this.shadowBlur;
|
this.shadowBlur;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Whether shadow stroke is enabled or not.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#shadowStroke
|
* @name Phaser.GameObjects.Text.TextStyle#shadowStroke
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -196,7 +196,7 @@ var TextStyle = new Class({
|
||||||
this.shadowStroke;
|
this.shadowStroke;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Whether shadow fill is enabled or not.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#shadowFill
|
* @name Phaser.GameObjects.Text.TextStyle#shadowFill
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -206,7 +206,7 @@ var TextStyle = new Class({
|
||||||
this.shadowFill;
|
this.shadowFill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The text alignment.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#align
|
* @name Phaser.GameObjects.Text.TextStyle#align
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -216,7 +216,7 @@ var TextStyle = new Class({
|
||||||
this.align;
|
this.align;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The maximum number of lines to draw.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#maxLines
|
* @name Phaser.GameObjects.Text.TextStyle#maxLines
|
||||||
* @type {integer}
|
* @type {integer}
|
||||||
|
@ -226,7 +226,9 @@ var TextStyle = new Class({
|
||||||
this.maxLines;
|
this.maxLines;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The fixed width of the text.
|
||||||
|
*
|
||||||
|
* `0` means no fixed with.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#fixedWidth
|
* @name Phaser.GameObjects.Text.TextStyle#fixedWidth
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -236,7 +238,9 @@ var TextStyle = new Class({
|
||||||
this.fixedWidth;
|
this.fixedWidth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The fixed height of the text.
|
||||||
|
*
|
||||||
|
* `0` means no fixed height.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#fixedHeight
|
* @name Phaser.GameObjects.Text.TextStyle#fixedHeight
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -246,7 +250,7 @@ var TextStyle = new Class({
|
||||||
this.fixedHeight;
|
this.fixedHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Whether the text should render right to left.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#rtl
|
* @name Phaser.GameObjects.Text.TextStyle#rtl
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -256,7 +260,7 @@ var TextStyle = new Class({
|
||||||
this.rtl;
|
this.rtl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The test string to use when measuring the font.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#testString
|
* @name Phaser.GameObjects.Text.TextStyle#testString
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -286,7 +290,7 @@ var TextStyle = new Class({
|
||||||
this.baselineY;
|
this.baselineY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The font style, size and family.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text.TextStyle#_font
|
* @name Phaser.GameObjects.Text.TextStyle#_font
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -317,13 +321,25 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text style.
|
||||||
|
*
|
||||||
|
* For example:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* text.style.setStyle({
|
||||||
|
* fontSize: '64px',
|
||||||
|
* fontFamily: 'Arial',
|
||||||
|
* color: '#ffffff',
|
||||||
|
* align: 'center',
|
||||||
|
* backgroundColor: '#ff00ff'
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setStyle
|
* @method Phaser.GameObjects.Text.TextStyle#setStyle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {CSSStyleRule} style - [description]
|
* @param {object} style - The style settings to set.
|
||||||
* @param {boolean} [updateText=true] - [description]
|
* @param {boolean} [updateText=true] - Whether to update the text immediately.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -381,13 +397,13 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Synchronize the font settings to the given Canvas Rendering Context.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#syncFont
|
* @method Phaser.GameObjects.Text.TextStyle#syncFont
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {HTMLCanvasElement} canvas - [description]
|
* @param {HTMLCanvasElement} canvas - The Canvas Element.
|
||||||
* @param {CanvasRenderingContext2D} context - [description]
|
* @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
|
||||||
*/
|
*/
|
||||||
syncFont: function (canvas, context)
|
syncFont: function (canvas, context)
|
||||||
{
|
{
|
||||||
|
@ -395,13 +411,13 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Synchronize the text style settings to the given Canvas Rendering Context.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#syncStyle
|
* @method Phaser.GameObjects.Text.TextStyle#syncStyle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {HTMLCanvasElement} canvas - [description]
|
* @param {HTMLCanvasElement} canvas - The Canvas Element.
|
||||||
* @param {CanvasRenderingContext2D} context - [description]
|
* @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
|
||||||
*/
|
*/
|
||||||
syncStyle: function (canvas, context)
|
syncStyle: function (canvas, context)
|
||||||
{
|
{
|
||||||
|
@ -416,13 +432,13 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Synchronize the shadow settings to the given Canvas Rendering Context.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#syncShadow
|
* @method Phaser.GameObjects.Text.TextStyle#syncShadow
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {CanvasRenderingContext2D} context - [description]
|
* @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
|
||||||
* @param {boolean} enabled - [description]
|
* @param {boolean} enabled - Whether shadows are enabled or not.
|
||||||
*/
|
*/
|
||||||
syncShadow: function (context, enabled)
|
syncShadow: function (context, enabled)
|
||||||
{
|
{
|
||||||
|
@ -443,12 +459,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Update the style settings for the parent Text object.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#update
|
* @method Phaser.GameObjects.Text.TextStyle#update
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {boolean} recalculateMetrics - [description]
|
* @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -465,12 +481,17 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font.
|
||||||
|
*
|
||||||
|
* If a string is given, the font family is set.
|
||||||
|
*
|
||||||
|
* If an object is given, the `fontFamily`, `fontSize` and `fontStyle`
|
||||||
|
* properties of that object are set.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setFont
|
* @method Phaser.GameObjects.Text.TextStyle#setFont
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(string|object)} font - [description]
|
* @param {(string|object)} font - The font family or font settings to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -493,12 +514,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font family.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setFontFamily
|
* @method Phaser.GameObjects.Text.TextStyle#setFontFamily
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} family - [description]
|
* @param {string} family - The font family.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -510,12 +531,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font style.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setFontStyle
|
* @method Phaser.GameObjects.Text.TextStyle#setFontStyle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} style - [description]
|
* @param {string} style - The font style.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -527,12 +548,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font size.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setFontSize
|
* @method Phaser.GameObjects.Text.TextStyle#setFontSize
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(number|string)} size - [description]
|
* @param {(number|string)} size - The font size.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -549,12 +570,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the test string to use when measuring the font.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setTestString
|
* @method Phaser.GameObjects.Text.TextStyle#setTestString
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} string - [description]
|
* @param {string} string - The test string to use when measuring the font.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -566,13 +587,15 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set a fixed width and height for the text.
|
||||||
|
*
|
||||||
|
* Pass in `0` for either of these parameters to disable fixed width or height respectively.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setFixedSize
|
* @method Phaser.GameObjects.Text.TextStyle#setFixedSize
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} width - [description]
|
* @param {number} width - The fixed width to set.
|
||||||
* @param {number} height - [description]
|
* @param {number} height - The fixed height to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -595,12 +618,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the background color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setBackgroundColor
|
* @method Phaser.GameObjects.Text.TextStyle#setBackgroundColor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The background color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -612,12 +635,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text fill color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setFill
|
* @method Phaser.GameObjects.Text.TextStyle#setFill
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The text fill color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -629,12 +652,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text fill color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setColor
|
* @method Phaser.GameObjects.Text.TextStyle#setColor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The text fill color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -646,13 +669,13 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the stroke settings.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setStroke
|
* @method Phaser.GameObjects.Text.TextStyle#setStroke
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The stroke color.
|
||||||
* @param {number} thickness - [description]
|
* @param {number} thickness - The stroke thickness.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -675,17 +698,17 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow settings.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setShadow
|
* @method Phaser.GameObjects.Text.TextStyle#setShadow
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} [x=0] - [description]
|
* @param {number} [x=0] - The horizontal shadow offset.
|
||||||
* @param {number} [y=0] - [description]
|
* @param {number} [y=0] - The vertical shadow offset.
|
||||||
* @param {string} [color='#000'] - [description]
|
* @param {string} [color='#000'] - The shadow color.
|
||||||
* @param {number} [blur=0] - [description]
|
* @param {number} [blur=0] - The shadow blur radius.
|
||||||
* @param {boolean} [shadowStroke=false] - [description]
|
* @param {boolean} [shadowStroke=false] - Whether to stroke the shadow.
|
||||||
* @param {boolean} [shadowFill=true] - [description]
|
* @param {boolean} [shadowFill=true] - Whether to fill the shadow.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -709,13 +732,13 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow offset.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setShadowOffset
|
* @method Phaser.GameObjects.Text.TextStyle#setShadowOffset
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} [x=0] - [description]
|
* @param {number} [x=0] - The horizontal shadow offset.
|
||||||
* @param {number} [y=0] - [description]
|
* @param {number} [y=0] - The vertical shadow offset.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -731,12 +754,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setShadowColor
|
* @method Phaser.GameObjects.Text.TextStyle#setShadowColor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} [color='#000'] - [description]
|
* @param {string} [color='#000'] - The shadow color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -750,12 +773,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow blur radius.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setShadowBlur
|
* @method Phaser.GameObjects.Text.TextStyle#setShadowBlur
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} [blur=0] - [description]
|
* @param {number} [blur=0] - The shadow blur radius.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -769,12 +792,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Enable or disable shadow stroke.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setShadowStroke
|
* @method Phaser.GameObjects.Text.TextStyle#setShadowStroke
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {boolean} enabled - [description]
|
* @param {boolean} enabled - Whether shadow stroke is enabled or not.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -786,12 +809,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Enable or disable shadow fill.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setShadowFill
|
* @method Phaser.GameObjects.Text.TextStyle#setShadowFill
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {boolean} enabled - [description]
|
* @param {boolean} enabled - Whether shadow fill is enabled or not.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -803,7 +826,9 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width (in pixels) to use for wrapping lines. Pass in null to remove wrapping by width.
|
* Set the width (in pixels) to use for wrapping lines.
|
||||||
|
*
|
||||||
|
* Pass in null to remove wrapping by width.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setWordWrapWidth
|
* @method Phaser.GameObjects.Text.TextStyle#setWordWrapWidth
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -826,7 +851,9 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a custom callback for wrapping lines. Pass in null to remove wrapping by callback.
|
* Set a custom callback for wrapping lines.
|
||||||
|
*
|
||||||
|
* Pass in null to remove wrapping by callback.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setWordWrapCallback
|
* @method Phaser.GameObjects.Text.TextStyle#setWordWrapCallback
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -850,12 +877,14 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text alignment.
|
||||||
|
*
|
||||||
|
* Expects values like `'left'`, `'right'`, `'center'` or `'justified'`.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setAlign
|
* @method Phaser.GameObjects.Text.TextStyle#setAlign
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} align - [description]
|
* @param {string} align - The text alignment.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -869,12 +898,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the maximum number of lines to draw.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#setMaxLines
|
* @method Phaser.GameObjects.Text.TextStyle#setMaxLines
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {integer} [max=0] - [description]
|
* @param {integer} [max=0] - The maximum number of lines to draw.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} The parent Text object.
|
* @return {Phaser.GameObjects.Text} The parent Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -888,12 +917,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Get the current text metrics.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#getTextMetrics
|
* @method Phaser.GameObjects.Text.TextStyle#getTextMetrics
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {object} [description]
|
* @return {object} The text metrics.
|
||||||
*/
|
*/
|
||||||
getTextMetrics: function ()
|
getTextMetrics: function ()
|
||||||
{
|
{
|
||||||
|
@ -907,12 +936,12 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Build a JSON representation of this Text Style.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#toJSON
|
* @method Phaser.GameObjects.Text.TextStyle#toJSON
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {object} [description]
|
* @return {object} A JSON representation of this Text Style.
|
||||||
*/
|
*/
|
||||||
toJSON: function ()
|
toJSON: function ()
|
||||||
{
|
{
|
||||||
|
@ -929,7 +958,7 @@ var TextStyle = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Destroy this Text Style.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text.TextStyle#destroy
|
* @method Phaser.GameObjects.Text.TextStyle#destroy
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
|
|
@ -101,7 +101,9 @@ var Text = new Class({
|
||||||
this.context = this.canvas.getContext('2d');
|
this.context = this.canvas.getContext('2d');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The Text Style object.
|
||||||
|
*
|
||||||
|
* Manages the style of this Text object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#style
|
* @name Phaser.GameObjects.Text#style
|
||||||
* @type {Phaser.GameObjects.Text.TextStyle}
|
* @type {Phaser.GameObjects.Text.TextStyle}
|
||||||
|
@ -110,7 +112,7 @@ var Text = new Class({
|
||||||
this.style = new TextStyle(this, style);
|
this.style = new TextStyle(this, style);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Whether to automatically round line positions.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#autoRound
|
* @name Phaser.GameObjects.Text#autoRound
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -131,7 +133,7 @@ var Text = new Class({
|
||||||
this.splitRegExp = /(?:\r\n|\r|\n)/;
|
this.splitRegExp = /(?:\r\n|\r|\n)/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The text to display.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#text
|
* @name Phaser.GameObjects.Text#text
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -140,7 +142,7 @@ var Text = new Class({
|
||||||
this.text = '';
|
this.text = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The resolution of the text.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#resolution
|
* @name Phaser.GameObjects.Text#resolution
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -160,7 +162,7 @@ var Text = new Class({
|
||||||
this.padding = { left: 0, right: 0, top: 0, bottom: 0 };
|
this.padding = { left: 0, right: 0, top: 0, bottom: 0 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The width of this Text object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#width
|
* @name Phaser.GameObjects.Text#width
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -170,7 +172,7 @@ var Text = new Class({
|
||||||
this.width = 1;
|
this.width = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The height of this Text object.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#height
|
* @name Phaser.GameObjects.Text#height
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -180,7 +182,7 @@ var Text = new Class({
|
||||||
this.height = 1;
|
this.height = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The Canvas Texture that the text is rendered to for WebGL rendering.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#canvasTexture
|
* @name Phaser.GameObjects.Text#canvasTexture
|
||||||
* @type {HTMLCanvasElement}
|
* @type {HTMLCanvasElement}
|
||||||
|
@ -190,7 +192,7 @@ var Text = new Class({
|
||||||
this.canvasTexture = null;
|
this.canvasTexture = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Whether the text or its settings have changed and need updating.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Text#dirty
|
* @name Phaser.GameObjects.Text#dirty
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -224,7 +226,7 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Initialize right to left text.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#initRTL
|
* @method Phaser.GameObjects.Text#initRTL
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -308,8 +310,8 @@ var Text = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} text - The text to perform word wrap detection against.
|
* @param {string} text - The text to perform word wrap detection against.
|
||||||
* @param {CanvasRenderingContext2D} context - [description]
|
* @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
|
||||||
* @param {number} wordWrapWidth - [description]
|
* @param {number} wordWrapWidth - The word wrap width.
|
||||||
*
|
*
|
||||||
* @return {string} The wrapped text.
|
* @return {string} The wrapped text.
|
||||||
*/
|
*/
|
||||||
|
@ -428,8 +430,8 @@ var Text = new Class({
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} text - The text to perform word wrap detection against.
|
* @param {string} text - The text to perform word wrap detection against.
|
||||||
* @param {CanvasRenderingContext2D} context - [description]
|
* @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
|
||||||
* @param {number} wordWrapWidth - [description]
|
* @param {number} wordWrapWidth - The word wrap width.
|
||||||
*
|
*
|
||||||
* @return {string} The wrapped text.
|
* @return {string} The wrapped text.
|
||||||
*/
|
*/
|
||||||
|
@ -504,7 +506,9 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text to display.
|
||||||
|
*
|
||||||
|
* An array of strings will be joined with `\n` line breaks.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setText
|
* @method Phaser.GameObjects.Text#setText
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -536,12 +540,24 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text style.
|
||||||
|
*
|
||||||
|
* For example:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* text.setStyle({
|
||||||
|
* fontSize: '64px',
|
||||||
|
* fontFamily: 'Arial',
|
||||||
|
* color: '#ffffff',
|
||||||
|
* align: 'center',
|
||||||
|
* backgroundColor: '#ff00ff'
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setStyle
|
* @method Phaser.GameObjects.Text#setStyle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {object} style - [description]
|
* @param {object} style - The style settings to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -551,12 +567,17 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font.
|
||||||
|
*
|
||||||
|
* If a string is given, the font family is set.
|
||||||
|
*
|
||||||
|
* If an object is given, the `fontFamily`, `fontSize` and `fontStyle`
|
||||||
|
* properties of that object are set.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setFont
|
* @method Phaser.GameObjects.Text#setFont
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} font - [description]
|
* @param {string} font - The font family or font settings to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -566,12 +587,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font family.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setFontFamily
|
* @method Phaser.GameObjects.Text#setFontFamily
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} family - [description]
|
* @param {string} family - The font family.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -581,12 +602,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font size.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setFontSize
|
* @method Phaser.GameObjects.Text#setFontSize
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} size - [description]
|
* @param {number} size - The font size.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -596,12 +617,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the font style.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setFontStyle
|
* @method Phaser.GameObjects.Text#setFontStyle
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} style - [description]
|
* @param {string} style - The font style.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -611,13 +632,15 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set a fixed width and height for the text.
|
||||||
|
*
|
||||||
|
* Pass in `0` for either of these parameters to disable fixed width or height respectively.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setFixedSize
|
* @method Phaser.GameObjects.Text#setFixedSize
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} width - [description]
|
* @param {number} width - The fixed width to set. `0` disables fixed width.
|
||||||
* @param {number} height - [description]
|
* @param {number} height - The fixed height to set. `0` disables fixed height.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -627,12 +650,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the background color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setBackgroundColor
|
* @method Phaser.GameObjects.Text#setBackgroundColor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The background color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -642,12 +665,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text fill color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setFill
|
* @method Phaser.GameObjects.Text#setFill
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The text fill color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -657,12 +680,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text fill color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setColor
|
* @method Phaser.GameObjects.Text#setColor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The text fill color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -672,13 +695,13 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the stroke settings.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setStroke
|
* @method Phaser.GameObjects.Text#setStroke
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The stroke color.
|
||||||
* @param {number} thickness - [description]
|
* @param {number} thickness - The stroke thickness.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -688,17 +711,17 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow settings.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setShadow
|
* @method Phaser.GameObjects.Text#setShadow
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} x - [description]
|
* @param {number} [x=0] - The horizontal shadow offset.
|
||||||
* @param {number} y - [description]
|
* @param {number} [y=0] - The vertical shadow offset.
|
||||||
* @param {string} color - [description]
|
* @param {string} [color='#000'] - The shadow color.
|
||||||
* @param {number} blur - [description]
|
* @param {number} [blur=0] - The shadow blur radius.
|
||||||
* @param {boolean} shadowStroke - [description]
|
* @param {boolean} [shadowStroke=false] - Whether to stroke the shadow.
|
||||||
* @param {boolean} shadowFill - [description]
|
* @param {boolean} [shadowFill=true] - Whether to fill the shadow.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -708,13 +731,13 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow offset.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setShadowOffset
|
* @method Phaser.GameObjects.Text#setShadowOffset
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} x - [description]
|
* @param {number} x - The horizontal shadow offset.
|
||||||
* @param {number} y - [description]
|
* @param {number} y - The vertical shadow offset.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -724,12 +747,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow color.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setShadowColor
|
* @method Phaser.GameObjects.Text#setShadowColor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} color - [description]
|
* @param {string} color - The shadow color.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -739,12 +762,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the shadow blur radius.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setShadowBlur
|
* @method Phaser.GameObjects.Text#setShadowBlur
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {number} blur - [description]
|
* @param {number} blur - The shadow blur radius.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -754,12 +777,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Enable or disable shadow stroke.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setShadowStroke
|
* @method Phaser.GameObjects.Text#setShadowStroke
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {boolean} enabled - [description]
|
* @param {boolean} enabled - Whether shadow stroke is enabled or not.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -769,12 +792,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Enable or disable shadow fill.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setShadowFill
|
* @method Phaser.GameObjects.Text#setShadowFill
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {boolean} enabled - [description]
|
* @param {boolean} enabled - Whether shadow fill is enabled or not.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -821,12 +844,14 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the text alignment.
|
||||||
|
*
|
||||||
|
* Expects values like `'left'`, `'right'`, `'center'` or `'justified'`.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setAlign
|
* @method Phaser.GameObjects.Text#setAlign
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {string} align - [description]
|
* @param {string} align - The text alignment.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -836,16 +861,19 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the text padding.
|
||||||
|
*
|
||||||
* 'left' can be an object.
|
* 'left' can be an object.
|
||||||
* If only 'left' and 'top' are given they are treated as 'x' and 'y'
|
*
|
||||||
|
* If only 'left' and 'top' are given they are treated as 'x' and 'y'.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setPadding
|
* @method Phaser.GameObjects.Text#setPadding
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {(number|object)} left - [description]
|
* @param {(number|object)} left - The left padding value, or a padding config object.
|
||||||
* @param {number} top - [description]
|
* @param {number} top - The top padding value.
|
||||||
* @param {number} right - [description]
|
* @param {number} right - The right padding value.
|
||||||
* @param {number} bottom - [description]
|
* @param {number} bottom - The bottom padding value.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -899,12 +927,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Set the maximum number of lines to draw.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#setMaxLines
|
* @method Phaser.GameObjects.Text#setMaxLines
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {integer} [max=0] - [description]
|
* @param {integer} [max=0] - The maximum number of lines to draw.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.Text} This Text object.
|
* @return {Phaser.GameObjects.Text} This Text object.
|
||||||
*/
|
*/
|
||||||
|
@ -914,7 +942,7 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Update the displayed text.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#updateText
|
* @method Phaser.GameObjects.Text#updateText
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -1050,12 +1078,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Get the current text metrics.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#getTextMetrics
|
* @method Phaser.GameObjects.Text#getTextMetrics
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {object} [description]
|
* @return {object} The text metrics.
|
||||||
*/
|
*/
|
||||||
getTextMetrics: function ()
|
getTextMetrics: function ()
|
||||||
{
|
{
|
||||||
|
@ -1063,12 +1091,12 @@ var Text = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Build a JSON representation of the Text object.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Text#toJSON
|
* @method Phaser.GameObjects.Text#toJSON
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {JSONGameObject} A JSON representation of the Game Object.
|
* @return {JSONGameObject} A JSON representation of the Text object.
|
||||||
*/
|
*/
|
||||||
toJSON: function ()
|
toJSON: function ()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue