1681-engine / index / SharpText
Class: SharpText ​
Defined in: src/core/SharpText.ts:25
The world's text kept at screen resolution while the rest of the world is drawn one texel to a world pixel (PixelGrid): a small font squeezed into world pixels cannot be read. Each tracked label (every add.text and add.label; Stage.keepSharp for one made elsewhere) is lifted out of the container it was put in and hung on a stand-in on this layer, which copies that container's transform relative to the world, its visibility and alpha every frame, so the game keeps writing the label's own position, text and alpha as before. All of them draw over the world, sorted by the depth of the world's child they belong to; a label's container destroyed takes the label with it.
Constructors ​
Constructor ​
new SharpText(world): SharpText;Defined in: src/core/SharpText.ts:32
Parameters ​
| Parameter | Type |
|---|---|
world | Container |
Returns ​
SharpText
Properties ​
layer ​
readonly layer: Container<ContainerChild>;Defined in: src/core/SharpText.ts:26
Methods ​
destroy() ​
destroy(): void;Defined in: src/core/SharpText.ts:94
Returns ​
void
prune() ​
prune(): void;Defined in: src/core/SharpText.ts:89
Forgets labels the game destroyed while nothing synced (the grid off).
Returns ​
void
release() ​
release(): void;Defined in: src/core/SharpText.ts:70
Every label back in its home (the grid switched off), the stand-ins gone.
Returns ​
void
sync() ​
sync(origin, zoom): void;Defined in: src/core/SharpText.ts:40
Lays the layer over the world (origin: where the world's origin lands on screen) and every label on its home.
Parameters ​
| Parameter | Type |
|---|---|
origin | { x: number; y: number; } |
origin.x | number |
origin.y | number |
zoom | number |
Returns ​
void
track() ​
track(obj): void;Defined in: src/core/SharpText.ts:34
Parameters ​
| Parameter | Type |
|---|---|
obj | Container |
Returns ​
void