Skip to main content

Module widgets

Module widgets 

Source
Expand description

Professional vector UI toolkit — HUD overlays, meters/gauges, interface controls and game UI, all emitted as resolved vector primitives so a single widget can be multi-colour and the host can rasterize (AA fill + AA stroke) however it likes. Pure, allocation-light, immediate-mode: call a function each frame with the live params and draw the returned Draw.

Conventions: screen space, x→right, y→down, origin top-left. Colours are packed 0x00RRGGBB (the Ling framebuffer format). Interactive state (hover/active/value) is passed in by the host; these functions are pure geometry and never read input themselves.

Structs§

Draw
Resolved vector output: filled polygons + stroked polylines, each with its own colour so one widget can mix theme slots (track vs fill vs accent).

Functions§

bar
Linear bar: track outline + proportional fill (value/max).
battery
Battery cell with bezel, terminal nub and proportional charge fill.
button
Beveled button background (label drawn by the host). hover/active brighten.
checkbox
Checkbox; checked draws a tick.
compass
Horizontal compass strip centred on heading (degrees). Width w, ticks every 15°, cardinal marks taller.
cooldown
Radial cooldown wipe (clockwise from top). frac = remaining 1→0.
counter
7-segment style vector number for value with digits places.
dpad
Virtual D-pad / joystick; dir 0=none,1=up,2=right,3=down,4=left highlights.
gauge
Radial dial gauge with tick marks and a needle. Sweeps 225°→ -45° (270° arc).
gauge3d
Spinning wireframe ring gauge — a torus-ish band that rotates in 2D space, with frac lighting a leading arc.
healthbar
Health bar: notched fill that shifts colour low→high and can pulse (host passes a 0..1 pulse).
minimap
Minimap frame with corner brackets (host plots blips separately).
mix
Mix two packed colours by t∈[0,1].
panel
Sci-fi panel: beveled outline + faint fill + a header tab notch.
panel3d
Extruded / isometric panel — a beveled face lifted off the surface by depth.
progress
Progress bar with subtle internal chevrons.
radar
Circular radar with grid rings, cross axes and a sweeping wedge at sweep radians. blip ∈ [0,1] fraction along the sweep where a contact pings.
radar3d
Perspective radar dish — concentric rings tilted into the screen, with a sweep.
reticle
Aiming reticle: ring + tick gaps + centre dot. spread ∈ [0,1] opens the gaps.
ring
Ring / arc progress meter (full circle minus a gap at the bottom).
scanlines
Horizontal scanline overlay inside a rect (density lines).
segbar
Segmented/notched bar — segs cells, frac lit proportionally.
shade
Scale a colour’s brightness by k (clamped).
slider
Horizontal slider: track + filled portion + draggable knob at frac.
slotgrid
Item slot grid (cols×rows), sel index highlighted.
spark
Sparkline polyline from a list of values (auto-scaled to [min,max]).
stepper
Stepper: [ - value + ] frame (host draws value). Returns the two button rects’ geometry.
tabs
Tab strip: count tabs, active highlighted. Returns per-tab rects via geometry.
target
Animated target brackets that close in as lock → 1 (0 = wide, 1 = snug).
toggle
Toggle switch; on slides the knob and recolours the rail.
tooltip
Tooltip / callout bubble with a pointer (label drawn by host).
vignette
Full-screen damage / alert vignette — intensity ∈ [0,1] thickens the border glow.
vu
VU / spectrum bars from a list of levels (each 0..1).

Type Aliases§

Rgba
Packed 0x00RRGGBB colour.