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.
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
Example
// 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
setText
setText(value:string):void
avoids the atlas relookup when the text has not actually changed
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'sText) 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 overLabel.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.Example