Skip to content
samme edited this page Nov 13, 2022 · 7 revisions

Bitmap text

Bitmap text is drawn from a bitmap texture (or a frame thereof) and font data.

There are a few ways to create the font.

From an image and font data

Bitmap font generators make an image and XML data file. Use load.bitmapFont():

this.load.bitmapFont('desyrel', 'assets/fonts/bitmap/desyrel.png', 'assets/fonts/bitmap/desyrel.xml');

From an atlas and font data

Load the image and XML data separately, then call ParseFromAtlas() to create the font.

Retro font

Load the image and then call RetroFont.Parse() with the font data.

Game objects

Dynamic bitmap text has per-character display effects (via callbacks) and scrolling effects (via scrollX and scrollY). Static bitmap text doesn't.

Text

this.add.text(x, y, text, style)

Text game objects use Canvas 2d text on an internal canvas. They're quite flexible but more resource-expensive (especially in WebGL mode).

Clone this wiki locally