//////////////////////////////////////////////////////////// //~ Label helpers UI_Box *UI_BuildLabel(String text) { UI_SetNext(Width, UI_FIT(0)); UI_SetNext(Height, UI_FIT(1)); UI_SetNext(Text, text); UI_SetNext(Flags, UI_BoxFlag_DrawText); UI_Box *box = UI_BuildBox(Zstr); return box; } UI_Box *UI_BuildLabelF_(char *fmt_cstr, ...) { TempArena scratch = BeginScratchNoConflict(); String str = ZI; { va_list va; va_start(va, fmt_cstr); str = FormatStringV(scratch.arena, StringFromCstrNoLimit(fmt_cstr), va); va_end(va); } UI_Box *box = UI_BuildLabel(str); EndScratch(scratch); return box; } //////////////////////////////////////////////////////////// //~ Spacing helpers UI_Box *UI_BuildSpacer(UI_Size size) { UI_Box *box = 0; UI_Size old_width = UI_PeekTop(Width); UI_Size old_height = UI_PeekTop(Height); UI_Box *old_parent = UI_PeekTop(Parent); UI_PushStack(); { UI_SetNext(Tint, 0); UI_SetNext(Parent, old_parent); if (old_parent->layout_axis == Axis_X) { UI_SetNext(Width, size); UI_SetNext(Height, old_height); } else { UI_SetNext(Width, old_width); UI_SetNext(Height, size); } box = UI_BuildBox(Zstr); } UI_PopStack(); return box; }