-
Notifications
You must be signed in to change notification settings - Fork 4
Text
samme edited this page Nov 13, 2022
·
7 revisions
Bitmap text is drawn from a bitmap texture (or a frame thereof) and font data.
There are a few ways to create the font.
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');
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.
Dynamic bitmap text has per-character display effects (via callbacks) and scrolling effects (via scrollX
and scrollY
). Static bitmap text doesn't.
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).