Atlas Engine
API Referencegraphite

Text

UI text rendered with a font, color, screen position, and optional style.

Module: graphite

UI text rendered with a font, color, screen position, and optional style.

Declaration

export class Text extends UIObject { ... }

Extends: UIObject

Constructors

Creates a new text.

constructor();

Creates a new text.

constructor(
            text: string,
            font: Font,
            color: Color,
            position: Position2d,
        );

Properties

content

The content.

content: string;

font

The font.

font: Font;

position

The position in world space.

position: Position3d;

fontSize

The font size.

fontSize: number;

color

The RGBA color.

color: Color;

Methods

getSize

Returns the current dimensions.

override getSize(): Size2d;

getScreenPosition

Returns the UI element's screen-space position.

override getScreenPosition(): Position2d;

setScreenPosition

Sets the UI element's screen-space position.

override setScreenPosition(position: Position2d): void;

style

Returns the element's style.

style(): UIStyle;

setStyle

Applies a style to the element.

setStyle(style: UIStyle): Text;

setFontSize

Sets font size.

setFontSize(size: number): Text;

On this page