A UI that is not attached to a window. Fonts are synthetic (every character is 0.6 of the font
size wide) unless system_fonts is set, so layouts are the same on every machine. Release it
with free_ui.
- options: window size, scale, fonts and theme.
ui := headless(.{ width = 320, height = 200 });
defer free_ui(*ui);
count := 0;
build := (n: *int) {
for column(.{ gap = 8, padding = 16 }) {
label(tprint("Clicked % times", n.*));
if button("Add") n.* += 1;
}
};
frame(*ui, *count, build);
assert(find_label(*ui, "Add") != null);headless :: (options: Headless_Options = .{}) -> UI_State
A UI that is not attached to a window. Fonts are synthetic (every character is 0.6 of the font
size wide) unless system_fonts is set, so layouts are the same on every machine. Release it
with free_ui.
Parameters
- options: Headless_Options = .{}
- window size, scale, fonts and theme.
Returns
ui := headless(.{ width = 320, height = 200 });
defer free_ui(*ui);
count := 0;
build := (n: *int) {
for column(.{ gap = 8, padding = 16 }) {
label(tprint("Clicked % times", n.*));
if button("Add") n.* += 1;
}
};
frame(*ui, *count, build);
assert(find_label(*ui, "Add") != null);