Skip to main content

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​

OptionDefaultDescription
--width N1024Window width in points, 1 to 16384.
--height N768Window height in points, 1 to 16384.
--title TEXTThe script pathWindow title.
--assets DIRThe script's folderFolder that asset paths and the asset registry are relative to.
--hot-reloadoffReload the UI when the script or anything it includes changes.
--no-hot-reloadTurn hot reload off when a host has it on by default.
--frame-statsoffPrint the average and worst frame time once per second. Same as CT_FRAME_STATS=1.
-h, --helpPrint 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​

MessageWhat 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 valueGive the option a value.
bt-ui: only one entrypoint may be openedPass a single script.
bt-ui: unknown option 'OPTION'Check the spelling; see the table above.