bt-ui
bt-ui opens a BT UI app in a window. Use it to develop and try out a UI
script on its own, with hot reload, without building a whole game.
Common commands
bt-ui app.bt
bt-ui app.bt --hot-reload --frame-stats
bt-ui ui/examples/home/home.bt --width 780 --height 1000 --title "Home"
The entry script
The script must define:
fn uiMain(UiRegistry registry, int width, int height) -> int
bt-ui looks for the script in the current folder first, then next to the
bt-ui executable. Includes are found next to the including script, then in
the engine's UI library, so include "btlib/widgets.bt" works without a local
copy. See cturtle/ui and
cturtle/ui/btlib.
Options
| Option | Default | Description |
|---|---|---|
--width N | 1024 | Window width in points, 1 to 16384. |
--height N | 768 | Window height in points, 1 to 16384. |
--title TEXT | The script path | Window title. |
--assets DIR | The script's folder | Folder that asset paths and the asset registry are relative to. |
--hot-reload | off | Reload the UI when the script or anything it includes changes. |
--no-hot-reload | Turn hot reload off when a host has it on by default. | |
--frame-stats | off | Print the average and worst frame time once per second. Same as CT_FRAME_STATS=1. |
-h, --help | Print usage. |
With hot reload on, you can also force a reload by sending SIGHUP (Linux) or
SIGBREAK (Windows) to the process.
The variables in Engine environment also apply.
Errors
| Message | What to do |
|---|---|
bt-ui: cannot open 'PATH' | The script was not found in the current folder or next to bt-ui. Check the path. |
bt-ui: bad --width 'VALUE' | Use a whole number from 1 to 16384 (same for --height). |
bt-ui: --width needs a value | Give the option a value. |
bt-ui: only one entrypoint may be opened | Pass a single script. |
bt-ui: unknown option 'OPTION' | Check the spelling; see the table above. |