Skip to content

DrawOp beta ​

TypeAlias of @v12-engine/client

ts
export type DrawOp = {
    kind: 'rect';
    x: number;
    y: number;
    width: number;
    height: number;
    color: string;
    tag?: string;
    entity?: number;
} | {
    kind: 'text';
    x: number;
    y: number;
    text: string;
    font: string;
    color: string;
} | {
    kind: 'circle';
    x: number;
    y: number;
    radius: number;
    color: string;
    border?: string;
} | {
    kind: 'image';
    x: number;
    y: number;
    size: number;
    src: string;
    round?: boolean;
}
/** A part of a circle filled from the top, the clock's way: a cooldown's darkness, `fraction` of it */
 | {
    kind: 'sweep';
    x: number;
    y: number;
    radius: number;
    fraction: number;
    color: string;
}
/** A part of a circle's line from the top, the clock's way: a ring's bar */
 | {
    kind: 'arc';
    x: number;
    y: number;
    radius: number;
    width: number;
    fraction: number;
    color: string;
} | {
    kind: 'custom';
    box: Box;
    entity: EntityView;
    draw: DrawWidget['draw'];
}
/** A mark by side under a unit (`sideMarks`): a circle yours, a square an ally's, a triangle an enemy's */
 | {
    kind: 'mark';
    x: number;
    y: number;
    side: 'self' | 'ally' | 'enemy';
}
/**
 * What follows, up to the next of these, is one plate drawn at an opacity and scaled about its foot (`x`, `y`, over
 * the unit's head), under a CSS `filter` where it has one: a fade, a size by the camera's distance, a remembered
 * building's grey. Only where any is said; one with none after it @beta
 */
 | {
    kind: 'plate';
    x: number;
    y: number;
    scale: number;
    alpha: number;
    filter?: string;
};

What the overlay draws for the plates: the widgets as shapes, in the order they are drawn