-
Notifications
You must be signed in to change notification settings - Fork 4
Text
samme edited this page Nov 12, 2022
·
7 revisions
There are different kinds.
Bitmap text is drawn from a bitmap texture (or a frame thereof) and font data (character set and coordinates).
This is the usual way. The data file is XML (either fnt or xml extension).
this.load.bitmapFont('desyrel', 'assets/fonts/bitmap/desyrel.png', 'assets/fonts/bitmap/desyrel.xml');
Load the image and XML data separately, then call ParseFromAtlas()
to create the font.
Load the image and then call RetroFont.Parse()
with the font data.
this.add.bitmapText(x, y, font, text, size, align)
Static bitmap text lacks the "dynamic" rendering features (see below).
this.add.dynamicBitmapText(x, y, font, text, size)
Dynamic bitmap text has per-character display effects (via callbacks) and scrolling effects (via scrollX
and scrollY
).
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).