1681-engine / index / BitmapLabel
Class: BitmapLabel ​
Defined in: src/core/BitmapLabel.ts:65
Text drawn from a bitmap font: the glyphs are rasterised once per font, so changing the string costs no canvas redraw and no texture upload, and every label of one font batches with the others. For the floating numbers, which a crowded fight throws dozens of a second — a plain Text repaints its canvas at resolution 4 and uploads it on every change.
Extends ​
BitmapText<this> &GameObjectMembers<this>
Constructors ​
Constructor ​
new BitmapLabel(
x,
y,
text,
fontFamily,
size,
color,
stroke,
strokeWidth,
resolution,
glyphs?
): BitmapLabel;Defined in: src/core/BitmapLabel.ts:71
fontFamily must already be loaded (document.fonts.load), or the glyphs bake in the fallback. Styled like worldText: the same font, size, colour and outline, rasterised at the same resolution. glyphs: letters beyond ASCII it prints (see installLabelFont).
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
x | number | undefined |
y | number | undefined |
text | string | undefined |
fontFamily | string | undefined |
size | number | undefined |
color | string | undefined |
stroke | string | undefined |
strokeWidth | number | undefined |
resolution | number | undefined |
glyphs | string | '' |
Returns ​
BitmapLabel
Overrides ​
GameObject(BitmapText).constructorProperties ​
active ​
readonly active: boolean;Defined in: src/core/gameObject.ts:42
False once destroyed.
Inherited from ​
GameObject(BitmapText).activedepth ​
depth: number;Defined in: src/core/gameObject.ts:44
The draw order in the world layer (zIndex): bigger is in front.
Inherited from ​
GameObject(BitmapText).depthflipX ​
flipX: boolean;Defined in: src/core/gameObject.ts:48
Inherited from ​
GameObject(BitmapText).flipXflipY ​
flipY: boolean;Defined in: src/core/gameObject.ts:49
Inherited from ​
GameObject(BitmapText).flipYscaleX ​
scaleX: number;Defined in: src/core/gameObject.ts:46
Scale without the flip: stays positive on a mirrored sprite.
Inherited from ​
GameObject(BitmapText).scaleXscaleY ​
scaleY: number;Defined in: src/core/gameObject.ts:47
Inherited from ​
GameObject(BitmapText).scaleYscene ​
scene: Stage;Defined in: src/core/gameObject.ts:40
Inherited from ​
GameObject(BitmapText).sceneMethods ​
clearTint() ​
clearTint(): this;Defined in: src/core/gameObject.ts:64
Returns ​
this
Inherited from ​
GameObject(BitmapText).clearTintdestroy() ​
Call Signature ​
destroy(options?): void;Defined in: node_modules/pixi.js/lib/scene/text/AbstractText.d.ts:481
Destroys this text renderable and optionally its style texture.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
options? | 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 styleInherited from ​
GameObject(BitmapText).destroyCall Signature ​
destroy(): void;Defined in: src/core/gameObject.ts:67
Returns ​
void
Inherited from ​
GameObject(BitmapText).destroysetAlpha() ​
setAlpha(a?): this;Defined in: src/core/gameObject.ts:55
Parameters ​
| Parameter | Type |
|---|---|
a? | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setAlphasetAngle() ​
setAngle(a?): this;Defined in: src/core/gameObject.ts:59
Parameters ​
| Parameter | Type |
|---|---|
a? | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setAnglesetBlendMode() ​
setBlendMode(mode): this;Defined in: src/core/gameObject.ts:60
Parameters ​
| Parameter | Type |
|---|---|
mode | BLEND_MODES |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setBlendModesetDepth() ​
setDepth(d): this;Defined in: src/core/gameObject.ts:54
Parameters ​
| Parameter | Type |
|---|---|
d | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setDepthsetFlip() ​
setFlip(x, y): this;Defined in: src/core/gameObject.ts:53
Parameters ​
| Parameter | Type |
|---|---|
x | boolean |
y | boolean |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setFlipsetFlipX() ​
setFlipX(v): this;Defined in: src/core/gameObject.ts:51
Parameters ​
| Parameter | Type |
|---|---|
v | boolean |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setFlipXsetFlipY() ​
setFlipY(v): this;Defined in: src/core/gameObject.ts:52
Parameters ​
| Parameter | Type |
|---|---|
v | boolean |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setFlipYsetOrigin() ​
setOrigin(x?, y?): this;Defined in: src/core/BitmapLabel.ts:77
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
x | number | 0.5 |
y | number | x |
Returns ​
this
setPosition() ​
setPosition(x?, y?): this;Defined in: src/core/gameObject.ts:57
Parameters ​
| Parameter | Type |
|---|---|
x? | number |
y? | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setPositionsetRotation() ​
setRotation(r?): this;Defined in: src/core/gameObject.ts:58
Parameters ​
| Parameter | Type |
|---|---|
r? | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setRotationsetScale() ​
setScale(x, y?): this;Defined in: src/core/gameObject.ts:50
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y? | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setScalesetScrollFactor() ​
setScrollFactor(f): this;Defined in: src/core/gameObject.ts:66
0 pins the object to the screen instead of the world.
Parameters ​
| Parameter | Type |
|---|---|
f | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setScrollFactorsetText() ​
setText(text): this;Defined in: src/core/BitmapLabel.ts:82
Parameters ​
| Parameter | Type |
|---|---|
text | string |
Returns ​
this
setTint() ​
setTint(color?): this;Defined in: src/core/gameObject.ts:61
Parameters ​
| Parameter | Type |
|---|---|
color? | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setTintsetTintFill() ​
setTintFill(color): this;Defined in: src/core/gameObject.ts:63
Paints every opaque pixel in one solid colour (hit flash, silhouettes).
Parameters ​
| Parameter | Type |
|---|---|
color | number |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setTintFillsetVisible() ​
setVisible(v): this;Defined in: src/core/gameObject.ts:56
Parameters ​
| Parameter | Type |
|---|---|
v | boolean |
Returns ​
this
Inherited from ​
GameObject(BitmapText).setVisible