sketch out tag-based theme, per-window computation

This commit is contained in:
Ryan Fleury
2025-02-18 15:13:59 -08:00
parent e45bdfd90d
commit 6c9f7018f1
12 changed files with 2076 additions and 985 deletions
+6
View File
@@ -20,6 +20,7 @@
#define UI_GroupKey(v) DeferLoop(ui_push_group_key(v), ui_pop_group_key())
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
#define UI_Palette(v) DeferLoop(ui_push_palette(v), ui_pop_palette())
#define UI_Tag(v) DeferLoop(ui_push_tag(v), ui_pop_tag())
#define UI_Squish(v) DeferLoop(ui_push_squish(v), ui_pop_squish())
#define UI_HoverCursor(v) DeferLoop(ui_push_hover_cursor(v), ui_pop_hover_cursor())
#define UI_Font(v) DeferLoop(ui_push_font(v), ui_pop_font())
@@ -50,6 +51,7 @@ internal U32 ui_top_fastpath_codepoint(void) { UI_StackTopImpl(ui_state, Fastpat
internal UI_Key ui_top_group_key(void) { UI_StackTopImpl(ui_state, GroupKey, group_key) }
internal F32 ui_top_transparency(void) { UI_StackTopImpl(ui_state, Transparency, transparency) }
internal UI_Palette* ui_top_palette(void) { UI_StackTopImpl(ui_state, Palette, palette) }
internal String8 ui_top_tag(void) { UI_StackTopImpl(ui_state, Tag, tag) }
internal F32 ui_top_squish(void) { UI_StackTopImpl(ui_state, Squish, squish) }
internal OS_Cursor ui_top_hover_cursor(void) { UI_StackTopImpl(ui_state, HoverCursor, hover_cursor) }
internal FNT_Tag ui_top_font(void) { UI_StackTopImpl(ui_state, Font, font) }
@@ -79,6 +81,7 @@ internal U32 ui_bottom_fastpath_codepoint(void) { UI_StackBottomImpl(ui_state, F
internal UI_Key ui_bottom_group_key(void) { UI_StackBottomImpl(ui_state, GroupKey, group_key) }
internal F32 ui_bottom_transparency(void) { UI_StackBottomImpl(ui_state, Transparency, transparency) }
internal UI_Palette* ui_bottom_palette(void) { UI_StackBottomImpl(ui_state, Palette, palette) }
internal String8 ui_bottom_tag(void) { UI_StackBottomImpl(ui_state, Tag, tag) }
internal F32 ui_bottom_squish(void) { UI_StackBottomImpl(ui_state, Squish, squish) }
internal OS_Cursor ui_bottom_hover_cursor(void) { UI_StackBottomImpl(ui_state, HoverCursor, hover_cursor) }
internal FNT_Tag ui_bottom_font(void) { UI_StackBottomImpl(ui_state, Font, font) }
@@ -108,6 +111,7 @@ internal U32 ui_push_fastpath_codepoint(U32 v) { UI_StackPushImpl(ui_state, Fast
internal UI_Key ui_push_group_key(UI_Key v) { UI_StackPushImpl(ui_state, GroupKey, group_key, UI_Key, v) }
internal F32 ui_push_transparency(F32 v) { UI_StackPushImpl(ui_state, Transparency, transparency, F32, v) }
internal UI_Palette* ui_push_palette(UI_Palette* v) { UI_StackPushImpl(ui_state, Palette, palette, UI_Palette* , v) }
internal String8 ui_push_tag(String8 v) { UI_StackPushImpl(ui_state, Tag, tag, String8, v) }
internal F32 ui_push_squish(F32 v) { UI_StackPushImpl(ui_state, Squish, squish, F32, v) }
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v) { UI_StackPushImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
internal FNT_Tag ui_push_font(FNT_Tag v) { UI_StackPushImpl(ui_state, Font, font, FNT_Tag, v) }
@@ -137,6 +141,7 @@ internal U32 ui_pop_fastpath_codepoint(void) { UI_StackPopImpl(ui_state, Fastpat
internal UI_Key ui_pop_group_key(void) { UI_StackPopImpl(ui_state, GroupKey, group_key) }
internal F32 ui_pop_transparency(void) { UI_StackPopImpl(ui_state, Transparency, transparency) }
internal UI_Palette* ui_pop_palette(void) { UI_StackPopImpl(ui_state, Palette, palette) }
internal String8 ui_pop_tag(void) { UI_StackPopImpl(ui_state, Tag, tag) }
internal F32 ui_pop_squish(void) { UI_StackPopImpl(ui_state, Squish, squish) }
internal OS_Cursor ui_pop_hover_cursor(void) { UI_StackPopImpl(ui_state, HoverCursor, hover_cursor) }
internal FNT_Tag ui_pop_font(void) { UI_StackPopImpl(ui_state, Font, font) }
@@ -166,6 +171,7 @@ internal U32 ui_set_next_fastpath_codepoint(U32 v) { UI_StackSetNextImpl(ui_stat
internal UI_Key ui_set_next_group_key(UI_Key v) { UI_StackSetNextImpl(ui_state, GroupKey, group_key, UI_Key, v) }
internal F32 ui_set_next_transparency(F32 v) { UI_StackSetNextImpl(ui_state, Transparency, transparency, F32, v) }
internal UI_Palette* ui_set_next_palette(UI_Palette* v) { UI_StackSetNextImpl(ui_state, Palette, palette, UI_Palette* , v) }
internal String8 ui_set_next_tag(String8 v) { UI_StackSetNextImpl(ui_state, Tag, tag, String8, v) }
internal F32 ui_set_next_squish(F32 v) { UI_StackSetNextImpl(ui_state, Squish, squish, F32, v) }
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v) { UI_StackSetNextImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
internal FNT_Tag ui_set_next_font(FNT_Tag v) { UI_StackSetNextImpl(ui_state, Font, font, FNT_Tag, v) }
+40 -29
View File
@@ -22,6 +22,7 @@ typedef struct UI_FastpathCodepointNode UI_FastpathCodepointNode; struct UI_Fast
typedef struct UI_GroupKeyNode UI_GroupKeyNode; struct UI_GroupKeyNode{UI_GroupKeyNode *next; UI_Key v;};
typedef struct UI_TransparencyNode UI_TransparencyNode; struct UI_TransparencyNode{UI_TransparencyNode *next; F32 v;};
typedef struct UI_PaletteNode UI_PaletteNode; struct UI_PaletteNode{UI_PaletteNode *next; UI_Palette* v;};
typedef struct UI_TagNode UI_TagNode; struct UI_TagNode{UI_TagNode *next; String8 v;};
typedef struct UI_SquishNode UI_SquishNode; struct UI_SquishNode{UI_SquishNode *next; F32 v;};
typedef struct UI_HoverCursorNode UI_HoverCursorNode; struct UI_HoverCursorNode{UI_HoverCursorNode *next; OS_Cursor v;};
typedef struct UI_FontNode UI_FontNode; struct UI_FontNode{UI_FontNode *next; FNT_Tag v;};
@@ -54,6 +55,7 @@ UI_FastpathCodepointNode fastpath_codepoint_nil_stack_top;\
UI_GroupKeyNode group_key_nil_stack_top;\
UI_TransparencyNode transparency_nil_stack_top;\
UI_PaletteNode palette_nil_stack_top;\
UI_TagNode tag_nil_stack_top;\
UI_SquishNode squish_nil_stack_top;\
UI_HoverCursorNode hover_cursor_nil_stack_top;\
UI_FontNode font_nil_stack_top;\
@@ -85,6 +87,7 @@ state->fastpath_codepoint_nil_stack_top.v = 0;\
state->group_key_nil_stack_top.v = ui_key_zero();\
state->transparency_nil_stack_top.v = 0;\
state->palette_nil_stack_top.v = &ui_g_nil_palette;\
state->tag_nil_stack_top.v = str8_lit("");\
state->squish_nil_stack_top.v = 0;\
state->hover_cursor_nil_stack_top.v = OS_Cursor_Pointer;\
state->font_nil_stack_top.v = fnt_tag_zero();\
@@ -102,35 +105,36 @@ state->text_alignment_nil_stack_top.v = UI_TextAlign_Left;\
#define UI_DeclStacks \
struct\
{\
struct { UI_ParentNode *top; UI_Box * bottom_val; UI_ParentNode *free; B32 auto_pop; } parent_stack;\
struct { UI_ChildLayoutAxisNode *top; Axis2 bottom_val; UI_ChildLayoutAxisNode *free; B32 auto_pop; } child_layout_axis_stack;\
struct { UI_FixedXNode *top; F32 bottom_val; UI_FixedXNode *free; B32 auto_pop; } fixed_x_stack;\
struct { UI_FixedYNode *top; F32 bottom_val; UI_FixedYNode *free; B32 auto_pop; } fixed_y_stack;\
struct { UI_FixedWidthNode *top; F32 bottom_val; UI_FixedWidthNode *free; B32 auto_pop; } fixed_width_stack;\
struct { UI_FixedHeightNode *top; F32 bottom_val; UI_FixedHeightNode *free; B32 auto_pop; } fixed_height_stack;\
struct { UI_PrefWidthNode *top; UI_Size bottom_val; UI_PrefWidthNode *free; B32 auto_pop; } pref_width_stack;\
struct { UI_PrefHeightNode *top; UI_Size bottom_val; UI_PrefHeightNode *free; B32 auto_pop; } pref_height_stack;\
struct { UI_PermissionFlagsNode *top; UI_PermissionFlags bottom_val; UI_PermissionFlagsNode *free; B32 auto_pop; } permission_flags_stack;\
struct { UI_FlagsNode *top; UI_BoxFlags bottom_val; UI_FlagsNode *free; B32 auto_pop; } flags_stack;\
struct { UI_FocusHotNode *top; UI_FocusKind bottom_val; UI_FocusHotNode *free; B32 auto_pop; } focus_hot_stack;\
struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *free; B32 auto_pop; } focus_active_stack;\
struct { UI_FastpathCodepointNode *top; U32 bottom_val; UI_FastpathCodepointNode *free; B32 auto_pop; } fastpath_codepoint_stack;\
struct { UI_GroupKeyNode *top; UI_Key bottom_val; UI_GroupKeyNode *free; B32 auto_pop; } group_key_stack;\
struct { UI_TransparencyNode *top; F32 bottom_val; UI_TransparencyNode *free; B32 auto_pop; } transparency_stack;\
struct { UI_PaletteNode *top; UI_Palette* bottom_val; UI_PaletteNode *free; B32 auto_pop; } palette_stack;\
struct { UI_SquishNode *top; F32 bottom_val; UI_SquishNode *free; B32 auto_pop; } squish_stack;\
struct { UI_HoverCursorNode *top; OS_Cursor bottom_val; UI_HoverCursorNode *free; B32 auto_pop; } hover_cursor_stack;\
struct { UI_FontNode *top; FNT_Tag bottom_val; UI_FontNode *free; B32 auto_pop; } font_stack;\
struct { UI_FontSizeNode *top; F32 bottom_val; UI_FontSizeNode *free; B32 auto_pop; } font_size_stack;\
struct { UI_TextRasterFlagsNode *top; FNT_RasterFlags bottom_val; UI_TextRasterFlagsNode *free; B32 auto_pop; } text_raster_flags_stack;\
struct { UI_TabSizeNode *top; F32 bottom_val; UI_TabSizeNode *free; B32 auto_pop; } tab_size_stack;\
struct { UI_CornerRadius00Node *top; F32 bottom_val; UI_CornerRadius00Node *free; B32 auto_pop; } corner_radius_00_stack;\
struct { UI_CornerRadius01Node *top; F32 bottom_val; UI_CornerRadius01Node *free; B32 auto_pop; } corner_radius_01_stack;\
struct { UI_CornerRadius10Node *top; F32 bottom_val; UI_CornerRadius10Node *free; B32 auto_pop; } corner_radius_10_stack;\
struct { UI_CornerRadius11Node *top; F32 bottom_val; UI_CornerRadius11Node *free; B32 auto_pop; } corner_radius_11_stack;\
struct { UI_BlurSizeNode *top; F32 bottom_val; UI_BlurSizeNode *free; B32 auto_pop; } blur_size_stack;\
struct { UI_TextPaddingNode *top; F32 bottom_val; UI_TextPaddingNode *free; B32 auto_pop; } text_padding_stack;\
struct { UI_TextAlignmentNode *top; UI_TextAlign bottom_val; UI_TextAlignmentNode *free; B32 auto_pop; } text_alignment_stack;\
struct { UI_ParentNode *top; UI_Box * bottom_val; UI_ParentNode *free; U64 gen; B32 auto_pop; } parent_stack;\
struct { UI_ChildLayoutAxisNode *top; Axis2 bottom_val; UI_ChildLayoutAxisNode *free; U64 gen; B32 auto_pop; } child_layout_axis_stack;\
struct { UI_FixedXNode *top; F32 bottom_val; UI_FixedXNode *free; U64 gen; B32 auto_pop; } fixed_x_stack;\
struct { UI_FixedYNode *top; F32 bottom_val; UI_FixedYNode *free; U64 gen; B32 auto_pop; } fixed_y_stack;\
struct { UI_FixedWidthNode *top; F32 bottom_val; UI_FixedWidthNode *free; U64 gen; B32 auto_pop; } fixed_width_stack;\
struct { UI_FixedHeightNode *top; F32 bottom_val; UI_FixedHeightNode *free; U64 gen; B32 auto_pop; } fixed_height_stack;\
struct { UI_PrefWidthNode *top; UI_Size bottom_val; UI_PrefWidthNode *free; U64 gen; B32 auto_pop; } pref_width_stack;\
struct { UI_PrefHeightNode *top; UI_Size bottom_val; UI_PrefHeightNode *free; U64 gen; B32 auto_pop; } pref_height_stack;\
struct { UI_PermissionFlagsNode *top; UI_PermissionFlags bottom_val; UI_PermissionFlagsNode *free; U64 gen; B32 auto_pop; } permission_flags_stack;\
struct { UI_FlagsNode *top; UI_BoxFlags bottom_val; UI_FlagsNode *free; U64 gen; B32 auto_pop; } flags_stack;\
struct { UI_FocusHotNode *top; UI_FocusKind bottom_val; UI_FocusHotNode *free; U64 gen; B32 auto_pop; } focus_hot_stack;\
struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *free; U64 gen; B32 auto_pop; } focus_active_stack;\
struct { UI_FastpathCodepointNode *top; U32 bottom_val; UI_FastpathCodepointNode *free; U64 gen; B32 auto_pop; } fastpath_codepoint_stack;\
struct { UI_GroupKeyNode *top; UI_Key bottom_val; UI_GroupKeyNode *free; U64 gen; B32 auto_pop; } group_key_stack;\
struct { UI_TransparencyNode *top; F32 bottom_val; UI_TransparencyNode *free; U64 gen; B32 auto_pop; } transparency_stack;\
struct { UI_PaletteNode *top; UI_Palette* bottom_val; UI_PaletteNode *free; U64 gen; B32 auto_pop; } palette_stack;\
struct { UI_TagNode *top; String8 bottom_val; UI_TagNode *free; U64 gen; B32 auto_pop; } tag_stack;\
struct { UI_SquishNode *top; F32 bottom_val; UI_SquishNode *free; U64 gen; B32 auto_pop; } squish_stack;\
struct { UI_HoverCursorNode *top; OS_Cursor bottom_val; UI_HoverCursorNode *free; U64 gen; B32 auto_pop; } hover_cursor_stack;\
struct { UI_FontNode *top; FNT_Tag bottom_val; UI_FontNode *free; U64 gen; B32 auto_pop; } font_stack;\
struct { UI_FontSizeNode *top; F32 bottom_val; UI_FontSizeNode *free; U64 gen; B32 auto_pop; } font_size_stack;\
struct { UI_TextRasterFlagsNode *top; FNT_RasterFlags bottom_val; UI_TextRasterFlagsNode *free; U64 gen; B32 auto_pop; } text_raster_flags_stack;\
struct { UI_TabSizeNode *top; F32 bottom_val; UI_TabSizeNode *free; U64 gen; B32 auto_pop; } tab_size_stack;\
struct { UI_CornerRadius00Node *top; F32 bottom_val; UI_CornerRadius00Node *free; U64 gen; B32 auto_pop; } corner_radius_00_stack;\
struct { UI_CornerRadius01Node *top; F32 bottom_val; UI_CornerRadius01Node *free; U64 gen; B32 auto_pop; } corner_radius_01_stack;\
struct { UI_CornerRadius10Node *top; F32 bottom_val; UI_CornerRadius10Node *free; U64 gen; B32 auto_pop; } corner_radius_10_stack;\
struct { UI_CornerRadius11Node *top; F32 bottom_val; UI_CornerRadius11Node *free; U64 gen; B32 auto_pop; } corner_radius_11_stack;\
struct { UI_BlurSizeNode *top; F32 bottom_val; UI_BlurSizeNode *free; U64 gen; B32 auto_pop; } blur_size_stack;\
struct { UI_TextPaddingNode *top; F32 bottom_val; UI_TextPaddingNode *free; U64 gen; B32 auto_pop; } text_padding_stack;\
struct { UI_TextAlignmentNode *top; UI_TextAlign bottom_val; UI_TextAlignmentNode *free; U64 gen; B32 auto_pop; } text_alignment_stack;\
}
#define UI_InitStacks(state) \
state->parent_stack.top = &state->parent_nil_stack_top; state->parent_stack.bottom_val = &ui_nil_box; state->parent_stack.free = 0; state->parent_stack.auto_pop = 0;\
@@ -149,6 +153,7 @@ state->fastpath_codepoint_stack.top = &state->fastpath_codepoint_nil_stack_top;
state->group_key_stack.top = &state->group_key_nil_stack_top; state->group_key_stack.bottom_val = ui_key_zero(); state->group_key_stack.free = 0; state->group_key_stack.auto_pop = 0;\
state->transparency_stack.top = &state->transparency_nil_stack_top; state->transparency_stack.bottom_val = 0; state->transparency_stack.free = 0; state->transparency_stack.auto_pop = 0;\
state->palette_stack.top = &state->palette_nil_stack_top; state->palette_stack.bottom_val = &ui_g_nil_palette; state->palette_stack.free = 0; state->palette_stack.auto_pop = 0;\
state->tag_stack.top = &state->tag_nil_stack_top; state->tag_stack.bottom_val = str8_lit(""); state->tag_stack.free = 0; state->tag_stack.auto_pop = 0;\
state->squish_stack.top = &state->squish_nil_stack_top; state->squish_stack.bottom_val = 0; state->squish_stack.free = 0; state->squish_stack.auto_pop = 0;\
state->hover_cursor_stack.top = &state->hover_cursor_nil_stack_top; state->hover_cursor_stack.bottom_val = OS_Cursor_Pointer; state->hover_cursor_stack.free = 0; state->hover_cursor_stack.auto_pop = 0;\
state->font_stack.top = &state->font_nil_stack_top; state->font_stack.bottom_val = fnt_tag_zero(); state->font_stack.free = 0; state->font_stack.auto_pop = 0;\
@@ -180,6 +185,7 @@ if(state->fastpath_codepoint_stack.auto_pop) { ui_pop_fastpath_codepoint(); stat
if(state->group_key_stack.auto_pop) { ui_pop_group_key(); state->group_key_stack.auto_pop = 0; }\
if(state->transparency_stack.auto_pop) { ui_pop_transparency(); state->transparency_stack.auto_pop = 0; }\
if(state->palette_stack.auto_pop) { ui_pop_palette(); state->palette_stack.auto_pop = 0; }\
if(state->tag_stack.auto_pop) { ui_pop_tag(); state->tag_stack.auto_pop = 0; }\
if(state->squish_stack.auto_pop) { ui_pop_squish(); state->squish_stack.auto_pop = 0; }\
if(state->hover_cursor_stack.auto_pop) { ui_pop_hover_cursor(); state->hover_cursor_stack.auto_pop = 0; }\
if(state->font_stack.auto_pop) { ui_pop_font(); state->font_stack.auto_pop = 0; }\
@@ -210,6 +216,7 @@ internal U32 ui_top_fastpath_codepoint(void);
internal UI_Key ui_top_group_key(void);
internal F32 ui_top_transparency(void);
internal UI_Palette* ui_top_palette(void);
internal String8 ui_top_tag(void);
internal F32 ui_top_squish(void);
internal OS_Cursor ui_top_hover_cursor(void);
internal FNT_Tag ui_top_font(void);
@@ -239,6 +246,7 @@ internal U32 ui_bottom_fastpath_codepoint(void);
internal UI_Key ui_bottom_group_key(void);
internal F32 ui_bottom_transparency(void);
internal UI_Palette* ui_bottom_palette(void);
internal String8 ui_bottom_tag(void);
internal F32 ui_bottom_squish(void);
internal OS_Cursor ui_bottom_hover_cursor(void);
internal FNT_Tag ui_bottom_font(void);
@@ -268,6 +276,7 @@ internal U32 ui_push_fastpath_codepoint(U32 v);
internal UI_Key ui_push_group_key(UI_Key v);
internal F32 ui_push_transparency(F32 v);
internal UI_Palette* ui_push_palette(UI_Palette* v);
internal String8 ui_push_tag(String8 v);
internal F32 ui_push_squish(F32 v);
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
internal FNT_Tag ui_push_font(FNT_Tag v);
@@ -297,6 +306,7 @@ internal U32 ui_pop_fastpath_codepoint(void);
internal UI_Key ui_pop_group_key(void);
internal F32 ui_pop_transparency(void);
internal UI_Palette* ui_pop_palette(void);
internal String8 ui_pop_tag(void);
internal F32 ui_pop_squish(void);
internal OS_Cursor ui_pop_hover_cursor(void);
internal FNT_Tag ui_pop_font(void);
@@ -326,6 +336,7 @@ internal U32 ui_set_next_fastpath_codepoint(U32 v);
internal UI_Key ui_set_next_group_key(UI_Key v);
internal F32 ui_set_next_transparency(F32 v);
internal UI_Palette* ui_set_next_palette(UI_Palette* v);
internal String8 ui_set_next_tag(String8 v);
internal F32 ui_set_next_squish(F32 v);
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
internal FNT_Tag ui_set_next_font(FNT_Tag v);
+2 -1
View File
@@ -33,6 +33,7 @@ UI_StackTable:
//- rjf: colors
{ Transparency transparency F32 0 }
{ Palette palette `UI_Palette* ` `&ui_g_nil_palette` }
{ Tag tag String8 `str8_lit("")` }
//- rjf: squish
{ Squish squish F32 0 }
@@ -94,7 +95,7 @@ UI_StackTable:
`#define UI_DeclStacks \\`;
`struct\\`;
`{\\`;
@expand(UI_StackTable a) `struct { UI_$(a.name)Node *top; $(a.type) bottom_val; UI_$(a.name)Node *free; B32 auto_pop; } $(a.name_lower)_stack;\\`;
@expand(UI_StackTable a) `struct { UI_$(a.name)Node *top; $(a.type) bottom_val; UI_$(a.name)Node *free; U64 gen; B32 auto_pop; } $(a.name_lower)_stack;\\`;
`}`;
}
+16
View File
@@ -2350,6 +2350,19 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
box->text_padding = ui_state->text_padding_stack.top->v;
box->hover_cursor = ui_state->hover_cursor_stack.top->v;
box->custom_draw = 0;
if(ui_state->current_gen_tags_gen != ui_state->tag_stack.gen)
{
ui_state->current_gen_tags_gen = ui_state->tag_stack.gen;
Temp scratch = scratch_begin(0, 0);
String8List tags = {0};
for(UI_TagNode *n = ui_state->tag_stack.top; n != 0; n = n->next)
{
str8_list_push(ui_build_arena(), &tags, push_str8_copy(ui_build_arena(), n->v));
}
ui_state->current_gen_tags = str8_array_from_list(ui_build_arena(), &tags);
scratch_end(scratch);
}
box->tags = ui_state->current_gen_tags;
}
//- rjf: auto-pop all stacks
@@ -3147,6 +3160,7 @@ if(node->next == &state->name_lower##_nil_stack_top)\
state->name_lower##_stack.bottom_val = (new_value);\
}\
state->name_lower##_stack.auto_pop = 0;\
state->name_lower##_stack.gen += 1;\
return old_value;
#define UI_StackPopImpl(state, name_upper, name_lower) \
@@ -3156,6 +3170,7 @@ if(popped != &state->name_lower##_nil_stack_top)\
SLLStackPop(state->name_lower##_stack.top);\
SLLStackPush(state->name_lower##_stack.free, popped);\
state->name_lower##_stack.auto_pop = 0;\
state->name_lower##_stack.gen += 1;\
}\
return popped->v;\
@@ -3167,6 +3182,7 @@ type old_value = state->name_lower##_stack.top->v;\
node->v = new_value;\
SLLStackPush(state->name_lower##_stack.top, node);\
state->name_lower##_stack.auto_pop = 1;\
state->name_lower##_stack.gen += 1;\
return old_value;
#include "generated/ui.meta.c"
+30 -24
View File
@@ -366,29 +366,32 @@ typedef U64 UI_BoxFlags;
# define UI_BoxFlag_DrawDropShadow (UI_BoxFlags)(1ull<<27)
# define UI_BoxFlag_DrawBackgroundBlur (UI_BoxFlags)(1ull<<28)
# define UI_BoxFlag_DrawBackground (UI_BoxFlags)(1ull<<29)
# define UI_BoxFlag_DrawBackgroundAlt (UI_BoxFlags)(1ull<<30)
# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<31)
# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<32)
# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<33)
# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<34)
# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<35)
# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<36)
# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<37)
# define UI_BoxFlag_DrawTextWeak (UI_BoxFlags)(1ull<<38)
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<39)
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<40)
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<41)
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<45)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<46)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<47)
# define UI_BoxFlag_DisableFocusBorder (UI_BoxFlags)(1ull<<48)
# define UI_BoxFlag_DisableFocusOverlay (UI_BoxFlags)(1ull<<49)
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<50)
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<51)
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<52)
# define UI_BoxFlag_DrawAlt (UI_BoxFlags)(1ull<<30)
# define UI_BoxFlag_DrawGood (UI_BoxFlags)(1ull<<31)
# define UI_BoxFlag_DrawBad (UI_BoxFlags)(1ull<<32)
# define UI_BoxFlag_DrawPop (UI_BoxFlags)(1ull<<33)
# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<34)
# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<35)
# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<36)
# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<37)
# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<38)
# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<39)
# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<40)
# define UI_BoxFlag_DrawTextWeak (UI_BoxFlags)(1ull<<41)
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<45)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<46)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<47)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<48)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<49)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<50)
# define UI_BoxFlag_DisableFocusBorder (UI_BoxFlags)(1ull<<51)
# define UI_BoxFlag_DisableFocusOverlay (UI_BoxFlags)(1ull<<52)
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<53)
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<54)
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<55)
//- rjf: bundles
# define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable)
@@ -420,6 +423,7 @@ struct UI_Box
//- rjf: per-build equipment
UI_Key key;
UI_BoxFlags flags;
String8Array tags;
String8 string;
UI_TextAlign text_align;
Vec2F32 fixed_position;
@@ -659,6 +663,9 @@ struct UI_State
//- rjf: build state machine state
B32 is_in_open_ctx_menu;
B32 tooltip_can_overflow_window;
String8Array current_gen_tags;
U64 current_gen_tags_gen;
//- rjf: build phase output
UI_Box *root;
@@ -668,7 +675,6 @@ struct UI_State
U64 build_box_count;
U64 last_build_box_count;
B32 ctx_menu_touched_this_frame;
B32 tooltip_can_overflow_window;
B32 is_animating;
//- rjf: build parameters