Skip to content

ViewHud beta ​

Interface of @v12-engine/client

ts
export interface ViewHud<R extends string = string, M extends string = string>

The HUD as the game's view draws it (GameView.hud): its parts, its theme, scale and layout, the command card and its buttons, the icons, the resources and status lines, the actions and messages, the selection's stats and words, the minimap, the debug panel, the score, the end of the game, the menu and the settings, and the overlays

Members ​

abilityTip ​

ts
abilityTip?: (tip: AbilityTip, caster: EntityView, client: GameClientApi) => AbilityTip | Node | void;

The tooltip of an ability, as the HUD is about to show it (see AbilityTip): changed and given back (another line, other words), or something built for it to show instead, or nothing to show it as it is

actions ​

ts
actions?: ViewAction[];

Buttons of the game's own on the HUD, each sending one of its commands, like "Next wave"

activity ​

ts
activity?: (entity: EntityView) => string | undefined;

What an entity is doing, in a few words, for the selection panel and the hero panel: worked out in code, over the HUD's words (words). Those where it gives nothing

alertFor ​

ts
alertFor?: (alert: Alert) => AlertLook | null | undefined;

Whether and how something of the player's under attack where they are not looking is told (see Alert): its words, sound and colour on the minimap over the client's, or null for no alert. The client's when left out

alertTiming ​

ts
alertTiming?: {
        seconds?: number;
        cells?: number;
    };

How long alerts keep quiet near the same place, in seconds, and how near that is, in cells: 20 and 20 when left out

card ​

ts
card?: Partial<Record<CardCommand, CardPlace>>;

Where the buttons of the command card go, and their keys, by command. The client's layout for those left out

cardButtons ​

ts
cardButtons?: (context: CardContext) => GameButton[];

Buttons of the game's own on the command card, for what it is about right now: "Sell", "Load all", a menu of its own (opens, and menu on the buttons in it). Asked whenever the card is put together, ten times a second

cardSize ​

ts
cardSize?: CardSize;

How many columns and rows the command card has: 4 by 3 when left out. A place on it (CardPlace.slot) is counted along its rows; the client's own places are a 4 by 3 card's, and one a smaller card has no slot for goes to a free one. A unit's abilities go on its last row. In code: client.cardSize

chatFor ​

ts
chatFor?: (line: {
        player: PlayerId;
        name: string;
        text: string;
        to: ChatAudience;
    }) => string | null | undefined;

What a line of chat shows as: other words (a filter), or null for none. As it was said when left out

console ​

ts
console?: HudConsole;

How the HUD's console is laid out (HudConsole): one console centred at the bottom, as Warcraft III has it, with no bar across the top or the bottom ('centered', when left out), or the minimap and the card in the corners on a band across the bottom under a bar across the top ('corners'). In code: client.hud.setConsole

debug ​

ts
debug?: DebugPanelLook;

The debug panel, where the player may use the debug tools (debug: true): whether it is up as the game starts (its button and its key open it otherwise), and what it leaves out (see DebugPanelLook). client.hud.showDebug opens and closes it while the game runs

describe ​

ts
describe?: HudDescribers;

What the game describes for the HUD of its own (HudModelSlots: a slot it declares, read by a part of its own with client.ui.slot(name)), or in the place of a pack's: over packs' describers. client.hud.describe in code

editCard ​

ts
editCard?: (buttons: CommandButton[], context: CardContext) => CommandButton[];

The card as the game wants it, from the buttons the client and cardButtons made: hide, rename, disable, move them

floats ​

ts
floats?: FloatSet;

