mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
Documented DynamicBitmapText display callbacks.
Finished up some DynamicBitmapText related descriptions. Removed the align property from BitmapTextConfig, as it's not used.
This commit is contained in:
parent
79c3242c68
commit
fb33fd045d
5 changed files with 28 additions and 22 deletions
|
@ -16,7 +16,7 @@ var GetValue = require('../../utils/object/GetValue');
|
||||||
* @param {Phaser.Scene} scene - A reference to the Phaser Scene.
|
* @param {Phaser.Scene} scene - A reference to the Phaser Scene.
|
||||||
* @param {Phaser.GameObjects.RetroFont.Config} config - The font configuration object.
|
* @param {Phaser.GameObjects.RetroFont.Config} config - The font configuration object.
|
||||||
*
|
*
|
||||||
* @return {object} [description]
|
* @return {object} A parsed Bitmap Font data entry for the Bitmap Font cache.
|
||||||
*/
|
*/
|
||||||
var ParseRetroFont = function (scene, config)
|
var ParseRetroFont = function (scene, config)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,20 +12,22 @@ var Render = require('./DynamicBitmapTextRender');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} DisplayCallbackConfig
|
* @typedef {object} DisplayCallbackConfig
|
||||||
* @property {{topLeft:number,topRight:number,bottomLeft:number,bottomRight:number}} tint - [description]
|
* @property {{topLeft:number,topRight:number,bottomLeft:number,bottomRight:number}} tint - The tint of the character being rendered.
|
||||||
* @property {number} index - [description]
|
* @property {number} index - The index of the character being rendered.
|
||||||
* @property {number} charCode - [description]
|
* @property {number} charCode - The character code of the character being rendered.
|
||||||
* @property {number} x - [description]
|
* @property {number} x - The x position of the character being rendered.
|
||||||
* @property {number} y - [description]
|
* @property {number} y - The y position of the character being rendered.
|
||||||
* @property {number} scale - [description]
|
* @property {number} scale - The scale of the character being rendered.
|
||||||
* @property {number} rotation - [description]
|
* @property {number} rotation - The rotation of the character being rendered.
|
||||||
* @property {any} data - [description]
|
* @property {any} data - Custom data stored with the character being rendered.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @callback DisplayCallback
|
* @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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +192,7 @@ var DynamicBitmapText = new Class({
|
||||||
this.cropHeight = 0;
|
this.cropHeight = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* A callback that alters how each character of the Bitmap Text is rendered.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.DynamicBitmapText#displayCallback;
|
* @name Phaser.GameObjects.DynamicBitmapText#displayCallback;
|
||||||
* @type {DisplayCallback}
|
* @type {DisplayCallback}
|
||||||
|
@ -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
|
* @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {DisplayCallback} callback - [description]
|
* @param {DisplayCallback} callback - The display callback to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
|
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,7 +16,6 @@ var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue');
|
||||||
* @property {string} [font=''] - The key of the font to use from the BitmapFont cache.
|
* @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 {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.
|
* @property {(number|false)} [size=false] - The font size to set.
|
||||||
* @property {string} [align='left'] - The alignment to set.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,9 +38,8 @@ GameObjectCreator.register('dynamicBitmapText', function (config, addToScene)
|
||||||
var font = GetAdvancedValue(config, 'font', '');
|
var font = GetAdvancedValue(config, 'font', '');
|
||||||
var text = GetAdvancedValue(config, 'text', '');
|
var text = GetAdvancedValue(config, 'text', '');
|
||||||
var size = GetAdvancedValue(config, 'size', false);
|
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)
|
if (addToScene !== undefined)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,9 +17,9 @@ var GameObjectFactory = require('../../GameObjectFactory');
|
||||||
*
|
*
|
||||||
* @param {number} x - The x position of the Game Object.
|
* @param {number} x - The x position of the Game Object.
|
||||||
* @param {number} y - The y position of the Game Object.
|
* @param {number} y - The y position of the Game Object.
|
||||||
* @param {string} font - [description]
|
* @param {string} font - The key of the font to use from the BitmapFont cache.
|
||||||
* @param {(string|string[])} [text] - [description]
|
* @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
|
||||||
* @param {number} [size] - [description]
|
* @param {number} [size] - The font size to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created.
|
* @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,9 +17,9 @@ var GameObjectFactory = require('../../GameObjectFactory');
|
||||||
*
|
*
|
||||||
* @param {number} x - The x position of the Game Object.
|
* @param {number} x - The x position of the Game Object.
|
||||||
* @param {number} y - The y position of the Game Object.
|
* @param {number} y - The y position of the Game Object.
|
||||||
* @param {string} font - [description]
|
* @param {string} font - The key of the font to use from the BitmapFont cache.
|
||||||
* @param {(string|string[])} [text] - [description]
|
* @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
|
||||||
* @param {number} [size] - [description]
|
* @param {number} [size] - The font size to set.
|
||||||
*
|
*
|
||||||
* @return {Phaser.GameObjects.BitmapText} The Game Object that was created.
|
* @return {Phaser.GameObjects.BitmapText} The Game Object that was created.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue