Skip to content

Class: Text

Text is a component for specifying text to render, alongside options for rendering it such as font, alignment, color and shaders.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

+ new Text(zOrder: number, value: string, font: string, align?: TextAlignment, spacing?: number, offset?: Vector, color?: Color, shaders?: string[]): Text

Parameters:

Name Type
zOrder number
value string
font string
align TextAlignment
spacing number
offset Vector
color Color
shaders string[]

Returns: Text

Inherited from: Component

Properties

align

align: TextAlignment

Text Alignment, changes the meaning of the transform position.


color

color: Color

Text color.


font

font: string

Font to use when rendering, must already be loaded with a FontAsset.


key

key: string

Inherited from: Component.key


offset

offset: Vector

The offset from the text origin to place the text, allows adding text above or below an entity.


shaders

shaders: string[]

List of shaders to apply.


spacing

spacing: number

Spacing between each character, represented as a percentage of the character's width, taken from transform.scale.x.


value

value: string

String to render.


zOrder

zOrder: number

Order which the text should appear, if it should appear infront/behind other objects, the higher the value the more precedence it is given and will appear in front of objects with a lower value.


KEY

Readonly Static KEY: text= "text"

Key of the text component.


MESSAGE_ADD

Readonly Static MESSAGE_ADD: component_add= "component_add"

Inherited from: Component.MESSAGE_ADD


MESSAGE_REMOVE

Readonly Static MESSAGE_REMOVE: component_remove= "component_remove"

Inherited from: Component.MESSAGE_REMOVE

Methods

Free

Free(): void

Returns: void

Overrides: Component