rename layout axis -> child layout axis
This commit is contained in:
parent
54dda0b7b6
commit
f01812dd20
27
src/pp/pp.c
27
src/pp/pp.c
@ -116,7 +116,7 @@ void PP_PushGameUiStyle(void)
|
|||||||
UI_Push(Width, UI_FILL(1, 0));
|
UI_Push(Width, UI_FILL(1, 0));
|
||||||
UI_Push(Height, UI_FILL(1, 0));
|
UI_Push(Height, UI_FILL(1, 0));
|
||||||
|
|
||||||
UI_Push(LayoutAxis, Axis_Y);
|
UI_Push(ChildLayoutAxis, Axis_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Draw xform
|
//- Draw xform
|
||||||
@ -785,14 +785,6 @@ void PP_UpdateUser(void)
|
|||||||
|
|
||||||
g->ui_cursor = MulXformV2(InvertXform(g->ui_to_screen_xf), g->screen_cursor);
|
g->ui_cursor = MulXformV2(InvertXform(g->ui_to_screen_xf), g->screen_cursor);
|
||||||
|
|
||||||
//- Init pp root box
|
|
||||||
UI_Push(LayoutAxis, Axis_Y);
|
|
||||||
if (window_frame.forced_top)
|
|
||||||
{
|
|
||||||
UI_SetNext(Border, 10);
|
|
||||||
UI_SetNext(BorderColor, Rgba32F(1, 0, 0, 0.5));
|
|
||||||
}
|
|
||||||
|
|
||||||
UI_Box *pp_root_box = 0;
|
UI_Box *pp_root_box = 0;
|
||||||
{
|
{
|
||||||
UI_PushCP(UI_BuildRow(Zstr));
|
UI_PushCP(UI_BuildRow(Zstr));
|
||||||
@ -803,8 +795,16 @@ void PP_UpdateUser(void)
|
|||||||
UI_PushCP(UI_BuildColumn(Zstr));
|
UI_PushCP(UI_BuildColumn(Zstr));
|
||||||
{
|
{
|
||||||
UI_BuildSpacer(UI_FILL(1, 0));
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
|
{
|
||||||
|
if (window_frame.forced_top)
|
||||||
|
{
|
||||||
|
UI_SetNext(Border, 10);
|
||||||
|
UI_SetNext(BorderColor, Rgba32F(1, 0, 0, 0.5));
|
||||||
|
}
|
||||||
|
UI_SetNext(ChildLayoutAxis, Axis_Y);
|
||||||
UI_SetNext(Height, UI_PIX(g->ui_size.y, 1));
|
UI_SetNext(Height, UI_PIX(g->ui_size.y, 1));
|
||||||
pp_root_box = UI_BuildBox(Lit("pp root"));
|
pp_root_box = UI_BuildBox(Lit("pp root"));
|
||||||
|
}
|
||||||
UI_BuildSpacer(UI_FILL(1, 0));
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
@ -813,7 +813,6 @@ void PP_UpdateUser(void)
|
|||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
}
|
}
|
||||||
|
|
||||||
PP_PushGameUiStyle();
|
PP_PushGameUiStyle();
|
||||||
UI_Push(Parent, pp_root_box);
|
UI_Push(Parent, pp_root_box);
|
||||||
|
|
||||||
@ -1984,7 +1983,7 @@ void PP_UpdateUser(void)
|
|||||||
UI_Push(Rounding, UI_RPIX(15));
|
UI_Push(Rounding, UI_RPIX(15));
|
||||||
UI_Push(Width, UI_PIX(window_dims.x, 0));
|
UI_Push(Width, UI_PIX(window_dims.x, 0));
|
||||||
UI_Push(Height, UI_PIX(window_dims.y, 0));
|
UI_Push(Height, UI_PIX(window_dims.y, 0));
|
||||||
UI_Push(LayoutAxis, Axis_Y);
|
UI_Push(ChildLayoutAxis, 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_PushCP(UI_BuildBox(Lit("lister")));
|
UI_Box *lister_box = UI_PushCP(UI_BuildBox(Lit("lister")));
|
||||||
@ -1995,7 +1994,7 @@ void PP_UpdateUser(void)
|
|||||||
UI_Push(BackgroundColor, 0);
|
UI_Push(BackgroundColor, 0);
|
||||||
UI_Push(BorderColor, 0);
|
UI_Push(BorderColor, 0);
|
||||||
UI_Push(Rounding, UI_RPIX(0));
|
UI_Push(Rounding, UI_RPIX(0));
|
||||||
UI_Push(LayoutAxis, Axis_X);
|
UI_Push(ChildLayoutAxis, Axis_X);
|
||||||
UI_Push(Width, UI_FILL(1, 0));
|
UI_Push(Width, UI_FILL(1, 0));
|
||||||
UI_Push(Height, UI_FNT(2, 0));
|
UI_Push(Height, UI_FNT(2, 0));
|
||||||
UI_PushCP(UI_BuildBox(Zstr));
|
UI_PushCP(UI_BuildBox(Zstr));
|
||||||
@ -2033,10 +2032,10 @@ void PP_UpdateUser(void)
|
|||||||
|
|
||||||
UI_BuildSpacer(UI_FILL(1, 0));
|
UI_BuildSpacer(UI_FILL(1, 0));
|
||||||
|
|
||||||
UI_SetNext(LayoutAxis, Axis_Y);
|
UI_SetNext(ChildLayoutAxis, Axis_Y);
|
||||||
UI_SetNext(BackgroundColor, 0);
|
UI_SetNext(BackgroundColor, 0);
|
||||||
UI_SetNext(BorderColor, 0);
|
UI_SetNext(BorderColor, 0);
|
||||||
UI_SetNext(Width, UI_FIT(0));
|
UI_SetNext(Width, UI_FIT(1));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_SetNext(Height, UI_FIT(1));
|
||||||
UI_SetNext(Tint, 0);
|
UI_SetNext(Tint, 0);
|
||||||
UI_PushCP(UI_BuildBox(Lit("dbg")));
|
UI_PushCP(UI_BuildBox(Lit("dbg")));
|
||||||
|
|||||||
@ -110,23 +110,23 @@ UI_Box *PP_BuildDebugConsole(b32 minimized)
|
|||||||
UI_Push(Tint, Alpha32F(0xFFFFFFFF, opacity));
|
UI_Push(Tint, Alpha32F(0xFFFFFFFF, opacity));
|
||||||
{
|
{
|
||||||
u32 color = colors[log.level][log.level_id % 2];
|
u32 color = colors[log.level][log.level_id % 2];
|
||||||
UI_SetNext(BackgroundColor, color);
|
UI_Push(BackgroundColor, color);
|
||||||
UI_SetNext(Width, UI_FILL(1, 0));
|
UI_Push(Width, UI_FILL(1, 0));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_Push(Height, UI_FNT(2, 1));
|
||||||
UI_SetNext(BorderColor, Rgba32F(0.25, 0.25, 0.25, 1));
|
UI_Push(BorderColor, Rgba32F(0.25, 0.25, 0.25, 1));
|
||||||
UI_SetNext(Rounding, UI_RPIX(0));
|
UI_Push(Rounding, UI_RPIX(0));
|
||||||
UI_SetNext(Border, 1);
|
UI_Push(Border, 1);
|
||||||
UI_PushCP(UI_BuildRow(Zstr));
|
UI_PushCP(UI_BuildRow(Zstr));
|
||||||
{
|
{
|
||||||
// UI_SetNext(Height, UI_PIX(100, 0));
|
// UI_SetNext(Height, UI_PIX(100, 0));
|
||||||
// UI_BuildSpacer(UI_PIX(1, 0));
|
UI_BuildSpacer(UI_PIX(10, 0));
|
||||||
UI_SetNext(BackgroundColor, 0);
|
UI_Push(BackgroundColor, 0);
|
||||||
UI_SetNext(Border, 0);
|
UI_Push(Border, 0);
|
||||||
UI_SetNext(Text, text);
|
UI_Push(Text, text);
|
||||||
UI_SetNext(TextAlignment, UI_Alignment_Left);
|
UI_Push(TextAlignment, UI_Alignment_Left);
|
||||||
UI_SetNext(Width, UI_FILL(1, 0));
|
UI_Push(Width, UI_FILL(1, 0));
|
||||||
UI_SetNext(Height, UI_FIT(1));
|
UI_Push(Height, UI_FIT(1));
|
||||||
UI_SetNext(Flags, UI_BoxFlag_DrawText);
|
UI_Push(Flags, UI_BoxFlag_DrawText);
|
||||||
UI_BuildBox(Zstr);
|
UI_BuildBox(Zstr);
|
||||||
}
|
}
|
||||||
UI_PopCP();
|
UI_PopCP();
|
||||||
|
|||||||
@ -33,23 +33,15 @@ UI_Box *UI_BuildSpacer(UI_Size size)
|
|||||||
UI_Box *box = 0;
|
UI_Box *box = 0;
|
||||||
|
|
||||||
UI_Box *old_parent = UI_UseTop(Parent);
|
UI_Box *old_parent = UI_UseTop(Parent);
|
||||||
UI_Size old_width = UI_UseTop(Width);
|
UI_Size old_axis_sizes[Axis_CountXY] = { UI_UseTop(Width), UI_UseTop(Height) };
|
||||||
UI_Size old_height = UI_UseTop(Height);
|
Axis axis = old_parent->child_layout_axis;
|
||||||
|
|
||||||
UI_PushEmptyStack();
|
UI_PushEmptyStack();
|
||||||
{
|
{
|
||||||
UI_Push(Tint, 0);
|
UI_Push(Tint, 0);
|
||||||
UI_Push(Parent, old_parent);
|
UI_Push(Parent, old_parent);
|
||||||
if (old_parent->layout_axis == Axis_X)
|
UI_Push(AxisSize, UI_AXSIZE(!axis, old_axis_sizes[axis]));
|
||||||
{
|
UI_Push(AxisSize, UI_AXSIZE(axis, size));
|
||||||
UI_Push(Width, size);
|
|
||||||
UI_Push(Height, old_height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UI_Push(Width, old_width);
|
|
||||||
UI_Push(Height, size);
|
|
||||||
}
|
|
||||||
box = UI_BuildBox(Zstr);
|
box = UI_BuildBox(Zstr);
|
||||||
}
|
}
|
||||||
UI_PopStack();
|
UI_PopStack();
|
||||||
@ -61,27 +53,19 @@ UI_Box *UI_BuildDivider(UI_Size size)
|
|||||||
UI_Box *box = 0;
|
UI_Box *box = 0;
|
||||||
|
|
||||||
UI_Box *old_parent = UI_UseTop(Parent);
|
UI_Box *old_parent = UI_UseTop(Parent);
|
||||||
UI_Size old_width = UI_UseTop(Width);
|
UI_Size old_axis_sizes[Axis_CountXY] = { UI_UseTop(Width), UI_UseTop(Height) };
|
||||||
UI_Size old_height = UI_UseTop(Height);
|
|
||||||
u32 old_tint = UI_UseTop(Tint);
|
u32 old_tint = UI_UseTop(Tint);
|
||||||
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);
|
||||||
|
Axis axis = old_parent->child_layout_axis;
|
||||||
|
|
||||||
UI_PushEmptyStack();
|
UI_PushEmptyStack();
|
||||||
{
|
{
|
||||||
UI_Push(Parent, old_parent);
|
UI_Push(Parent, old_parent);
|
||||||
UI_Push(Tint, old_tint);
|
UI_Push(Tint, old_tint);
|
||||||
UI_Push(BackgroundColor, old_border_color);
|
UI_Push(BackgroundColor, old_border_color);
|
||||||
if (old_parent->layout_axis == Axis_X)
|
UI_Push(AxisSize, UI_AXSIZE(!axis, old_axis_sizes[axis]));
|
||||||
{
|
UI_Push(AxisSize, UI_AXSIZE(axis, size));
|
||||||
UI_Push(Width, size);
|
|
||||||
UI_Push(Height, old_height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UI_Push(Width, old_width);
|
|
||||||
UI_Push(Height, size);
|
|
||||||
}
|
|
||||||
box = UI_BuildBox(Zstr);
|
box = UI_BuildBox(Zstr);
|
||||||
}
|
}
|
||||||
UI_PopStack();
|
UI_PopStack();
|
||||||
@ -93,14 +77,14 @@ UI_Box *UI_BuildDivider(UI_Size size)
|
|||||||
|
|
||||||
UI_Box *UI_BuildColumn(String seed)
|
UI_Box *UI_BuildColumn(String seed)
|
||||||
{
|
{
|
||||||
UI_SetNext(LayoutAxis, Axis_Y);
|
UI_SetNext(ChildLayoutAxis, Axis_Y);
|
||||||
UI_Box *box = UI_BuildBox(seed);
|
UI_Box *box = UI_BuildBox(seed);
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_Box *UI_BuildRow(String seed)
|
UI_Box *UI_BuildRow(String seed)
|
||||||
{
|
{
|
||||||
UI_SetNext(LayoutAxis, Axis_X);
|
UI_SetNext(ChildLayoutAxis, Axis_X);
|
||||||
UI_Box *box = UI_BuildBox(seed);
|
UI_Box *box = UI_BuildBox(seed);
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -322,33 +322,32 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
UI_SharedState *g = &UI_shared_state;
|
UI_SharedState *g = &UI_shared_state;
|
||||||
|
|
||||||
UI_Box *parent = UI_UseTop(Parent);
|
UI_Box *parent = UI_UseTop(Parent);
|
||||||
|
UI_Tag tag = UI_UseTop(Tag);
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Create box
|
//- Create box
|
||||||
|
|
||||||
UI_Box *box = 0;
|
UI_Box *box = PushStruct(g->build_arena, UI_Box);
|
||||||
{
|
|
||||||
/* Calculate key */
|
/* Calculate key */
|
||||||
UI_Tag tag = UI_UseTop(Tag);
|
|
||||||
UI_Key key = ZI;
|
|
||||||
if (seed.len > 0)
|
if (seed.len > 0)
|
||||||
{
|
{
|
||||||
|
UI_Key key = ZI;
|
||||||
key.hash = RandU64FromSeeds(key.hash, parent->key.hash);
|
key.hash = RandU64FromSeeds(key.hash, parent->key.hash);
|
||||||
key.hash = RandU64FromSeeds(key.hash, tag.hash);
|
key.hash = RandU64FromSeeds(key.hash, tag.hash);
|
||||||
key.hash = HashFnv64(key.hash, seed);
|
key.hash = HashFnv64(key.hash, seed);
|
||||||
|
box->key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert into lookup */
|
/* Insert into lookup */
|
||||||
UI_BoxBin *bin = &g->box_bins[key.hash % UI_NumBoxLookupBins];
|
if (box->key.hash != 0)
|
||||||
box = PushStruct(g->build_arena, UI_Box);
|
|
||||||
UI_Box *back_box = 0;
|
|
||||||
if (key.hash != 0)
|
|
||||||
{
|
{
|
||||||
|
UI_BoxBin *bin = &g->box_bins[box->key.hash % UI_NumBoxLookupBins];
|
||||||
#if RtcIsEnabled
|
#if RtcIsEnabled
|
||||||
/* Validate box not already built */
|
/* Validate box not already built */
|
||||||
for (UI_Box *tmp = bin->first; tmp; tmp = tmp->next_in_bin)
|
for (UI_Box *tmp = bin->first; tmp; tmp = tmp->next_in_bin)
|
||||||
{
|
{
|
||||||
if (tmp->key.hash == key.hash)
|
if (tmp->key.hash == box->key.hash)
|
||||||
{
|
{
|
||||||
Assert(0); /* Box with matching key already built */
|
Assert(0); /* Box with matching key already built */
|
||||||
break;
|
break;
|
||||||
@ -356,9 +355,7 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DllPushBackNP(bin->first, bin->last, box, next_in_bin, prev_in_bin);
|
DllPushBackNP(bin->first, bin->last, box, next_in_bin, prev_in_bin);
|
||||||
back_box = UI_BackBoxFromKey(key);
|
|
||||||
}
|
}
|
||||||
box->key = key;
|
|
||||||
++g->boxes_count;
|
++g->boxes_count;
|
||||||
|
|
||||||
/* Insert into parent */
|
/* Insert into parent */
|
||||||
@ -367,6 +364,7 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
++parent->count;
|
++parent->count;
|
||||||
|
|
||||||
/* Persist data from back box */
|
/* Persist data from back box */
|
||||||
|
UI_Box *back_box = UI_BackBoxFromKey(box->key);
|
||||||
if (back_box != 0)
|
if (back_box != 0)
|
||||||
{
|
{
|
||||||
box->report = back_box->report;
|
box->report = back_box->report;
|
||||||
@ -376,7 +374,8 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
box->flags = UI_UseTop(Flags);
|
box->flags = UI_UseTop(Flags);
|
||||||
box->pref_size[Axis_X] = UI_UseTop(Width);
|
box->pref_size[Axis_X] = UI_UseTop(Width);
|
||||||
box->pref_size[Axis_Y] = UI_UseTop(Height);
|
box->pref_size[Axis_Y] = UI_UseTop(Height);
|
||||||
box->layout_axis = UI_UseTop(LayoutAxis);
|
box->child_layout_axis = UI_UseTop(ChildLayoutAxis);
|
||||||
|
box->text_alignment = UI_UseTop(TextAlignment);
|
||||||
box->background_color = UI_UseTop(BackgroundColor);
|
box->background_color = UI_UseTop(BackgroundColor);
|
||||||
box->border_color = UI_UseTop(BorderColor);
|
box->border_color = UI_UseTop(BorderColor);
|
||||||
box->debug_color = UI_UseTop(DebugColor);
|
box->debug_color = UI_UseTop(DebugColor);
|
||||||
@ -387,7 +386,6 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
box->rounding = UI_UseTop(Rounding);
|
box->rounding = UI_UseTop(Rounding);
|
||||||
box->text = UI_UseTop(Text);
|
box->text = UI_UseTop(Text);
|
||||||
box->floating_pos = UI_UseTop(FloatingPos);
|
box->floating_pos = UI_UseTop(FloatingPos);
|
||||||
box->text_alignment = UI_UseTop(TextAlignment);
|
|
||||||
|
|
||||||
/* Prefetch font */
|
/* Prefetch font */
|
||||||
if (box->text.len > 0)
|
if (box->text.len > 0)
|
||||||
@ -398,7 +396,6 @@ UI_Box *UI_BuildBox(String seed)
|
|||||||
box->glyph_run = F_RunFromString(g->build_arena, box->font, box->text);
|
box->glyph_run = F_RunFromString(g->build_arena, box->font, box->text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
@ -764,17 +761,19 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
UI_Size pref_size = box->pref_size[axis];
|
UI_Size pref_size = box->pref_size[axis];
|
||||||
if (pref_size.kind == UI_SizeKind_Fill)
|
if (pref_size.kind == UI_SizeKind_Fill)
|
||||||
{
|
{
|
||||||
f32 ancestor_size = 0;
|
f32 match_size = 0;
|
||||||
for (UI_Box *ancestor = box->parent; ancestor; ancestor = ancestor->parent)
|
b32 found_match = 0;
|
||||||
|
for (UI_Box *ancestor = box->parent; ancestor != 0 && !found_match; ancestor = ancestor->parent)
|
||||||
{
|
{
|
||||||
UI_Size tmp = ancestor->pref_size[axis];
|
UI_Size ancestor_size = ancestor->pref_size[axis];
|
||||||
if (tmp.kind == UI_SizeKind_Pixel || (tmp.kind == UI_SizeKind_Fit && AnyBit(box->flags, UI_BoxFlag_DrawText)))
|
if (ancestor_size.kind == UI_SizeKind_Pixel || (ancestor_size.kind == UI_SizeKind_Fit && AnyBit(box->flags, UI_BoxFlag_DrawText)))
|
||||||
{
|
{
|
||||||
ancestor_size = ancestor->solved_dims[axis];
|
/* Match independent ancestor */
|
||||||
break;
|
match_size = ancestor->solved_dims[axis];
|
||||||
|
found_match = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
box->solved_dims[axis] = pref_size.v * ancestor_size;
|
box->solved_dims[axis] = match_size * pref_size.v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -793,7 +792,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
{
|
{
|
||||||
if (!AnyBit(child->flags, UI_BoxFlag_Floating))
|
if (!AnyBit(child->flags, UI_BoxFlag_Floating))
|
||||||
{
|
{
|
||||||
if (axis == box->layout_axis)
|
if (axis == box->child_layout_axis)
|
||||||
{
|
{
|
||||||
accum += child->solved_dims[axis];
|
accum += child->solved_dims[axis];
|
||||||
}
|
}
|
||||||
@ -826,7 +825,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
f32 size = child->solved_dims[axis];
|
f32 size = child->solved_dims[axis];
|
||||||
f32 strictness = child->pref_size[axis].strictness;
|
f32 strictness = child->pref_size[axis].strictness;
|
||||||
f32 flex = size * (1.0 - strictness);
|
f32 flex = size * (1.0 - strictness);
|
||||||
if (axis == box->layout_axis)
|
if (axis == box->child_layout_axis)
|
||||||
{
|
{
|
||||||
size_accum += size;
|
size_accum += size;
|
||||||
flex_accum += flex;
|
flex_accum += flex;
|
||||||
@ -849,7 +848,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
f32 strictness = child->pref_size[axis].strictness;
|
f32 strictness = child->pref_size[axis].strictness;
|
||||||
f32 flex = size * (1.0 - strictness);
|
f32 flex = size * (1.0 - strictness);
|
||||||
f32 new_size = size;
|
f32 new_size = size;
|
||||||
if (axis == box->layout_axis)
|
if (axis == box->child_layout_axis)
|
||||||
{
|
{
|
||||||
f32 chopoff = MinF32(flex, violation * (flex / flex_accum));
|
f32 chopoff = MinF32(flex, violation * (flex / flex_accum));
|
||||||
new_size = size - chopoff;
|
new_size = size - chopoff;
|
||||||
@ -914,7 +913,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
|||||||
/* Non-floating box position */
|
/* Non-floating box position */
|
||||||
else if (parent)
|
else if (parent)
|
||||||
{
|
{
|
||||||
b32 is_layout_x = parent->layout_axis == Axis_X;
|
b32 is_layout_x = parent->child_layout_axis == Axis_X;
|
||||||
f32 layout_cursor = parent->layout_cursor;
|
f32 layout_cursor = parent->layout_cursor;
|
||||||
Vec2 offset = VEC2(layout_cursor * is_layout_x, layout_cursor * !is_layout_x);
|
Vec2 offset = VEC2(layout_cursor * is_layout_x, layout_cursor * !is_layout_x);
|
||||||
parent->layout_cursor += dims.x * is_layout_x + dims.y * !is_layout_x;
|
parent->layout_cursor += dims.x * is_layout_x + dims.y * !is_layout_x;
|
||||||
|
|||||||
@ -79,7 +79,7 @@ Enum(UI_BoxFlag)
|
|||||||
x(Flags, UI_BoxFlag) \
|
x(Flags, UI_BoxFlag) \
|
||||||
x(Parent, struct UI_Box *) \
|
x(Parent, struct UI_Box *) \
|
||||||
x(Tag, UI_Tag) \
|
x(Tag, UI_Tag) \
|
||||||
x(LayoutAxis, Axis) \
|
x(ChildLayoutAxis, Axis) \
|
||||||
x(Width, UI_Size) \
|
x(Width, UI_Size) \
|
||||||
x(Height, UI_Size) \
|
x(Height, UI_Size) \
|
||||||
x(Size, UI_Size) \
|
x(Size, UI_Size) \
|
||||||
@ -211,7 +211,7 @@ Struct(UI_Box)
|
|||||||
UI_Alignment text_alignment;
|
UI_Alignment text_alignment;
|
||||||
ResourceKey font_resource;
|
ResourceKey font_resource;
|
||||||
f32 font_size;
|
f32 font_size;
|
||||||
Axis layout_axis;
|
Axis child_layout_axis;
|
||||||
|
|
||||||
//- Pre-layout data
|
//- Pre-layout data
|
||||||
u64 pre_index;
|
u64 pre_index;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user