HudPreview beta
Class of @v12-engine/editor
export declare class HudPreviewA unit's HUD drawn by the client's own layer for a stand-in of a type, its state set by knobs: what a panel shows over a stage (draw), or reads (collect)
Members
constructor
constructor(registry: Registry, options?: {
canvas?: HTMLCanvasElement;
icons?: IconSet;
camera?: () => {
x: number;
y: number;
z: number;
} | undefined;
height?: () => number;
look?: UnitHudLook;
now?: () => number;
measure?: (font: string, text: string) => number;
});Constructs a new instance of the HudPreview class
collect
collect(project: ProjectTo): FrameList<DrawOp>;What the layer draws this frame, where project puts the world on the screen
dispose
dispose(): void;Lets go of the layer and what it drew with
draw
draw(project: ProjectTo, width: number, height: number): FrameList<DrawOp>;Draws it on the canvas, width by height CSS pixels (resized as they change, at the page's pixel ratio)
layer
readonly layer: UnitHudLayer;The client's own plate layer that lays out and draws the HUD
plate
plate(): UnitHudPlate | null;The plate the stand-in shows now: picked for who looks, its state and the camera's distance
resolved
resolved(): UnitHudDef | UnitHudPlate | null;The HUD the stand-in has, as said (a function's worked out for it now), before a plate is picked: null for none
show
show(type: string, hud: UnitHudSource | null | undefined, knobs?: HudPreviewKnobs): void;Shows a unit type with a HUD, in a state: the HUD as being edited (undefined: the client's own plate, null: none), the stand-in's state as the knobs say
state
readonly state: GameState;The stand-in's game: one unit of the type shown, its state from the knobs