Class: LocText

LocText

A Phaser Text extension handling text fitting and localization.


new LocText(game, x, y, text, options)

Create a LocText.

Parameters:
Name Type Description
game Phaser.Game

A Phaser Game instance.

x Number

x coordinate.

y Number

y coordinate.

text string

the translation key to be localized.

options Object

An optional list of options.

Properties
Name Type Argument Default Description
width string

The width of the text box

height string

The height of the text box

container string

An object containing the text

fontStyle string <optional>
30px Arial

The text style, i.e. '30px Arial'

fill string <optional>
#000

Fill color

align string <optional>
left

Text alignment

lineSpacing Number <optional>

Space between lines, if there are more than one

padX string <optional>
0

X padding referred to the container

padY string <optional>
0

Y padding referred to the container

Extends

  • Phaser.Text

Members


localizationKey

Setter for the localization key


textHeight

Setter for text height


textWidth

Setter for text width

Methods


refit()

Refits the text inside the box provided