GizStackGizStack
View .mdOpen in ChatGPTOpen in Claude

gizgame/widgets

The HUD's widgets a game picks (Scene3D hud, Stage2D hud).

gizlang
import * as Widgets from "gizgame/widgets";

Types

Words

gizlang
type Words = { joining?: string; fallen?: string; rise?: string; waits?: string; call?: string; done?: string; }

What the HUD of an online world says: JOINING until the own being is seated, FALLEN and RISE while it lies fallen; the quest's WAITS before its giver gives it, CALL where the giver hears (what to do, said after the key as Game.hint says it: "talk to Mara"), DONE after.

  • joining: _gizlang_sdk_core.Option<string>
  • fallen: _gizlang_sdk_core.Option<string>
  • rise: _gizlang_sdk_core.Option<string>
  • waits: _gizlang_sdk_core.Option<string>
  • call: _gizlang_sdk_core.Option<string>
  • done: _gizlang_sdk_core.Option<string>

Functions

keyed

gizlang
function keyed(h: Hud, code: string, words: string): string

WORDS as a chip says them: after the key CODE where keys play.

Effects: fail, read, alloc.

shown

gizlang
function shown(h: Hud): bool

Whether the HUD shows the match: not at the title.

Effects: fail, read, write, console, io, alloc.

scoreboard

gizlang
function scoreboard(): Widget

The score at the top left, six digits, and its combo beside it.

Effects: fail, alloc.

waveboard

gizlang
function waveboard(): Widget

The wave at the top right.

Effects: fail, alloc.

best

gizlang
function best(): Widget

The best score at the bottom left; under the score where a finger plays, as the stick holds the bottom left.

Effects: fail, alloc.

lives

gizlang
function lives(kind: string, icon: string = ""): Widget

One ICON (an image the stage loads; the ring when none) for each hit left of the first actor of KIND, at the bottom right; under the best score where a finger plays, as the buttons hold the bottom right.

Effects: fail, alloc.

gizlang
function banner(say?: (game: Game) => string throws string, under?: (game: Game) => string throws string): Widget

SAY in the middle while the match's banner shows (Score.banner), UNDER beneath it: by default the wave's number, and the title under the first.

Effects: fail, alloc.

line

gizlang
function line(where: string, row: i64, text: (game: Game) => string throws string, size: f64 = 22.0, color: Vec<f64> = PALE): Widget

TEXT at the WHERE ("left", "right" or "center") of ROW: rows count down from the top, and up from the bottom when below 0. SIZE is its em. Nothing when the text is empty.

Effects: fail, read, write, console, io, alloc.

meter

gizlang
function meter(fill: (game: Game) => f64 throws string, label: string = "", full: Vec<f64> = [0.5, 1, 1, 1], low: Vec<f64> = [0.4, 0.7, 0.8, 0.8]): Widget

A bar at the bottom middle filled to FILL (0 to 1), LABEL over it; FULL is its color when full, LOW when empty.

Effects: fail, alloc.

markers

gizlang
function markers(lift: f64 = 0.4): Widget

A ring over each actor of a kind whose figure has a MARK, LIFT meters over it, in play.

Effects: fail, alloc.

crosshair

gizlang
function crosshair(): Widget

A small cross in the middle: the aim of a first-person game.

Effects: fail, alloc.

compass

gizlang
function compass(yaw: (game: Game) => f64 throws string, goal?: (game: Game) => f64 | undefined throws string): Widget

The winds across the top as one faces YAW (a larger yaw turns left), and a dot toward GOAL's yaw when it has one.

Effects: fail, alloc.

bars

gizlang
function bars(o: Online, within: f64 = 25): Widget

A health bar over each foe the own being sees within WITHIN meters that is hurt and stands.

Effects: fail, alloc.

met

gizlang
function met(plates: Vec<Point2>, x: f64, y: f64): bool

Whether a name plate at X, Y would lie on one of PLATES.

Effects: fail.

names

gizlang
function names(o: Online, within: f64 = 18): Widget

The names over the beings near the own being (within WITHIN meters, faded with distance): a persona's name with its role under it, a mark over one with something for the own being (a gold "!" for a quest to take, a "?" for one to talk to or bring to now, a "$" for a shop), a foe's kind in red, and a party member's kind and level in green.

Effects: fail, alloc.

floaters

gizlang
function floaters(): Widget

What rises over the world and fades (Popup): a hit's damage, the experience won.

Effects: fail, alloc.

beacon

gizlang
function beacon(o: Online): Widget

The quest's goal: a light over it with its distance, or, when it is off the screen, a chip at the edge on its side with an arrow and the distance, so the way on is never lost.

Effects: fail, alloc.

vitals

gizlang
function vitals(o: Online, words: Words = {}): Widget

The own being's card at the bottom left: its level in a ring, its health as a bar with its numbers, its experience under it (its mana above that, with skills), and its gold; the WORDS of joining and of a fall in the middle.

Effects: fail, alloc.

questLog

gizlang
function questLog(o: Online, words: Words = {}): Widget

