remove ui auto padding
This commit is contained in:
parent
84ba58f0aa
commit
54dda0b7b6
80
src/pp/pp.c
80
src/pp/pp.c
@ -795,10 +795,23 @@ void PP_UpdateUser(void)
|
|||||||
|
|
||||||
UI_Box *pp_root_box = 0;
|
UI_Box *pp_root_box = 0;
|
||||||
{
|
{
|
||||||
UI_SetNext(Width, UI_PIX(g->ui_size.x, 1));
|
UI_PushCP(UI_BuildRow(Zstr));
|
||||||
UI_SetNext(Height, UI_PIX(g->ui_size.y, 1));
|
{
|
||||||
UI_SetNext(Padding, UI_PADALL(UI_FILL(1, 0)));
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
pp_root_box = UI_BuildBox(Lit("pp root"));
|
{
|
||||||
|
UI_SetNext(Width, UI_PIX(g->ui_size.x, 1));
|
||||||
|
UI_PushCP(UI_BuildColumn(Zstr));
|
||||||
|
{
|
||||||
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
|
UI_SetNext(Height, UI_PIX(g->ui_size.y, 1));
|
||||||
|
pp_root_box = UI_BuildBox(Lit("pp root"));
|
||||||
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
|
}
|
||||||
|
UI_PopCP();
|
||||||
|
}
|
||||||
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
|
}
|
||||||
|
UI_PopCP();
|
||||||
}
|
}
|
||||||
|
|
||||||
PP_PushGameUiStyle();
|
PP_PushGameUiStyle();
|
||||||
@ -1974,47 +1987,38 @@ void PP_UpdateUser(void)
|
|||||||
UI_Push(LayoutAxis, Axis_Y);
|
UI_Push(LayoutAxis, Axis_Y);
|
||||||
UI_Push(FloatingPos, g->lister_pos);
|
UI_Push(FloatingPos, g->lister_pos);
|
||||||
UI_SetNext(Flags, UI_BoxFlag_Floating);
|
UI_SetNext(Flags, UI_BoxFlag_Floating);
|
||||||
UI_Box *lister_box = UI_BuildBox(Lit("lister"));
|
UI_Box *lister_box = UI_PushCP(UI_BuildBox(Lit("lister")));
|
||||||
UI_PushCP(lister_box);
|
|
||||||
{
|
{
|
||||||
/* Title bar */
|
/* Title bar */
|
||||||
UI_Push(BackgroundColor, 0);
|
UI_PushCP(0);
|
||||||
UI_Push(BorderColor, 0);
|
|
||||||
UI_Push(Rounding, UI_RPIX(0));
|
|
||||||
UI_Push(LayoutAxis, Axis_X);
|
|
||||||
UI_Push(Width, UI_FILL(1, 0));
|
|
||||||
UI_Push(Height, UI_FNT(2, 0));
|
|
||||||
UI_Box *title_bar = UI_BuildBox(Zstr);
|
|
||||||
|
|
||||||
UI_Push(BorderColor, window_border_color);
|
|
||||||
{
|
|
||||||
UI_BuildDivider(UI_PIX(1, 0));
|
|
||||||
}
|
|
||||||
UI_Pop(BorderColor);
|
|
||||||
|
|
||||||
UI_PushCP(title_bar);
|
|
||||||
{
|
{
|
||||||
|
UI_Push(BackgroundColor, 0);
|
||||||
|
UI_Push(BorderColor, 0);
|
||||||
|
UI_Push(Rounding, UI_RPIX(0));
|
||||||
|
UI_Push(LayoutAxis, Axis_X);
|
||||||
UI_Push(Width, UI_FILL(1, 0));
|
UI_Push(Width, UI_FILL(1, 0));
|
||||||
UI_Push(Padding, 0);
|
UI_Push(Height, UI_FNT(2, 0));
|
||||||
UI_Box *left_box = UI_BuildBox(Zstr);
|
UI_PushCP(UI_BuildBox(Zstr));
|
||||||
UI_Box *center_box = UI_BuildBox(Zstr);
|
|
||||||
UI_Box *right_box = UI_BuildBox(Zstr);
|
|
||||||
|
|
||||||
/* Centered title bar */
|
|
||||||
UI_PushCP(center_box);
|
|
||||||
{
|
{
|
||||||
/* Title label */
|
UI_Push(Width, UI_FILL(1, 0));
|
||||||
{
|
|
||||||
UI_SetNext(Width, UI_FIT(1));
|
/* Left title box */
|
||||||
UI_SetNext(Text, Lit("Titleeee"));
|
UI_BuildRow(Zstr);
|
||||||
UI_SetNext(Flags, UI_BoxFlag_DrawText);
|
|
||||||
UI_SetNext(Padding, UI_PADALL(UI_FILL(1, 0)));
|
/* Title box */
|
||||||
UI_Box *title_box = UI_BuildBox(Zstr);
|
UI_SetNext(Width, UI_FIT(1));
|
||||||
}
|
UI_SetNext(Text, Lit("Titleeee"));
|
||||||
|
UI_SetNext(Flags, UI_BoxFlag_DrawText);
|
||||||
|
UI_BuildBox(Zstr);
|
||||||
|
|
||||||
|
/* Right title box */
|
||||||
|
UI_BuildBox(Zstr);
|
||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
|
|
||||||
|
UI_BuildDivider(UI_PIX(1, 0));
|
||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
g->lister_key = lister_box->key;
|
g->lister_key = lister_box->key;
|
||||||
@ -2035,12 +2039,10 @@ void PP_UpdateUser(void)
|
|||||||
UI_SetNext(Width, UI_FIT(0));
|
UI_SetNext(Width, UI_FIT(0));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_SetNext(Height, UI_FIT(1));
|
||||||
UI_SetNext(Tint, 0);
|
UI_SetNext(Tint, 0);
|
||||||
UI_Box *dbg_box = UI_BuildBox(Lit("dbg"));
|
UI_PushCP(UI_BuildBox(Lit("dbg")));
|
||||||
UI_PushCP(dbg_box);
|
|
||||||
{
|
{
|
||||||
UI_Push(BackgroundColor, 0);
|
UI_Push(BackgroundColor, 0);
|
||||||
UI_Push(BorderColor, 0);
|
UI_Push(BorderColor, 0);
|
||||||
// UI_Push(Padding, UI_PIX(5, 0));
|
|
||||||
|
|
||||||
UI_BuildLabelF("Blended world entities: %F/%F", FmtUint(g->ss_blended->num_ents_allocated), FmtUint(g->ss_blended->num_ents_reserved));
|
UI_BuildLabelF("Blended world entities: %F/%F", FmtUint(g->ss_blended->num_ents_allocated), FmtUint(g->ss_blended->num_ents_reserved));
|
||||||
UI_BuildLabelF("Blended world tick: %F", FmtUint(g->ss_blended->tick));
|
UI_BuildLabelF("Blended world tick: %F", FmtUint(g->ss_blended->tick));
|
||||||
|
|||||||
@ -41,7 +41,6 @@ UI_Box *PP_BuildDebugConsole(b32 minimized)
|
|||||||
i64 now_ns = TimeNs();
|
i64 now_ns = TimeNs();
|
||||||
UI_Box *console_box = 0;
|
UI_Box *console_box = 0;
|
||||||
{
|
{
|
||||||
UI_SetNext(LayoutAxis, Axis_Y);
|
|
||||||
UI_SetNext(Border, 0);
|
UI_SetNext(Border, 0);
|
||||||
if (minimized)
|
if (minimized)
|
||||||
{
|
{
|
||||||
@ -55,7 +54,7 @@ UI_Box *PP_BuildDebugConsole(b32 minimized)
|
|||||||
UI_SetNext(Width, UI_FILL(1, 0));
|
UI_SetNext(Width, UI_FILL(1, 0));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_SetNext(Height, UI_FIT(1));
|
||||||
}
|
}
|
||||||
console_box = UI_BuildBox(Lit("Console box"));
|
console_box = UI_BuildColumn(Lit("Console box"));
|
||||||
UI_PushCP(console_box);
|
UI_PushCP(console_box);
|
||||||
{
|
{
|
||||||
/* Gather display logs */
|
/* Gather display logs */
|
||||||
@ -112,16 +111,15 @@ UI_Box *PP_BuildDebugConsole(b32 minimized)
|
|||||||
{
|
{
|
||||||
u32 color = colors[log.level][log.level_id % 2];
|
u32 color = colors[log.level][log.level_id % 2];
|
||||||
UI_SetNext(BackgroundColor, color);
|
UI_SetNext(BackgroundColor, color);
|
||||||
UI_SetNext(LayoutAxis, Axis_X);
|
|
||||||
UI_SetNext(Width, UI_FILL(1, 0));
|
UI_SetNext(Width, UI_FILL(1, 0));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_SetNext(Height, UI_FIT(1));
|
||||||
UI_SetNext(BorderColor, Rgba32F(0.25, 0.25, 0.25, 1));
|
UI_SetNext(BorderColor, Rgba32F(0.25, 0.25, 0.25, 1));
|
||||||
UI_SetNext(Rounding, UI_RPIX(0));
|
UI_SetNext(Rounding, UI_RPIX(0));
|
||||||
UI_SetNext(Border, 1);
|
UI_SetNext(Border, 1);
|
||||||
UI_Box *log_box = UI_BuildBox(Zstr);
|
UI_PushCP(UI_BuildRow(Zstr));
|
||||||
UI_PushCP(log_box);
|
|
||||||
{
|
{
|
||||||
UI_SetNext(Padding, UI_PADALL(UI_FNT(0.25, 1)));
|
// UI_SetNext(Height, UI_PIX(100, 0));
|
||||||
|
// UI_BuildSpacer(UI_PIX(1, 0));
|
||||||
UI_SetNext(BackgroundColor, 0);
|
UI_SetNext(BackgroundColor, 0);
|
||||||
UI_SetNext(Border, 0);
|
UI_SetNext(Border, 0);
|
||||||
UI_SetNext(Text, text);
|
UI_SetNext(Text, text);
|
||||||
@ -129,7 +127,7 @@ UI_Box *PP_BuildDebugConsole(b32 minimized)
|
|||||||
UI_SetNext(Width, UI_FILL(1, 0));
|
UI_SetNext(Width, UI_FILL(1, 0));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_SetNext(Height, UI_FIT(1));
|
||||||
UI_SetNext(Flags, UI_BoxFlag_DrawText);
|
UI_SetNext(Flags, UI_BoxFlag_DrawText);
|
||||||
UI_Box *log_textbox = UI_BuildBox(Zstr);
|
UI_BuildBox(Zstr);
|
||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ UI_Box *UI_BuildSpacer(UI_Size size)
|
|||||||
UI_Size old_width = UI_UseTop(Width);
|
UI_Size old_width = UI_UseTop(Width);
|
||||||
UI_Size old_height = UI_UseTop(Height);
|
UI_Size old_height = UI_UseTop(Height);
|
||||||
|
|
||||||
UI_PushStack();
|
UI_PushEmptyStack();
|
||||||
{
|
{
|
||||||
UI_Push(Tint, 0);
|
UI_Push(Tint, 0);
|
||||||
UI_Push(Parent, old_parent);
|
UI_Push(Parent, old_parent);
|
||||||
@ -67,7 +67,7 @@ UI_Box *UI_BuildDivider(UI_Size size)
|
|||||||
f32 old_border = UI_UseTop(Border);
|
f32 old_border = UI_UseTop(Border);
|
||||||
u32 old_border_color = UI_UseTop(BorderColor);
|
u32 old_border_color = UI_UseTop(BorderColor);
|
||||||
|
|
||||||
UI_PushStack();
|
UI_PushEmptyStack();
|
||||||
{
|
{
|
||||||
UI_Push(Parent, old_parent);
|
UI_Push(Parent, old_parent);
|
||||||
UI_Push(Tint, old_tint);
|
UI_Push(Tint, old_tint);
|
||||||
@ -87,3 +87,20 @@ UI_Box *UI_BuildDivider(UI_Size size)
|
|||||||
UI_PopStack();
|
UI_PopStack();
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//~ Layout helpers
|
||||||
|
|
||||||
|
UI_Box *UI_BuildColumn(String seed)
|
||||||
|
{
|
||||||
|
UI_SetNext(LayoutAxis, Axis_Y);
|
||||||
|
UI_Box *box = UI_BuildBox(seed);
|
||||||
|
return box;
|
||||||
|
}
|
||||||
|
|
||||||
|
UI_Box *UI_BuildRow(String seed)
|
||||||
|
{
|
||||||
|
UI_SetNext(LayoutAxis, Axis_X);
|
||||||
|
UI_Box *box = UI_BuildBox(seed);
|
||||||
|
return box;
|
||||||
|
}
|
||||||
|
|||||||
@ -10,3 +10,9 @@ UI_Box *UI_BuildLabelF_(char *fmt_cstr, ...);
|
|||||||
|
|
||||||
UI_Box *UI_BuildSpacer(UI_Size size);
|
UI_Box *UI_BuildSpacer(UI_Size size);
|
||||||
UI_Box *UI_BuildDivider(UI_Size size);
|
UI_Box *UI_BuildDivider(UI_Size size);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//~ Layout helpers
|
||||||
|
|
||||||
|
UI_Box *UI_BuildColumn(String seed);
|
||||||
|
UI_Box *UI_BuildRow(String seed);
|
||||||
|
|||||||
140
src/ui/ui_core.c
140
src/ui/ui_core.c
@ -62,7 +62,7 @@ UI_Box *UI_FrontBoxFromKey(UI_Key key)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Checkpoint helpers
|
//~ Checkpoint helpers
|
||||||
|
|
||||||
void UI_PushCP(UI_Box *parent)
|
UI_Box *UI_PushCP(UI_Box *parent)
|
||||||
{
|
{
|
||||||
UI_SharedState *g = &UI_shared_state;
|
UI_SharedState *g = &UI_shared_state;
|
||||||
UI_Stack *stack = g->top_stack;
|
UI_Stack *stack = g->top_stack;
|
||||||
@ -83,6 +83,7 @@ void UI_PushCP(UI_Box *parent)
|
|||||||
{
|
{
|
||||||
UI_Push(Parent, parent);
|
UI_Push(Parent, parent);
|
||||||
}
|
}
|
||||||
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_PopCP(void)
|
void UI_PopCP(void)
|
||||||
@ -112,7 +113,7 @@ void UI_PopCP(void)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Style stack helpers
|
//~ Style stack helpers
|
||||||
|
|
||||||
void UI_PushStack(void)
|
void UI_PushEmptyStack(void)
|
||||||
{
|
{
|
||||||
UI_SharedState *g = &UI_shared_state;
|
UI_SharedState *g = &UI_shared_state;
|
||||||
UI_Stack *stack = PushStruct(g->build_arena, UI_Stack);
|
UI_Stack *stack = PushStruct(g->build_arena, UI_Stack);
|
||||||
@ -210,15 +211,6 @@ void UI_PushStyle(UI_Style desc)
|
|||||||
{
|
{
|
||||||
default: break;
|
default: break;
|
||||||
|
|
||||||
case UI_StyleKind_Padding:
|
|
||||||
{
|
|
||||||
UI_Pad pad = desc.Padding;
|
|
||||||
UI_PushCopy(TopPadding, desc, pad.top);
|
|
||||||
UI_PushCopy(BottomPadding, desc, pad.bottom);
|
|
||||||
UI_PushCopy(LeftPadding, desc, pad.left);
|
|
||||||
UI_PushCopy(RightPadding, desc, pad.right);
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case UI_StyleKind_AxisSize:
|
case UI_StyleKind_AxisSize:
|
||||||
{
|
{
|
||||||
if (desc.AxisSize.axis == Axis_X)
|
if (desc.AxisSize.axis == Axis_X)
|
||||||
@ -306,18 +298,7 @@ UI_Style UI_FetchStyle(UI_StyleKind kind, b32 use)
|
|||||||
result.kind = kind;
|
result.kind = kind;
|
||||||
if (kind >= UI_StyleKind_BeginVirtualStyles_)
|
if (kind >= UI_StyleKind_BeginVirtualStyles_)
|
||||||
{
|
{
|
||||||
switch(kind)
|
/* Do nothing */
|
||||||
{
|
|
||||||
default: break;
|
|
||||||
|
|
||||||
case UI_StyleKind_Padding:
|
|
||||||
{
|
|
||||||
result.Padding.top = UI_FetchTop(TopPadding, use);
|
|
||||||
result.Padding.bottom = UI_FetchTop(BottomPadding, use);
|
|
||||||
result.Padding.left = UI_FetchTop(LeftPadding, use);
|
|
||||||
result.Padding.right = UI_FetchTop(RightPadding, use);
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -340,97 +321,7 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
{
|
{
|
||||||
UI_SharedState *g = &UI_shared_state;
|
UI_SharedState *g = &UI_shared_state;
|
||||||
|
|
||||||
UI_Pad padding = UI_UseTop(Padding);
|
|
||||||
UI_BoxFlag flags = UI_UseTop(Flags);
|
|
||||||
UI_Size width = UI_UseTop(Width);
|
|
||||||
UI_Size height = UI_UseTop(Height);
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//- Build initial padding
|
|
||||||
|
|
||||||
UI_Box *parent = UI_UseTop(Parent);
|
UI_Box *parent = UI_UseTop(Parent);
|
||||||
Axis axis = parent->layout_axis;
|
|
||||||
UI_Size axis_size = width;
|
|
||||||
UI_Size non_axis_size = height;
|
|
||||||
UI_Size axis_start_padding = padding.left;
|
|
||||||
UI_Size axis_end_padding = padding.right;
|
|
||||||
UI_Size non_axis_start_padding = padding.top;
|
|
||||||
UI_Size non_axis_end_padding = padding.bottom;
|
|
||||||
if (axis == Axis_Y)
|
|
||||||
{
|
|
||||||
axis_size = height;
|
|
||||||
non_axis_size = width;
|
|
||||||
axis_start_padding = padding.top;
|
|
||||||
axis_end_padding = padding.bottom;
|
|
||||||
non_axis_start_padding = padding.left;
|
|
||||||
non_axis_end_padding = padding.right;
|
|
||||||
}
|
|
||||||
b32 has_axis_start_padding = !(axis_start_padding.kind == UI_SizeKind_Pixel && axis_start_padding.v == 0);
|
|
||||||
b32 has_axis_end_padding = !(axis_end_padding.kind == UI_SizeKind_Pixel && axis_end_padding.v == 0);
|
|
||||||
b32 has_non_axis_start_padding = !(non_axis_start_padding.kind == UI_SizeKind_Pixel && non_axis_start_padding.v == 0);
|
|
||||||
b32 has_non_axis_end_padding = !(non_axis_end_padding.kind == UI_SizeKind_Pixel && non_axis_end_padding.v == 0);
|
|
||||||
if (has_axis_start_padding || has_axis_end_padding || has_non_axis_start_padding || has_non_axis_end_padding)
|
|
||||||
{
|
|
||||||
UI_PushStack();
|
|
||||||
UI_PushCP(parent);
|
|
||||||
{
|
|
||||||
if (has_non_axis_start_padding || has_non_axis_end_padding)
|
|
||||||
{
|
|
||||||
if (has_axis_start_padding)
|
|
||||||
{
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(axis, axis_start_padding));
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(!axis, non_axis_size));
|
|
||||||
UI_BuildBox(Zstr);
|
|
||||||
has_axis_start_padding = 0;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
UI_Pad subpad = ZI;
|
|
||||||
if (has_axis_end_padding)
|
|
||||||
{
|
|
||||||
if (axis == Axis_X)
|
|
||||||
{
|
|
||||||
subpad.right = axis_end_padding;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
subpad.bottom = axis_end_padding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UI_SetNext(Padding, subpad);
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(axis, axis_size));
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(!axis, UI_FIT(0)));
|
|
||||||
UI_SetNext(LayoutAxis, !axis);
|
|
||||||
parent = UI_BuildBox(Zstr);
|
|
||||||
}
|
|
||||||
axis = !axis;
|
|
||||||
axis_start_padding = non_axis_start_padding;
|
|
||||||
axis_end_padding = non_axis_end_padding;
|
|
||||||
has_axis_start_padding = has_non_axis_start_padding;
|
|
||||||
has_axis_end_padding = has_non_axis_end_padding;
|
|
||||||
{
|
|
||||||
UI_Size tmp = axis_size;
|
|
||||||
axis_size = non_axis_size;
|
|
||||||
non_axis_size = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UI_PopStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//- Build starting padding
|
|
||||||
|
|
||||||
if (has_axis_start_padding)
|
|
||||||
{
|
|
||||||
UI_PushStack();
|
|
||||||
UI_PushCP(parent);
|
|
||||||
{
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(axis, axis_start_padding));
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(!axis, non_axis_size));
|
|
||||||
UI_BuildBox(Zstr);
|
|
||||||
}
|
|
||||||
UI_PopStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Create box
|
//- Create box
|
||||||
@ -482,9 +373,9 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Pull from style stack */
|
/* Pull from style stack */
|
||||||
box->flags = flags;
|
box->flags = UI_UseTop(Flags);
|
||||||
box->pref_size[Axis_X] = width;
|
box->pref_size[Axis_X] = UI_UseTop(Width);
|
||||||
box->pref_size[Axis_Y] = height;
|
box->pref_size[Axis_Y] = UI_UseTop(Height);
|
||||||
box->layout_axis = UI_UseTop(LayoutAxis);
|
box->layout_axis = UI_UseTop(LayoutAxis);
|
||||||
box->background_color = UI_UseTop(BackgroundColor);
|
box->background_color = UI_UseTop(BackgroundColor);
|
||||||
box->border_color = UI_UseTop(BorderColor);
|
box->border_color = UI_UseTop(BorderColor);
|
||||||
@ -509,21 +400,6 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//- Build ending padding
|
|
||||||
|
|
||||||
if (has_axis_end_padding)
|
|
||||||
{
|
|
||||||
UI_PushStack();
|
|
||||||
UI_PushCP(parent);
|
|
||||||
{
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(axis, axis_end_padding));
|
|
||||||
UI_SetNext(AxisSize, UI_AXSIZE(!axis, non_axis_size));
|
|
||||||
UI_BuildBox(Zstr);
|
|
||||||
}
|
|
||||||
UI_PopStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +610,7 @@ UI_Frame UI_BeginFrame(UI_FrameFlag frame_flags)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Init style stack
|
//- Init style stack
|
||||||
|
|
||||||
UI_PushStack();
|
UI_PushEmptyStack();
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,17 +51,6 @@ Enum(UI_Alignment)
|
|||||||
UI_Alignment_Right,
|
UI_Alignment_Right,
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Padding types
|
|
||||||
|
|
||||||
Struct(UI_Pad)
|
|
||||||
{
|
|
||||||
UI_Size top;
|
|
||||||
UI_Size bottom;
|
|
||||||
UI_Size left;
|
|
||||||
UI_Size right;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Checkpoint types
|
//~ Checkpoint types
|
||||||
|
|
||||||
@ -105,15 +94,10 @@ Enum(UI_BoxFlag)
|
|||||||
x(FontSize, u32) \
|
x(FontSize, u32) \
|
||||||
x(Text, String) \
|
x(Text, String) \
|
||||||
x(TextAlignment, UI_Alignment) \
|
x(TextAlignment, UI_Alignment) \
|
||||||
x(LeftPadding, UI_Size) \
|
|
||||||
x(RightPadding, UI_Size) \
|
|
||||||
x(TopPadding, UI_Size) \
|
|
||||||
x(BottomPadding, UI_Size) \
|
|
||||||
/* ----------------------------------- */ \
|
/* ----------------------------------- */ \
|
||||||
/* --------- Virtual styles --------- */ \
|
/* --------- Virtual styles --------- */ \
|
||||||
/* ----------------------------------- */ \
|
/* ----------------------------------- */ \
|
||||||
x(BeginVirtualStyles_, i8) \
|
x(BeginVirtualStyles_, i8) \
|
||||||
x(Padding, UI_Pad) \
|
|
||||||
x(AxisSize, UI_AxisSize) \
|
x(AxisSize, UI_AxisSize) \
|
||||||
/* ------------------------------------------- */
|
/* ------------------------------------------- */
|
||||||
|
|
||||||
@ -333,13 +317,13 @@ UI_Box *UI_FrontBoxFromKey(UI_Key key);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Checkpoint helpers
|
//~ Checkpoint helpers
|
||||||
|
|
||||||
void UI_PushCP(UI_Box *parent);
|
UI_Box *UI_PushCP(UI_Box *parent);
|
||||||
void UI_PopCP(void);
|
void UI_PopCP(void);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Style stack helpers
|
//~ Style stack helpers
|
||||||
|
|
||||||
void UI_PushStack(void);
|
void UI_PushEmptyStack(void);
|
||||||
void UI_PopStack(void);
|
void UI_PopStack(void);
|
||||||
|
|
||||||
void UI_PushStyle(UI_Style desc);
|
void UI_PushStyle(UI_Style desc);
|
||||||
@ -381,12 +365,6 @@ UI_Style UI_FetchStyle(UI_StyleKind kind, b32 use);
|
|||||||
#define UI_RPIX(_v) UI_ROUND(UI_RoundKind_Pixel, (_v))
|
#define UI_RPIX(_v) UI_ROUND(UI_RoundKind_Pixel, (_v))
|
||||||
#define UI_RFILL(_v) UI_ROUND(UI_RoundKind_Fill, (_v))
|
#define UI_RFILL(_v) UI_ROUND(UI_RoundKind_Fill, (_v))
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
//~ Padding helpers
|
|
||||||
|
|
||||||
#define UI_PAD(...) ((UI_Pad) { __VA_ARGS__ })
|
|
||||||
#define UI_PADALL(size) ((UI_Pad) { .top = size, .bottom = size, .left = size, .right = size })
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//~ Box
|
//~ Box
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user