mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 17:16:03 +00:00
729020477a
Moved BitmapData and RenderTexture into the textures folder for now. All Game Objects now have their own sub-folder, with their Factory and renderer functions alongside them, plus any other files they need. New Factory class added. Currently hooked into `game.factory` for testing, but will swap to `game.add` when complete.
42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2016 Photon Storm Ltd.
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
*/
|
|
|
|
Phaser.GameObjects.Text.FACTORY_KEY = 'text';
|
|
|
|
/**
|
|
* Creates a new Text object.
|
|
*
|
|
* @method Phaser.GameObjects.Factory#text
|
|
* @param {number} [x=0] - The x coordinate of the Text. The coordinate is relative to any parent container this text may be in.
|
|
* @param {number} [y=0] - The y coordinate of the Text. The coordinate is relative to any parent container this text may be in.
|
|
* @param {string} [text=''] - The text string that will be displayed.
|
|
* @param {object} [style] - The style object containing style attributes like font, font size , etc.
|
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
|
* @return {Phaser.Text} The newly created text object.
|
|
*/
|
|
Phaser.GameObjects.Text.FACTORY_ADD = function (x, y, text, style, group) {
|
|
|
|
if (group === undefined) { group = this.world; }
|
|
|
|
return group.add(new Phaser.GameObjects.Text(this.game, x, y, text, style));
|
|
|
|
};
|
|
|
|
/**
|
|
* Creates a new Text object.
|
|
*
|
|
* @method Phaser.GameObjects.Creator#text
|
|
* @param {number} x - X position of the new text object.
|
|
* @param {number} y - Y position of the new text object.
|
|
* @param {string} text - The actual text that will be written.
|
|
* @param {object} style - The style object containing style attributes like font, font size , etc.
|
|
* @return {Phaser.Text} The newly created text object.
|
|
*/
|
|
Phaser.GameObjects.Text.FACTORY_MAKE = function (x, y, text, style) {
|
|
|
|
return new Phaser.GameObjects.Text(this.game, x, y, text, style);
|
|
|
|
};
|