The quest the own being follows on a card at the top right: its title (pulsing as it moves on) by an accent line, the step's words and count, and how many other quests are on; with none on, where the next quest waits (the WORDS of its giver). For a few seconds after a quest moves on, a card in the middle says what moved (Online.news).

Effects: fail, alloc.

tally

gizlang
function tally(o: Online): Widget

The own being's kills and falls at the top right, and how many it sees in the match at the top left.

Effects: fail, alloc.

shop

gizlang
function shop(o: Online): Widget

The shop of a seller beside the own being (Online.shop). Closed, it is one chip that offers the trade (G opens it): a player who walks by keeps the view. Open (Online.trading): a card above the bag with the seller's name and the own gold, its wares and their prices (one the own gold cannot pay dimmed), then the own items it buys at half their value; the picked row is lit, and the shop's keys (the online rules' TRADE, NEXT, CLOSE) or a press on their chips buy or sell it, pick the next and close it.

Effects: fail, alloc.

inventory

gizlang
function inventory(o: Online): Widget

The own bag at the bottom right: each item a chip with its key's number and the count carried; above them, the gear worn in each slot.

Effects: fail, alloc.

skillBar

gizlang
function skillBar(o: Online): Widget

The own kind's skills in a row at the bottom middle: each its key and name, dim while it waits (with the seconds left) or the mana is short.

Effects: fail, alloc.

listening

gizlang
function listening(word: (h: Hud) => string): Widget

While a voice is recorded (the talk key held, or a voice heard hands-free) or its answer is awaited: a card at the bottom middle with a dot that grows with the voice and the word WORD gives ("" none: Listening or Thinking).

Effects: fail, alloc.

partyCard

gizlang
function partyCard(o: Online): Widget

The own party at the left: each other member's kind, level and health, while there are any.

Effects: fail, alloc.

roundClock

gizlang
function roundClock(o: Online): Widget

The time left in the round, at the top.

Effects: fail, alloc.

chat

gizlang
function chat(o: Online): Widget

What the players and the minds said, on a card above the own being's, newest last, each speaker in a color of its own; and the line the own player types (Enter opens it). A builder's own pick ("/place") is not shown.

Effects: fail, alloc.

bubbles

gizlang
function bubbles(o: Online): Widget

What each being said last, in a bubble over its head for a few seconds (longer for a longer line), fading out: the speaker's name in its color over the words, and a tail toward it. A speaker out of view shows at the edge of the screen on its side, with an arrow toward it, so a player can turn and find it.

Effects: fail, alloc.

makings

gizlang
function makings(o: Online): Widget

Over each thing being made (a making edit), what it is and for how long it has been made.

Effects: fail, write, alloc.

builder

gizlang
function builder(o: Online): Widget

The build panel (B) at the right: the words to look for as they are typed, what the catalogs offer for them (the pick lit) and a make by the AI, the size, and its keys.

Effects: fail, alloc.

thumbAt

gizlang
function thumbAt(h: Hud, slot: i64): Point2

Where thumb button SLOT stands where a finger plays: slot 0 over the bottom right corner, under the right thumb, the others on two arcs about it.

Effects: fail, read, write, console, io, alloc.

cornerAt

gizlang
function cornerAt(h: Hud, n: i64): Point2

Where small button N stands along the top right where a finger plays: 0, in the corner, is the pause.

Effects: fail, read.

company

gizlang
function company(h: Hud): void throws string

In play, each of the cast but the hero (Game.cast) under its name: a tap or a click on it makes it the hero.

Effects: fail, read, write, console, io, alloc.

fingers

gizlang
function fingers(h: Hud): void throws string

The touch controls of every game where a finger plays, as it declares them: the thumb stick at the bottom left (a game with a stick; Game.post), faint at rest, its knob under the thumb that holds it; each button (Game.buttons) about the right thumb, the first the largest; and the pause at the top right. The first seconds of play name each. While the game types, its buttons step aside.

Effects: fail, read, write, console, io, alloc.

thumbs

gizlang
function thumbs(o: Online): Widget

The buttons online world O adds where a finger plays, each pressing its action's key: the skills about the right thumb (a skill that waits winds back and shows its seconds; one the mana is short for is dim), and farther out what the moment gives a use: the talk where someone hears, the lock while a foe stands in front (gold while it holds one) and the swap of a kind with more arms. The bag's items a press uses in a row, each with its count. At the top right, after the pause, the chat and the voice.

Effects: fail, alloc.

adventure

gizlang
function adventure(o: Online, words: Words = {}): Vec<Widget>

The HUD of an adventure in online world O: the foes' health, what rises over the world, the quest's beacon and log, the own being's vitals, a compass to the goal, the banner of a level, saying WORDS, the bag and the gear worn, the skills, the party, the talk heard, the round's clock, what each being says over its head, what is being made, the chat and the build panel.

Effects: fail, write, alloc.

Constants

PALE

gizlang
const PALE = [1, 0.95, 0.88, 0.9]

A HUD word's pale color.