RetroFont#RetroFont

new RetroFont(game, key, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset)

A Retro Font is similar to a BitmapFont, in that it uses a texture to render the text. However unlike a BitmapFont every character in a RetroFont
is the same size. This makes it similar to a sprite sheet. You typically find font sheets like this from old 8/16-bit games and demos.

Parameters
Name Type Argument Default Description
game Phaser.Game

Current game instance.

key string

The font set graphic set as stored in the Game.Cache.

characterWidth number

The width of each character in the font set.

characterHeight number

The height of each character in the font set.

chars string

The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.

charsPerRow number <optional>

The number of characters per row in the font set. If not given charsPerRow will be the image width / characterWidth.

xSpacing number <optional>
0

If the characters in the font set have horizontal spacing between them set the required amount here.

ySpacing number <optional>
0

If the characters in the font set have vertical spacing between them set the required amount here.

xOffset number <optional>
0

If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.

yOffset number <optional>
0

If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.

Source code: gameobjects/RetroFont.js (Line 25)
doc_phaser
2017-02-14 11:07:54
Comments
Leave a Comment

Please login to continue.