power_play/src/ui/ui_widgets.c
2025-10-15 12:02:38 -05:00

33 lines
764 B
C

////////////////////////////////
//~ Label widget
UI_Box *UI_BuildLabel(String text)
{
UI_Key key = UI_KeyFromString(text);
UI_Box *box = UI_BuildBox(UI_Flag_DrawText, key);
UI_SetDisplayText(box, text);
return box;
}
UI_Box *UI_BuildLabelF_(char *fmt_cstr, ...)
{
UI_FiberState *f = UI_GetFiberState();
TempArena scratch = BeginScratchNoConflict();
va_list args;
va_start(args, fmt_cstr);
String text = FormatStringV(scratch.arena, StringFromCstrNoLimit(fmt_cstr), args);
UI_Box *box = UI_BuildLabel(text);
va_end(args);
EndScratch(scratch);
return box;
}
////////////////////////////////
//~ Separator widget
UI_Box *UI_BuildSeparator(void)
{
UI_Box *box = UI_BuildBox(0, UI_NilKey);
return box;
}