bitmapText(x, y, font, text, size, align) → {Phaser.BitmapText}
Create a new BitmapText object.
BitmapText objects work by taking a texture file and an XML file that describes the font structure.
It then generates a new Sprite object for each letter of the text, proportionally spaced out and aligned to
match the font structure.
BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
to use Web Fonts. However you trade this flexibility for pure rendering speed. You can also create visually compelling BitmapTexts by
processing the font texture in an image editor first, applying fills and any other effects required.
To create multi-line text insert \r, \n or \r\n escape codes into the text string.
To create a BitmapText data files you can use:
BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
Littera (Web-based, free): http://kvazars.com/littera/
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x | number | X coordinate to display the BitmapText object at. | ||
y | number | Y coordinate to display the BitmapText object at. | ||
font | string | The key of the BitmapText as stored in Phaser.Cache. | ||
text | string | <optional> | '' | The text that will be rendered. This can also be set later via BitmapText.text. |
size | number | <optional> | 32 | The size the font will be rendered at in pixels. |
align | string | <optional> | 'left' | The alignment of multi-line text. Has no effect if there is only one line of text. |
Returns
The newly created bitmapText object.
- Source code: gameobjects/GameObjectCreator.js (Line 297)
Please login to continue.