User Interface (UI) Documentation
The UI code is made up of immediate-mode UI helpers.
The current UI implementation is tap-driven and intended for touch-first games. Controls are declared during rendering and resolve input immediately using the input system’s tap model.
Keyboard or focus-based navigation may be added later.
Ui Methods
b8.UI.iconButton(opts)
Draws a simple icon button at the current cursor position.
Parameters
- opts (Object): @param {number} [opts.width=1]
Returns
- (boolean):
b8.UI.progressBar([length, [percent)
Draws a progress bar. Uses the current background and foreground colours for the background of the bar and the bar fill.
Parameters
- [length (number): The length of the progress bar. (default: 5)
- [percent (number): The percentage of the progress bar to fill. (default: 0)
b8.UI.region(opts)
Registers a clickable region at the current cursor position.
A region is defined in tile space using the current cursor as the top-left corner.
This uses the input system’s tap model:
- A tap persists until consumed
- Only one region can consume a tap
Parameters
- opts (Object): @param {number} [opts.width=1] Width in tiles
Returns
- (boolean): True if this region consumed the tap
b8.UI.textButton(opts)
Draws a simple text button at the current cursor position.
Parameters
- opts (Object): @param {number} [opts.width=1]
Returns
- (boolean):