dacha
    Preparing search index...

    Class BitmapText

    BitmapText component for rendering text using a bitmap font.

    It handles text representation of an actor using a bitmap font. It uses an asset file in the format of a bitmap font (.fnt and .xml are supported) to render text.

    // Create a bitmap text
    const bitmapText = new BitmapText({
    text: 'Greetings traveller!',
    font: 'assets/fonts/some-pixel-font.fnt',
    fontSize: 24,
    align: 'center',
    color: '#000',
    opacity: 1,
    blending: 'normal',
    disabled: false,
    sortingLayer: 'text',
    sortOffset: { x: 0, y: 0 }
    });

    // Add to actor
    actor.setComponent(bitmapText);

    // Modify properties
    bitmapText.text = 'Stay a while and listen!';

    Hierarchy (View Summary)

    Index
    actor?: Actor
    align: TextAlign

    Alignment of the text

    • left - Align text to the left edge
    • center - Center text horizontally
    • right - Align text to the right edge
    blending: BlendingMode

    Blending mode of the text

    color: string

    Color of the text

    disabled: boolean

    Whether the text is disabled

    font: string

    Path to the font asset

    fontSize: number

    Size of the text

    opacity: number

    Opacity of the text

    renderData?: RenderData

    Internal rendering data

    sortingLayer: string

    Sorting layer of the text

    sortOffset: Point

    Center point of the text

    text: string

    Text to render

    componentName: string