What each kind of event floats over the world, as the HUD draws it (indicators-plan F3): by kind (damage, damageTaken, crit, heal, miss, xp, mana, bounty, levelUp, buff, deny, resource, sleep, a game event's id), a def or a function of what is floated that decides for each; null, or a kind left out, floats nothing. Nothing floats where it says nothing: the ready-made defs for every kind are presetFloats(). client.floats puts up words in code and changes a kind while the game plays

heroStats ​

ts
heroStats?: StatKey[];

The stats the panel of a hero shows, in order. The ones it has anything of, when left out

hide ​

ts
hide?: string[];

The HUD's parts left out, by their id (HudWidget): client.hud.hide hides and shows them while the game runs

icons ​

ts
icons?: IconSet;

Pictures of abilities, items and heroes for the HUD

layout ​

ts
layout?: LayoutSpec;

The HUD's layout: where its sections sit and how they are sized (LayoutSpec)

ts
menu?: MenuLook;

The pause menu, which Esc opens: lines of the game's own, whether the client's are there, whether Esc opens it (MenuLook). In code: client.menu. All of it the game's own: the HUD's part menu (hud.widgets)

messages ​

ts
messages?: string extends M ? Record<string, MessageWords> : KeyedAll<M, MessageWords> & Keyed<keyof EngineMessages, MessageWords>;

Words for the game's own messages, by key, and other words for the engine's (see engineWords): a game with farms says what supply is

minimap ​

ts
minimap?: MinimapLook;

How entities show on the minimap, and what the game draws on it (see MinimapLook). client.minimapPing marks a spot

onMessage ​

ts
onMessage?: (text: string, kind: 'info' | 'error' | 'hint') => string | null | undefined;

Every message in the middle of the screen before it shows: other words, or null for none

outcome ​

ts
outcome?: OutcomeLook;

The end of a game: what it says under Victory or Defeat (the words of a melee game when left out), buttons of the game's own (Next mission) next to or instead of the client's, or a screen of its own (mount)

overlays ​

ts
overlays?: OverlayLooks;

What floats over the game, as the game draws it: the box of a tooltip, a toast, a dialog, a menu, each a component or an element of its own (OverlayLooks). The kit's where one is left out

places ​

ts
places?: Partial<HudPlaces>;

The places of the HUD's layout where they are not the client's (HudPlaces): a taller bottom bar, a wider minimap

portraits ​

ts
portraits?: HudPortraits;

The faces the HUD's portrait box shows (HudPortraits: the selection's sheet, the group's panel, the hero's panel): the unit itself, live, as a classic RTS has it ('live', when left out): its model playing its idle (its parts, where its type has no model), framed as its look's portrait says, its picture while the model loads or where it has neither, and a line's speaker talking in its place while the line is said (DialogLook.portraitIn); or the unit type's picture ('picture'). In code: client.hud.setPortraits

resources ​

ts
resources?: Keyed<R, ResourceLook>;

How the game's resources look, by resource id. A plain chip in a color of the client when left out

scale ​

ts
scale?: number | ((screen: {
        width: number;
        height: number;
    }) => number);

How much the HUD is scaled for a screen of a size: it is laid out for 1600 by 900 and scaled to fit, between 0.7 and 1.4, when left out. The player's own size goes over it (client.hud.setScale)

score ​

ts
score?: ScoreLook;

How the score is shown (ScoreLook): what the end of the game does with it, the menu's line, labels, formats, the graph's stats. What is counted is the rules' (RuleSettings.score); client.score.look changes it while the game runs

settings ​

ts
settings?: GameSettings;

What the player can set, as the game wants it: settings of its own, the client's it leaves out, and what it changes of them (GameSettings). Read and set in code with client.settings

shop ​

ts
shop?: ShopWindowOptions;

The shop window's ways (ShopWindowOptions): what it recommends, its filters, typing to search. All on when left out

shopTiers ​

ts
shopTiers?: [tier: string, heading: string][];

The tiers of the shop, in order, with their headings: the game's own tiers of items. The client's when left out

sounds ​

ts
sounds?: UiSounds;

The sounds of the HUD's menus as they move (UX1), by the names of the game's sounds (sounds.json, client.sounds), heard on the interface bus: open and close as the pause menu does, hover as the pointer comes onto one of its buttons or the end of the game's, press as one is pressed. What a game's own Solid panel plays with useUiSound. Silent when left out

stats ​

ts
stats?: (entity: EntityView, lines: StatLine[]) => StatLine[];

The stats the selection panel shows of an entity, from the client's lines: others, more, fewer, in another order

status ​

ts
status?: (report: Record<string, unknown>) => StatusLine[];

Lines of the game's own for the HUD, made from what the game reports (Rules.report): the wave, a score

summons ​

ts
summons?: boolean;

Whether the hero panel lists the hero's summons (summoned): small icons with the time they have left, a click selects one. Shown when left out; false for a game that draws them its own way

theme ​

ts
theme?: ThemeSpec;

The look of the interface while the game is on: a theme by name ('moonlight', or one added with registerTheme), values over the engine's (classicTheme: { accent: '#7fe07a', radius: '6px' }), or values worked out from it. Code changes it while the game runs with client.theme. The engine's when left out

title ​

ts
title?: string | HudTitle | null | ((client: GameClientApi) => string | HudTitle | null);

What the top bar says the game is: words, a name with a line under it, or worked out as the game goes (asked every frame, so cheap). The name of where it is played when left out; client.hud.setTitle in code

widgets ​

ts
widgets?: HudWidgetDef[];

The HUD's parts as the game has them (see HudWidgetDef): its own, each in a place of the HUD's layout (HudPlace) among the client's, by order; and the client's own changed by their id (HudWidget): another place or order, shown only when the game says, or drawn by the game in their place (a component given the client's part to wrap, or an element). client.hud.widgets adds and takes away parts while the game runs

words ​

ts
words?: HudWordsChange;

The HUD's words the game changes (HudWords: what a unit is doing, under the selection), over the client's (HUD_WORDS) and the packs'