mwg API
    Preparing search index...

    Class RichLabel

    A label that renders basic inline markdown (**bold**, __bold__, *italic*, _italic*, combined ***both***) through Pixi's HTMLText, which is what makes mixed styles inside one string possible at all - plain Text styles the whole string or nothing, which is exactly what Label stays for.

    Costs more than a Label: HTML text measures and re-renders through the DOM rather than one canvas texture upload, so this is for descriptions, dialogue lines and help bodies, not for a number updated every frame. For the same reason it does not suit MessageBox's typewriter reveal - a half-revealed **bo shows its markers literally.

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

    const blurb = new RichLabel({ text: 'Take **two** *small* coins' });

    blurb.setText('Take **three** coins'); // skips the re-render if the string is unchanged

    Hierarchy

    • HTMLText
      • RichLabel
    Index
    • Destroys this text renderable and optionally its style texture.

      Parameters

      • Optionaloptions: DestroyOptions

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

      Returns void

      // Destroys the text and its style
      text.destroy({ style: true, texture: true, textureSource: true });
      text.destroy(true);
      text.destroy() // Destroys the text, but not its style
    • avoids the re-render when the markdown source has not actually changed

      Parameters

      • value: string

      Returns void

    • Shows markdown value progressively, speed visible characters per second - markers never count toward the total and never leak half-shown, which is exactly what a plain character slice over the source would get wrong. Driven by updateReveal(dt) like Label's own reveal, for the same reason: a label owns no update loop of its own.

      Parameters

      • value: string
      • Optionalspeed: number

      Returns void

    • advances an in-progress reveal; returns true when nothing is left to show

      Parameters

      • dt: number

      Returns boolean