Skip to content

Documentation / device / DrawText

Class: DrawText ​

Defined in: libs/device/src/helpers/drawtext.ts:31

Helper class to draw some text onto the screen

Constructors ​

Constructor ​

new DrawText(): DrawText

Returns ​

DrawText

Methods ​

setFont() ​

static setFont(device, name): void

Defined in: libs/device/src/helpers/drawtext.ts:82

Set the font that will be used to draw strings

Parameters ​

device ​

AbstractDevice

The render device

name ​

string

The font name

Returns ​

void


setRenderStates() ​

static setRenderStates(renderStates): void

Defined in: libs/device/src/helpers/drawtext.ts:90

Set render states to be used when drawing text. If not set, default states will be used.

Parameters ​

renderStates ​

RenderStateSet

The render states to use when drawing text. If null, default states will be used.

Returns ​

void


drawText() ​

Call Signature ​

static drawText(device, text, color, x, y): void

Defined in: libs/device/src/helpers/drawtext.ts:101

Draw text onto the screen

Parameters ​
device ​

AbstractDevice

The render device

text ​

string

The text to be drawn

color ​

string | Vector4 | Vector3

The text color

x ​

number

X coordinate of the text

y ​

number

Y coordinate of the text

Returns ​

void

Call Signature ​

static drawText(device, text, color, rect, options?): void

Defined in: libs/device/src/helpers/drawtext.ts:116

Draw text inside a rectangle with layout and clipping

Parameters ​
device ​

AbstractDevice

The render device

text ​

string

The text to be drawn

color ​

string | Vector4 | Vector3

The text color

rect ​

Immutable<Rect>

The layout rectangle

options? ​

DrawTextLayoutOptions

Layout options

Returns ​

void

Released under the MIT License.