Skip to content

1681-engine / index / Text

Class: Text ​

Defined in: src/core/Text.ts:18

Canvas text in world or screen space.

Extends ​

  • Text<this> & GameObjectMembers<this>

Constructors ​

Constructor ​

ts
new Text(
   x, 
   y, 
   text, 
   style
): Text;

Defined in: src/core/Text.ts:19

Parameters ​

ParameterType
xnumber
ynumber
textstring
styleTextStyle

Returns ​

Text

Overrides ​

ts
GameObject(PixiText).constructor

Properties ​

active ​

ts
readonly active: boolean;

Defined in: src/core/gameObject.ts:42

False once destroyed.

Inherited from ​

ts
GameObject(PixiText).active

depth ​

ts
depth: number;

Defined in: src/core/gameObject.ts:44

The draw order in the world layer (zIndex): bigger is in front.

Inherited from ​

ts
GameObject(PixiText).depth

flipX ​

ts
flipX: boolean;

Defined in: src/core/gameObject.ts:48

Inherited from ​

ts
GameObject(PixiText).flipX

flipY ​

ts
flipY: boolean;

Defined in: src/core/gameObject.ts:49

Inherited from ​

ts
GameObject(PixiText).flipY

scaleX ​

ts
scaleX: number;

Defined in: src/core/gameObject.ts:46

Scale without the flip: stays positive on a mirrored sprite.

Inherited from ​

ts
GameObject(PixiText).scaleX

scaleY ​

ts
scaleY: number;

Defined in: src/core/gameObject.ts:47

Inherited from ​

ts
GameObject(PixiText).scaleY

scene ​

ts
scene: Stage;

Defined in: src/core/gameObject.ts:40

Inherited from ​

ts
GameObject(PixiText).scene

Methods ​

clearTint() ​

ts
clearTint(): this;

Defined in: src/core/gameObject.ts:64

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).clearTint

destroy() ​

Call Signature ​

ts
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 ​
ParameterTypeDescription
options?DestroyOptionsOptions parameter. A boolean will act as if all options have been set to that value
Returns ​

void

Example ​
ts
// 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
Inherited from ​
ts
GameObject(PixiText).destroy

Call Signature ​

ts
destroy(): void;

Defined in: src/core/gameObject.ts:67

Returns ​

void

Inherited from ​
ts
GameObject(PixiText).destroy

setAlpha() ​

ts
setAlpha(a?): this;

Defined in: src/core/gameObject.ts:55

Parameters ​

ParameterType
a?number

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setAlpha

setAngle() ​

ts
setAngle(a?): this;

Defined in: src/core/gameObject.ts:59

Parameters ​

ParameterType
a?number

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setAngle

setBlendMode() ​

ts
setBlendMode(mode): this;

Defined in: src/core/gameObject.ts:60

Parameters ​

ParameterType
modeBLEND_MODES

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setBlendMode

setDepth() ​

ts
setDepth(d): this;

Defined in: src/core/gameObject.ts:54

Parameters ​

ParameterType
dnumber

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setDepth

setFlip() ​

ts
setFlip(x, y): this;

Defined in: src/core/gameObject.ts:53

Parameters ​

ParameterType
xboolean
yboolean

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setFlip

setFlipX() ​

ts
setFlipX(v): this;

Defined in: src/core/gameObject.ts:51

Parameters ​

ParameterType
vboolean

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setFlipX

setFlipY() ​

ts
setFlipY(v): this;

Defined in: src/core/gameObject.ts:52

Parameters ​

ParameterType
vboolean

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setFlipY

setOrigin() ​

ts
setOrigin(x?, y?): this;

Defined in: src/core/Text.ts:37

Parameters ​

ParameterTypeDefault value
xnumber0.5
ynumberx

Returns ​

this


setPosition() ​

ts
setPosition(x?, y?): this;

Defined in: src/core/gameObject.ts:57

Parameters ​

ParameterType
x?number
y?number

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setPosition

setRotation() ​

ts
setRotation(r?): this;

Defined in: src/core/gameObject.ts:58

Parameters ​

ParameterType
r?number

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setRotation

setScale() ​

ts
setScale(x, y?): this;

Defined in: src/core/gameObject.ts:50

Parameters ​

ParameterType
xnumber
y?number

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setScale

setScrollFactor() ​

ts
setScrollFactor(f): this;

Defined in: src/core/gameObject.ts:66

0 pins the object to the screen instead of the world.

Parameters ​

ParameterType
fnumber

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setScrollFactor

setText() ​

ts
setText(text): this;

Defined in: src/core/Text.ts:42

Parameters ​

ParameterType
textstring

Returns ​

this


setTint() ​

ts
setTint(color?): this;

Defined in: src/core/gameObject.ts:61

Parameters ​

ParameterType
color?number

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setTint

setTintFill() ​

ts
setTintFill(color): this;

Defined in: src/core/gameObject.ts:63

Paints every opaque pixel in one solid colour (hit flash, silhouettes).

Parameters ​

ParameterType
colornumber

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setTintFill

setVisible() ​

ts
setVisible(v): this;

Defined in: src/core/gameObject.ts:56

Parameters ​

ParameterType
vboolean

Returns ​

this

Inherited from ​

ts
GameObject(PixiText).setVisible

Released under the MIT License.