mwg API
    Preparing search index...

    Class BitmapLabel

    A piece of text baked into a glyph-atlas texture instead of rasterised fresh on every change, the way Label (a thin wrapper over Pixi's Text) does. Label's own doc comment already names the cost this exists to avoid: "wasteful for something updated every frame". A live HUD counter, a scrolling log, or a fixed pixel font a pixel-art game wants for all its UI copy are what this is for; a game whose text rarely changes has no reason to prefer it over Label.

    Pixi generates and caches the underlying bitmap font itself the first time a given family/size/colour/weight combination is used (see BitmapText's "Dynamic Bitmap Fonts" behaviour) - nothing here downloads or ships a font file, keeping this the same generated-not-borrowed shape as every other asset in this project.

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

    const fps = new BitmapLabel({ text: '60 fps', size: 12 });

    fps.setText('59 fps'); // updated every frame, cheaply, unlike Label

    Hierarchy

    • BitmapText
      • BitmapLabel
    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 atlas relookup when the text has not actually changed

      Parameters

      • value: string

      Returns void