mwg API
    Preparing search index...

    Class MarkupText

    The canvas backend for inline markup, and the counterpart to RichLabel's HTML text: the same MarkupSpan stream, laid out once by layoutMarkupLines and positionMarkupLines, drawn here as one Text2D per styled run (colour, size, emphasis) and one Sprite2D per <img> span, resolved through the asset resolver. That split is the point - Pixi's HTMLText (which RichLabel builds on) renders emphasis but has no inline-image primitive, so an image would otherwise be dropped or a caller would have to position it itself at a layoutMarkupLines offset by hand. This class is the component that does that wiring.

    Costs more than a Label (one drawable per run), so it is for descriptions, dialogue lines and help bodies, not per-frame numbers - the same guidance RichLabel already carries.

    import { MarkupText } from '@datamoc/mw_games/two-d/ui';

    const description = new MarkupText({ text: 'Pay <b>10</b> gold<img>coin.png</img>', maxWidth: 240 });
    description.setText('Pay <b>15</b> gold<img>coin.png</img>');

    Hierarchy

    • Container
      • MarkupText
    Index
    • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

      Parameters

      • Optionaloptions: DestroyOptions

        Options parameter. A boolean will act as if all options have been set to that value

      Returns void

      container.destroy();
      container.destroy(true);
      container.destroy({ children: true });
      container.destroy({ children: true, texture: true, textureSource: true });
    • replaces the markup source and redraws, so a description can be updated in place

      Parameters

      • value: string

      Returns void