gizgame/widgets
The HUD's widgets a game picks (Scene3D hud, Stage2D hud).
import * as Widgets from "gizgame/widgets";Types
Words
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
function keyed(h: Hud, code: string, words: string): stringWORDS as a chip says them: after the key CODE where keys play.
Effects: fail, read, alloc.
shown
function shown(h: Hud): boolWhether the HUD shows the match: not at the title.
Effects: fail, read, write, console, io, alloc.
scoreboard
function scoreboard(): WidgetThe score at the top left, six digits, and its combo beside it.
Effects: fail, alloc.
waveboard
function waveboard(): WidgetThe wave at the top right.
Effects: fail, alloc.
best
function best(): WidgetThe best score at the bottom left; under the score where a finger plays, as the stick holds the bottom left.
Effects: fail, alloc.
lives
function lives(kind: string, icon: string = ""): WidgetOne 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.
banner
function banner(say?: (game: Game) => string throws string, under?: (game: Game) => string throws string): WidgetSAY 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
function line(where: string, row: i64, text: (game: Game) => string throws string, size: f64 = 22.0, color: Vec<f64> = PALE): WidgetTEXT 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
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]): WidgetA 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
function markers(lift: f64 = 0.4): WidgetA ring over each actor of a kind whose figure has a MARK, LIFT meters over it, in play.
Effects: fail, alloc.
crosshair
function crosshair(): WidgetA small cross in the middle: the aim of a first-person game.
Effects: fail, alloc.
compass
function compass(yaw: (game: Game) => f64 throws string, goal?: (game: Game) => f64 | undefined throws string): WidgetThe 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
function bars(o: Online, within: f64 = 25): WidgetA health bar over each foe the own being sees within WITHIN meters that is hurt and stands.
Effects: fail, alloc.
met
function met(plates: Vec<Point2>, x: f64, y: f64): boolWhether a name plate at X, Y would lie on one of PLATES.
Effects: fail.
names
function names(o: Online, within: f64 = 18): WidgetThe 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
function floaters(): WidgetWhat rises over the world and fades (Popup): a hit's damage, the experience won.
Effects: fail, alloc.
beacon
function beacon(o: Online): WidgetThe 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
function vitals(o: Online, words: Words = {}): WidgetThe 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
function questLog(o: Online, words: Words = {}): WidgetThe 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
function tally(o: Online): WidgetThe 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
function shop(o: Online): WidgetThe 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
function inventory(o: Online): WidgetThe 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
function skillBar(o: Online): WidgetThe 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
function listening(word: (h: Hud) => string): WidgetWhile 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
function partyCard(o: Online): WidgetThe own party at the left: each other member's kind, level and health, while there are any.
Effects: fail, alloc.
roundClock
function roundClock(o: Online): WidgetThe time left in the round, at the top.
Effects: fail, alloc.
chat
function chat(o: Online): WidgetWhat 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
function bubbles(o: Online): WidgetWhat 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
function makings(o: Online): WidgetOver each thing being made (a making edit), what it is and for how long it has been made.
Effects: fail, write, alloc.
builder
function builder(o: Online): WidgetThe 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
function thumbAt(h: Hud, slot: i64): Point2Where 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
function cornerAt(h: Hud, n: i64): Point2Where small button N stands along the top right where a finger plays: 0, in the corner, is the pause.
Effects: fail, read.
company
function company(h: Hud): void throws stringIn 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
function fingers(h: Hud): void throws stringThe 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
function thumbs(o: Online): WidgetThe 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
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
const PALE = [1, 0.95, 0.88, 0.9]A HUD word's pale color.