mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-27 09:50:10 +00:00
eliminate old palette system entirely
This commit is contained in:
@@ -20,8 +20,9 @@
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#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_BackgroundColor(v) DeferLoop(ui_push_background_color(v), ui_pop_background_color())
|
||||
#define UI_TextColor(v) DeferLoop(ui_push_text_color(v), ui_pop_text_color())
|
||||
#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())
|
||||
@@ -52,7 +53,8 @@ internal UI_FocusKind ui_top_focus_active(void) { UI_StackTopImpl(ui_state, Focu
|
||||
internal U32 ui_top_fastpath_codepoint(void) { UI_StackTopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
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 Vec4F32 ui_top_background_color(void) { UI_StackTopImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_top_text_color(void) { UI_StackTopImpl(ui_state, TextColor, text_color) }
|
||||
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) }
|
||||
@@ -82,7 +84,8 @@ internal UI_FocusKind ui_bottom_focus_active(void) { UI_StackBottomImpl(ui_state
|
||||
internal U32 ui_bottom_fastpath_codepoint(void) { UI_StackBottomImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
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 Vec4F32 ui_bottom_background_color(void) { UI_StackBottomImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_bottom_text_color(void) { UI_StackBottomImpl(ui_state, TextColor, text_color) }
|
||||
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) }
|
||||
@@ -112,7 +115,8 @@ internal UI_FocusKind ui_push_focus_active(UI_FocusKind v) { UI_StackPushImpl(ui
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v) { UI_StackPushImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
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 Vec4F32 ui_push_background_color(Vec4F32 v) { UI_StackPushImpl(ui_state, BackgroundColor, background_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextColor, text_color, Vec4F32, 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) }
|
||||
@@ -142,7 +146,8 @@ internal UI_FocusKind ui_pop_focus_active(void) { UI_StackPopImpl(ui_state, Focu
|
||||
internal U32 ui_pop_fastpath_codepoint(void) { UI_StackPopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
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 Vec4F32 ui_pop_background_color(void) { UI_StackPopImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_pop_text_color(void) { UI_StackPopImpl(ui_state, TextColor, text_color) }
|
||||
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) }
|
||||
@@ -172,7 +177,8 @@ internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v) { UI_StackSetNext
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v) { UI_StackSetNextImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
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 Vec4F32 ui_set_next_background_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, BackgroundColor, background_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextColor, text_color, Vec4F32, 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) }
|
||||
|
||||
+22
-11
@@ -22,8 +22,9 @@ typedef struct UI_FocusActiveNode UI_FocusActiveNode; struct UI_FocusActiveNode{
|
||||
typedef struct UI_FastpathCodepointNode UI_FastpathCodepointNode; struct UI_FastpathCodepointNode{UI_FastpathCodepointNode *next; U32 v;};
|
||||
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_BackgroundColorNode UI_BackgroundColorNode; struct UI_BackgroundColorNode{UI_BackgroundColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextColorNode UI_TextColorNode; struct UI_TextColorNode{UI_TextColorNode *next; Vec4F32 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;};
|
||||
@@ -56,8 +57,9 @@ UI_FocusActiveNode focus_active_nil_stack_top;\
|
||||
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_BackgroundColorNode background_color_nil_stack_top;\
|
||||
UI_TextColorNode text_color_nil_stack_top;\
|
||||
UI_SquishNode squish_nil_stack_top;\
|
||||
UI_HoverCursorNode hover_cursor_nil_stack_top;\
|
||||
UI_FontNode font_nil_stack_top;\
|
||||
@@ -89,8 +91,9 @@ state->focus_active_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
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->background_color_nil_stack_top.v = v4f32(0, 0, 0, 0);\
|
||||
state->text_color_nil_stack_top.v = v4f32(0, 0, 0, 0);\
|
||||
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();\
|
||||
@@ -124,8 +127,9 @@ struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *f
|
||||
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_BackgroundColorNode *top; Vec4F32 bottom_val; UI_BackgroundColorNode *free; U64 gen; B32 auto_pop; } background_color_stack;\
|
||||
struct { UI_TextColorNode *top; Vec4F32 bottom_val; UI_TextColorNode *free; U64 gen; B32 auto_pop; } text_color_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;\
|
||||
@@ -157,8 +161,9 @@ state->focus_active_stack.top = &state->focus_active_nil_stack_top; state->focus
|
||||
state->fastpath_codepoint_stack.top = &state->fastpath_codepoint_nil_stack_top; state->fastpath_codepoint_stack.bottom_val = 0; state->fastpath_codepoint_stack.free = 0; state->fastpath_codepoint_stack.auto_pop = 0;\
|
||||
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->background_color_stack.top = &state->background_color_nil_stack_top; state->background_color_stack.bottom_val = v4f32(0, 0, 0, 0); state->background_color_stack.free = 0; state->background_color_stack.auto_pop = 0;\
|
||||
state->text_color_stack.top = &state->text_color_nil_stack_top; state->text_color_stack.bottom_val = v4f32(0, 0, 0, 0); state->text_color_stack.free = 0; state->text_color_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;\
|
||||
@@ -190,8 +195,9 @@ if(state->focus_active_stack.auto_pop) { ui_pop_focus_active(); state->focus_act
|
||||
if(state->fastpath_codepoint_stack.auto_pop) { ui_pop_fastpath_codepoint(); state->fastpath_codepoint_stack.auto_pop = 0; }\
|
||||
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->background_color_stack.auto_pop) { ui_pop_background_color(); state->background_color_stack.auto_pop = 0; }\
|
||||
if(state->text_color_stack.auto_pop) { ui_pop_text_color(); state->text_color_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; }\
|
||||
@@ -222,8 +228,9 @@ internal UI_FocusKind ui_top_focus_active(void);
|
||||
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 Vec4F32 ui_top_background_color(void);
|
||||
internal Vec4F32 ui_top_text_color(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal FNT_Tag ui_top_font(void);
|
||||
@@ -253,8 +260,9 @@ internal UI_FocusKind ui_bottom_focus_active(void);
|
||||
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 Vec4F32 ui_bottom_background_color(void);
|
||||
internal Vec4F32 ui_bottom_text_color(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal FNT_Tag ui_bottom_font(void);
|
||||
@@ -284,8 +292,9 @@ internal UI_FocusKind ui_push_focus_active(UI_FocusKind v);
|
||||
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 Vec4F32 ui_push_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 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);
|
||||
@@ -315,8 +324,9 @@ internal UI_FocusKind ui_pop_focus_active(void);
|
||||
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 Vec4F32 ui_pop_background_color(void);
|
||||
internal Vec4F32 ui_pop_text_color(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal FNT_Tag ui_pop_font(void);
|
||||
@@ -346,8 +356,9 @@ internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v);
|
||||
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 Vec4F32 ui_set_next_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 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
@@ -33,8 +33,9 @@ UI_StackTable:
|
||||
|
||||
//- rjf: colors
|
||||
{ Transparency transparency F32 0 }
|
||||
{ Palette palette `UI_Palette* ` `&ui_g_nil_palette` }
|
||||
{ Tag tag String8 `str8_lit("")` 1 }
|
||||
{ BackgroundColor background_color Vec4F32 `v4f32(0, 0, 0, 0)` }
|
||||
{ TextColor text_color Vec4F32 `v4f32(0, 0, 0, 0)` }
|
||||
|
||||
//- rjf: squish
|
||||
{ Squish squish F32 0 }
|
||||
|
||||
@@ -480,7 +480,7 @@ ui_do_color_tooltip_hsv(Vec3F32 hsv)
|
||||
{
|
||||
UI_PrefWidth(ui_em(22.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f)) UI_Row UI_Padding(ui_pct(1, 0))
|
||||
{
|
||||
UI_Palette(ui_build_palette(ui_top_palette(), .background = v4f32(rgb.x, rgb.y, rgb.z, 1.f)))
|
||||
UI_BackgroundColor(v4f32(rgb.x, rgb.y, rgb.z, 1.f))
|
||||
UI_CornerRadius(4.f)
|
||||
UI_PrefWidth(ui_em(6.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f))
|
||||
ui_build_box_from_string(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground, str8_lit(""));
|
||||
@@ -519,7 +519,7 @@ ui_do_color_tooltip_hsva(Vec4F32 hsva)
|
||||
{
|
||||
UI_PrefWidth(ui_em(22.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f)) UI_Row UI_Padding(ui_pct(1, 0))
|
||||
{
|
||||
UI_Palette(ui_build_palette(ui_top_palette(), .background = rgba))
|
||||
UI_BackgroundColor(rgba)
|
||||
UI_CornerRadius(4.f)
|
||||
UI_PrefWidth(ui_em(6.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f))
|
||||
ui_build_box_from_string(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground, str8_lit(""));
|
||||
@@ -1212,7 +1212,6 @@ ui_scroll_list_item_from_row(UI_ScrollListRowBlockArray *blocks, U64 row)
|
||||
internal UI_ScrollPt
|
||||
ui_scroll_bar(Axis2 axis, UI_Size off_axis_size, UI_ScrollPt pt, Rng1S64 idx_range, S64 view_num_indices)
|
||||
{
|
||||
ui_push_palette(ui_state->widget_palette_info.scrollbar_palette);
|
||||
ui_push_tag(str8_lit("scroll_bar"));
|
||||
|
||||
//- rjf: unpack
|
||||
@@ -1334,7 +1333,6 @@ ui_scroll_bar(Axis2 axis, UI_Size off_axis_size, UI_ScrollPt pt, Rng1S64 idx_ran
|
||||
}
|
||||
|
||||
ui_pop_tag();
|
||||
ui_pop_palette();
|
||||
return new_pt;
|
||||
}
|
||||
|
||||
|
||||
+18
-35
@@ -782,7 +782,7 @@ ui_box_from_key(UI_Key key)
|
||||
//~ rjf: Top-Level Building API
|
||||
|
||||
internal void
|
||||
ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_Theme *theme, UI_WidgetPaletteInfo *widget_palette_info, UI_AnimationInfo *animation_info, F32 real_dt, F32 animation_dt)
|
||||
ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_Theme *theme, UI_AnimationInfo *animation_info, F32 real_dt, F32 animation_dt)
|
||||
{
|
||||
//- rjf: reset per-build ui state
|
||||
{
|
||||
@@ -862,7 +862,6 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
|
||||
{
|
||||
ui_state->icon_info.icon_kind_text_map[icon_kind] = push_str8_copy(ui_build_arena(), icon_info->icon_kind_text_map[icon_kind]);
|
||||
}
|
||||
MemoryCopyStruct(&ui_state->widget_palette_info, widget_palette_info);
|
||||
MemoryCopyStruct(&ui_state->animation_info, animation_info);
|
||||
}
|
||||
|
||||
@@ -1923,7 +1922,6 @@ ui_tooltip_begin_base(void)
|
||||
ui_push_parent(ui_state->tooltip_root);
|
||||
ui_push_flags(0);
|
||||
ui_push_text_raster_flags(ui_bottom_text_raster_flags());
|
||||
ui_push_palette(ui_bottom_palette());
|
||||
ui_push_tag(str8_lit("."));
|
||||
ui_push_tag(str8_lit("floating"));
|
||||
}
|
||||
@@ -1933,7 +1931,6 @@ ui_tooltip_end_base(void)
|
||||
{
|
||||
ui_pop_tag();
|
||||
ui_pop_tag();
|
||||
ui_pop_palette();
|
||||
ui_pop_text_raster_flags();
|
||||
ui_pop_flags();
|
||||
ui_pop_parent();
|
||||
@@ -1944,7 +1941,6 @@ internal void
|
||||
ui_tooltip_begin(void)
|
||||
{
|
||||
ui_tooltip_begin_base();
|
||||
ui_push_palette(ui_state->widget_palette_info.tooltip_palette);
|
||||
ui_set_next_squish(0.25f-ui_state->tooltip_open_t*0.25f);
|
||||
ui_set_next_transparency(1-ui_state->tooltip_open_t);
|
||||
UI_Flags(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_DrawDropShadow)
|
||||
@@ -1976,7 +1972,6 @@ ui_tooltip_end(void)
|
||||
ui_row_end();
|
||||
UI_PrefWidth(ui_px(0, 1)) ui_spacer(ui_em(1.f, 1.f));
|
||||
ui_column_end();
|
||||
ui_pop_palette();
|
||||
ui_tooltip_end_base();
|
||||
}
|
||||
|
||||
@@ -2014,7 +2009,6 @@ ui_begin_ctx_menu(UI_Key key)
|
||||
ui_push_pref_height(ui_bottom_pref_height());
|
||||
ui_push_focus_hot(UI_FocusKind_Root);
|
||||
ui_push_focus_active(UI_FocusKind_Root);
|
||||
ui_push_palette(ui_state->widget_palette_info.ctx_menu_palette);
|
||||
ui_push_tag(str8_lit("."));
|
||||
B32 is_open = ui_key_match(key, ui_state->ctx_menu_key) && ui_state->ctx_menu_open;
|
||||
if(is_open != 0) UI_TagF("floating")
|
||||
@@ -2029,7 +2023,6 @@ ui_begin_ctx_menu(UI_Key key)
|
||||
ui_state->ctx_menu_root->flags |= UI_BoxFlag_Clickable;
|
||||
ui_state->ctx_menu_root->corner_radii[Corner_00] = ui_state->ctx_menu_root->corner_radii[Corner_01] = ui_state->ctx_menu_root->corner_radii[Corner_10] = ui_state->ctx_menu_root->corner_radii[Corner_11] = ui_top_font_size()*0.25f;
|
||||
ui_state->ctx_menu_root->tags_key = ui_top_tags_key();
|
||||
ui_state->ctx_menu_root->palette = ui_top_palette();
|
||||
ui_state->ctx_menu_root->blur_size = ui_top_blur_size();
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
@@ -2046,7 +2039,6 @@ ui_end_ctx_menu(void)
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
ui_pop_tag();
|
||||
ui_pop_palette();
|
||||
ui_pop_focus_active();
|
||||
ui_pop_focus_hot();
|
||||
ui_pop_pref_width();
|
||||
@@ -2180,29 +2172,6 @@ ui_set_auto_focus_hot_key(UI_Key key)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: palette forming
|
||||
|
||||
internal UI_Palette *
|
||||
ui_build_palette_(UI_Palette *base, UI_Palette *overrides)
|
||||
{
|
||||
UI_Palette *palette = push_array(ui_build_arena(), UI_Palette, 1);
|
||||
if(base != 0)
|
||||
{
|
||||
MemoryCopyStruct(palette, base);
|
||||
}
|
||||
for EachEnumVal(UI_ColorCode, code)
|
||||
{
|
||||
if(overrides->colors[code].x != 0 ||
|
||||
overrides->colors[code].y != 0 ||
|
||||
overrides->colors[code].z != 0 ||
|
||||
overrides->colors[code].w != 0)
|
||||
{
|
||||
palette->colors[code] = overrides->colors[code];
|
||||
}
|
||||
}
|
||||
return palette;
|
||||
}
|
||||
|
||||
//- rjf: current style tags key
|
||||
|
||||
internal UI_Key
|
||||
@@ -2459,7 +2428,6 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
|
||||
box->text_align = ui_state->text_alignment_stack.top->v;
|
||||
box->child_layout_axis = ui_state->child_layout_axis_stack.top->v;
|
||||
box->palette = ui_state->palette_stack.top->v;
|
||||
box->font = ui_state->font_stack.top->v;
|
||||
box->font_size = ui_state->font_size_stack.top->v;
|
||||
box->tab_size = ui_state->tab_size_stack.top->v;
|
||||
@@ -2479,6 +2447,22 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
{
|
||||
box->tags_key = ui_state->tags_key_stack_top->key;
|
||||
}
|
||||
if(ui_state->background_color_stack.top != &ui_state->background_color_nil_stack_top)
|
||||
{
|
||||
box->background_color = ui_state->background_color_stack.top->v;
|
||||
}
|
||||
else
|
||||
{
|
||||
box->background_color = ui_color_from_name(str8_lit("background"));
|
||||
}
|
||||
if(ui_state->text_color_stack.top != &ui_state->text_color_nil_stack_top)
|
||||
{
|
||||
box->text_color = ui_state->text_color_stack.top->v;
|
||||
}
|
||||
else
|
||||
{
|
||||
box->text_color = ui_color_from_name(str8_lit("text"));
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: auto-pop all stacks
|
||||
@@ -2552,9 +2536,9 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
|
||||
ProfBeginFunction();
|
||||
box->string = push_str8_copy(ui_build_arena(), string);
|
||||
box->flags |= UI_BoxFlag_HasDisplayString;
|
||||
Vec4F32 text_color = box->text_color;
|
||||
if(box->flags & UI_BoxFlag_DrawText && (box->fastpath_codepoint == 0 || !(box->flags & UI_BoxFlag_DrawTextFastpathCodepoint)))
|
||||
{
|
||||
Vec4F32 text_color = ui_color_from_name(str8_lit("text"));
|
||||
String8 display_string = ui_box_display_string(box);
|
||||
DR_FStrNode fstr_n = {0, {display_string, {box->font, box->text_raster_flags, text_color, box->font_size, 0, 0}}};
|
||||
DR_FStrList fstrs = {&fstr_n, &fstr_n, 1};
|
||||
@@ -2564,7 +2548,6 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
|
||||
else if(box->flags & UI_BoxFlag_DrawText && box->flags & UI_BoxFlag_DrawTextFastpathCodepoint && box->fastpath_codepoint != 0)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
Vec4F32 text_color = ui_color_from_name(str8_lit("text"));
|
||||
String8 display_string = ui_box_display_string(box);
|
||||
String32 fpcp32 = str32(&box->fastpath_codepoint, 1);
|
||||
String8 fpcp = str8_from_32(scratch.arena, fpcp32);
|
||||
|
||||
+20
-73
@@ -233,61 +233,6 @@ struct UI_Theme
|
||||
U64 patterns_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Palettes
|
||||
|
||||
typedef enum UI_ColorCode
|
||||
{
|
||||
UI_ColorCode_Null,
|
||||
UI_ColorCode_Background,
|
||||
UI_ColorCode_BackgroundAlt,
|
||||
UI_ColorCode_BackgroundGood,
|
||||
UI_ColorCode_BackgroundBad,
|
||||
UI_ColorCode_BackgroundPop,
|
||||
UI_ColorCode_Border,
|
||||
UI_ColorCode_Text,
|
||||
UI_ColorCode_TextWeak,
|
||||
UI_ColorCode_Hover,
|
||||
UI_ColorCode_Focus,
|
||||
UI_ColorCode_Cursor,
|
||||
UI_ColorCode_Selection,
|
||||
UI_ColorCode_COUNT
|
||||
}
|
||||
UI_ColorCode;
|
||||
|
||||
typedef struct UI_Palette UI_Palette;
|
||||
struct UI_Palette
|
||||
{
|
||||
union
|
||||
{
|
||||
Vec4F32 colors[UI_ColorCode_COUNT];
|
||||
struct
|
||||
{
|
||||
Vec4F32 null;
|
||||
Vec4F32 background;
|
||||
Vec4F32 background_alt;
|
||||
Vec4F32 background_good;
|
||||
Vec4F32 background_bad;
|
||||
Vec4F32 background_pop;
|
||||
Vec4F32 border;
|
||||
Vec4F32 text;
|
||||
Vec4F32 text_weak;
|
||||
Vec4F32 hover;
|
||||
Vec4F32 focus;
|
||||
Vec4F32 cursor;
|
||||
Vec4F32 selection;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct UI_WidgetPaletteInfo UI_WidgetPaletteInfo;
|
||||
struct UI_WidgetPaletteInfo
|
||||
{
|
||||
UI_Palette *tooltip_palette;
|
||||
UI_Palette *ctx_menu_palette;
|
||||
UI_Palette *scrollbar_palette;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Animation Info
|
||||
|
||||
@@ -449,7 +394,8 @@ struct UI_Box
|
||||
DR_Bucket *draw_bucket;
|
||||
UI_BoxCustomDrawFunctionType *custom_draw;
|
||||
void *custom_draw_user_data;
|
||||
UI_Palette *palette;
|
||||
Vec4F32 background_color;
|
||||
Vec4F32 text_color;
|
||||
FNT_Tag font;
|
||||
F32 font_size;
|
||||
F32 tab_size;
|
||||
@@ -744,7 +690,6 @@ struct UI_State
|
||||
//- rjf: build parameters
|
||||
UI_IconInfo icon_info;
|
||||
UI_Theme *theme;
|
||||
UI_WidgetPaletteInfo widget_palette_info;
|
||||
UI_AnimationInfo animation_info;
|
||||
OS_Handle window;
|
||||
UI_EventList *events;
|
||||
@@ -827,11 +772,6 @@ internal UI_Size ui_size(UI_SizeKind kind, F32 value, F32 strictness);
|
||||
#define ui_pct(value, strictness) ui_size(UI_SizeKind_ParentPct, value, strictness)
|
||||
#define ui_children_sum(strictness) ui_size(UI_SizeKind_ChildrenSum, 0.f, strictness)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Color Scheme Type Functions
|
||||
|
||||
read_only global UI_Palette ui_g_nil_palette = {0};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scroll Point Type Functions
|
||||
|
||||
@@ -915,7 +855,7 @@ internal UI_Box * ui_box_from_key(UI_Key key);
|
||||
////////////////////////////////
|
||||
//~ rjf: Top-Level Building API
|
||||
|
||||
internal void ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_Theme *theme, UI_WidgetPaletteInfo *widget_palette_info, UI_AnimationInfo *animation_info, F32 real_dt, F32 animation_dt);
|
||||
internal void ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_Theme *theme, UI_AnimationInfo *animation_info, F32 real_dt, F32 animation_dt);
|
||||
internal void ui_end_build(void);
|
||||
internal void ui_calc_sizes_standalone__in_place_rec(UI_Box *root, Axis2 axis);
|
||||
internal void ui_calc_sizes_upwards_dependent__in_place_rec(UI_Box *root, Axis2 axis);
|
||||
@@ -954,10 +894,6 @@ internal B32 ui_is_key_auto_focus_hot(UI_Key key);
|
||||
internal void ui_set_auto_focus_active_key(UI_Key key);
|
||||
internal void ui_set_auto_focus_hot_key(UI_Key key);
|
||||
|
||||
//- rjf: palette forming
|
||||
internal UI_Palette * ui_build_palette_(UI_Palette *base, UI_Palette *overrides);
|
||||
#define ui_build_palette(base, ...) ui_build_palette_((base), &(UI_Palette){.text = v4f32(0, 0, 0, 0), __VA_ARGS__})
|
||||
|
||||
//- rjf: current style tags key
|
||||
internal UI_Key ui_top_tags_key(void);
|
||||
|
||||
@@ -1014,13 +950,15 @@ internal UI_Size ui_top_pref_width(void);
|
||||
internal UI_Size ui_top_pref_height(void);
|
||||
internal UI_PermissionFlags ui_top_permission_flags(void);
|
||||
internal UI_BoxFlags ui_top_flags(void);
|
||||
internal UI_BoxFlags ui_top_omit_flags(void);
|
||||
internal UI_FocusKind ui_top_focus_hot(void);
|
||||
internal UI_FocusKind ui_top_focus_active(void);
|
||||
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 Vec4F32 ui_top_background_color(void);
|
||||
internal Vec4F32 ui_top_text_color(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal FNT_Tag ui_top_font(void);
|
||||
@@ -1044,13 +982,15 @@ internal UI_Size ui_bottom_pref_width(void);
|
||||
internal UI_Size ui_bottom_pref_height(void);
|
||||
internal UI_PermissionFlags ui_bottom_permission_flags(void);
|
||||
internal UI_BoxFlags ui_bottom_flags(void);
|
||||
internal UI_BoxFlags ui_bottom_omit_flags(void);
|
||||
internal UI_FocusKind ui_bottom_focus_hot(void);
|
||||
internal UI_FocusKind ui_bottom_focus_active(void);
|
||||
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 Vec4F32 ui_bottom_background_color(void);
|
||||
internal Vec4F32 ui_bottom_text_color(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal FNT_Tag ui_bottom_font(void);
|
||||
@@ -1074,13 +1014,15 @@ internal UI_Size ui_push_pref_width(UI_Size v);
|
||||
internal UI_Size ui_push_pref_height(UI_Size v);
|
||||
internal UI_PermissionFlags ui_push_permission_flags(UI_PermissionFlags v);
|
||||
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v);
|
||||
internal UI_BoxFlags ui_push_omit_flags(UI_BoxFlags v);
|
||||
internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v);
|
||||
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 Vec4F32 ui_push_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 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);
|
||||
@@ -1104,13 +1046,15 @@ internal UI_Size ui_pop_pref_width(void);
|
||||
internal UI_Size ui_pop_pref_height(void);
|
||||
internal UI_PermissionFlags ui_pop_permission_flags(void);
|
||||
internal UI_BoxFlags ui_pop_flags(void);
|
||||
internal UI_BoxFlags ui_pop_omit_flags(void);
|
||||
internal UI_FocusKind ui_pop_focus_hot(void);
|
||||
internal UI_FocusKind ui_pop_focus_active(void);
|
||||
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 Vec4F32 ui_pop_background_color(void);
|
||||
internal Vec4F32 ui_pop_text_color(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal FNT_Tag ui_pop_font(void);
|
||||
@@ -1134,13 +1078,15 @@ internal UI_Size ui_set_next_pref_width(UI_Size v);
|
||||
internal UI_Size ui_set_next_pref_height(UI_Size v);
|
||||
internal UI_PermissionFlags ui_set_next_permission_flags(UI_PermissionFlags v);
|
||||
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v);
|
||||
internal UI_BoxFlags ui_set_next_omit_flags(UI_BoxFlags v);
|
||||
internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v);
|
||||
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 Vec4F32 ui_set_next_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 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);
|
||||
@@ -1186,8 +1132,9 @@ internal void ui_push_tagf(char *fmt, ...);
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#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_BackgroundColor(v) DeferLoop(ui_push_background_color(v), ui_pop_background_color())
|
||||
#define UI_TextColor(v) DeferLoop(ui_push_text_color(v), ui_pop_text_color())
|
||||
#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())
|
||||
|
||||
Reference in New Issue
Block a user