HudApi beta
Interface of @v12-engine/client
export interface HudApiThe HUD while the game runs (client.hud): what the top bar says, the HUD's events, its scale and places, the minimap's look and layers, the debug panel, its parts (parts: the game's added, the client's changed) and parts hidden and shown again
Members
addMinimapLayer
addMinimapLayer(layer: MinimapLayer): () => void;Adds a layer of the game's own to the minimap, after those it has (MinimapLook.layers), or in the place of one of the same id; gives back what takes it away again
console
console(): HudConsole;How the HUD's console is laid out now (HudConsole): the view's (GameView.hud.console), as changed since. A signal
debugShown
debugShown(): boolean;Whether the debug panel is up. A signal
describe
describe<K extends keyof HudModelSlots>(slot: K, describer: HudDescriber<K>): () => void;Fills a slot of the HUD's model while the game runs (HudModelSlots; client.ui.slot(name) reads it), over the view's describer of it (GameView.hud.describe, ViewPack.describe), from the HUD's next update. Gives back what takes it away again
emit
emit<K extends HudEventName>(name: K, event: HudEvents[K]): void;Tells a HUD event to whoever listens, as if it happened: to try what a game's own HUD does with it
hide
hide(widget: string, hidden?: boolean): void;Hides a widget of the HUD (one of the client's, HudWidget, or the game's by its id), or shows it again (hidden false)
minimap
minimap(): MinimapLook;The game's say over the minimap now (MinimapLook): its view's, as changed since. A signal
on
on<K extends HudEventName>(name: K, listener: HudEventListener<K>): () => void;Listens to what happens on the HUD (HudEvents): a hero levelled, an ability is ready, supply ran out, the selection changed. Gives back what stops it. What is, rather than what happens, is client.ui
places
places(): HudPlaces;The places of the HUD's layout (HudPlaces): the client's, as the game changes them. A signal
portraits
portraits(): HudPortraits;What the faces of the selection's sheet and the hero's panel are now (HudPortraits): the view's, as changed since. A signal
scale
scale(): number;How much the HUD is scaled now: what fits the screen (or the game's GameView.hud.scale), times the player's own size. The HUD reads it as it changes
setConsole
setConsole(console: HudConsole): void;Lays the HUD's console out another way while the game runs: centred, or in the corners. The parts follow
setMinimap
setMinimap(look: MinimapLook): void;Changes the minimap while the game runs: a sharper picture (resolution), no smoothing, another size, how entities show. What is given is laid over what it is; what sits beside the minimap follows its size, unless the game placed that itself (HudPlaces.minimapWidth)
setPlaces
setPlaces(places: Partial<HudPlaces>): void;Moves places of the HUD's layout: the parts placed by them follow
setPortraits
setPortraits(portraits: HudPortraits): void;Has the selection's sheet and the hero's panel show the unit live ('live', the default) or the type's picture ('picture'), over what the view says (GameView.hud.portraits)
setScale
setScale(size: number): void;The player's own size of the HUD, over what fits the screen: 1 as it fits, kept for the next games
setTitle
setTitle(title: HudTitle | string | null | undefined): void;Has the top bar say what the game is (HudTitle, or words), over what the view says (GameView.hud.title); null for nothing, undefined to give it back to the view
showDebug
showDebug(open?: boolean): void;Opens the debug panel, or closes it (open), where the player may use the debug tools; the other way when not said
title
title(): HudTitle | null;What the top bar says the game is now. A signal
widgets
readonly widgets: HudWidgetsApi;The HUD's parts as the game has them while it runs (HudWidgetsApi)