Skip to content

FloatPreview beta ​

Class of @v12-engine/editor

ts
export declare class FloatPreview

Floating words over a stand-in of a unit type, fired by kind as the game floats each event, drawn on a canvas over a stage (draw), or read (floats.shown)

Members ​

constructor ​

ts
constructor(registry: Registry, options?: {
        canvas?: HTMLCanvasElement;
        layer?: () => HTMLElement | undefined;
        scene?: () => object | undefined;
        icons?: IconSet;
        look?: UnitHudLook;
        camera?: () => {
            x: number;
            y: number;
            z: number;
        } | undefined;
        height?: () => number;
        eases?: (ease?: FloatEase) => Ease;
        random?: () => number;
        fail?: (part: string, error: unknown) => void;
    });

Constructs a new instance of the FloatPreview class

busy ​

ts
get busy(): boolean;

Whether any words are up: the stage draws while there are

dispose ​

ts
dispose(): void;

Takes every float down and lets go of what it drew with

draw ​

ts
draw(project: ProjectTo, width: number, height: number, dt: number, plate?: boolean): {
        ops: FrameList<DrawOp>;
        texts: FrameList<ScreenText>;
    };

Moves the words on by dt seconds and draws them, with the stand-in's plate under them where plate says, on the canvas width by height CSS pixels (resized as they change, at the page's pixel ratio). What was drawn

drawn ​

ts
get drawn(): readonly ScreenText[];

The words drawn last, as the overlay drew them: their words, colour, place, size, opacity

fire ​

ts
fire(kind: string, fire?: FloatFire): string | undefined;

Floats a kind over the stand-in as the game floats its event: a sample event of the kind (a hit, healing, a level) read as the client reads it, and the kind's def (or what its function gives) put up. What was put up's words, or nothing where the kind floats nothing

hud ​

ts
readonly hud: HudPreview;

The stand-in, its state as the knobs say, and its plate

show ​

ts
show(type: string, hud: UnitHudSource | null | undefined, knobs?: HudPreviewKnobs): void;

The stand-in: a unit type, the HUD drawn over it (null: none), its state as the knobs say

take ​

ts
take(set: FloatSet): void;

What each kind floats, as the panel has it now: kinds no longer in it float nothing