UI module

run_app_with

procedureextensionexperimentalsince 0.31.0Source

Like run_app, for a UI the caller owns (to set the theme or hooks first, or to inspect it after).

Example↗
main :: () {
    ui := headless();
    app: int;
    run_app_with(.{ title = "Custom UI" }, *ui, *app, (n: *int) { label("hi"); });
}

This one is only checked to compile, not run.

run_app_with :: (
    options: App_Options,
    ui: *UI_State,
    app: *$T,
    build: (app: *T)
) -> bool

Like run_app, for a UI the caller owns (to set the theme or hooks first, or to inspect it after).

Parameters

options: App_Options
window title, size, theme, fonts and an optional frame limit.
ui: *UI_State
the UI to run. It is not freed on return.
app: *$T
your app state, passed to build each frame.
build: (app: *T)
declares the widgets for a frame.

Returns

bool
Example↗
main :: () {
    ui := headless();
    app: int;
    run_app_with(.{ title = "Custom UI" }, *ui, *app, (n: *int) { label("hi"); });
}

This one is only checked to compile, not run.

See also