initial upload

This commit is contained in:
Ryan Fleury
2024-01-10 19:53:18 -08:00
commit a42ec6aeff
308 changed files with 162362 additions and 0 deletions
+135
View File
@@ -0,0 +1,135 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
//- GENERATED CODE
internal UI_Box * ui_push_parent(UI_Box * v) {return UI_StackPush(parent, v);}
internal Axis2 ui_push_child_layout_axis(Axis2 v) {return UI_StackPush(child_layout_axis, v);}
internal F32 ui_push_fixed_x(F32 v) {return UI_StackPush(fixed_x, v);}
internal F32 ui_push_fixed_y(F32 v) {return UI_StackPush(fixed_y, v);}
internal F32 ui_push_fixed_width(F32 v) {return UI_StackPush(fixed_width, v);}
internal F32 ui_push_fixed_height(F32 v) {return UI_StackPush(fixed_height, v);}
internal UI_Size ui_push_pref_width(UI_Size v) {return UI_StackPush(pref_width, v);}
internal UI_Size ui_push_pref_height(UI_Size v) {return UI_StackPush(pref_height, v);}
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v) {return UI_StackPush(flags, v);}
internal U32 ui_push_fastpath_codepoint(U32 v) {return UI_StackPush(fastpath_codepoint, v);}
internal Vec4F32 ui_push_background_color(Vec4F32 v) {return UI_StackPush(background_color, v);}
internal Vec4F32 ui_push_text_color(Vec4F32 v) {return UI_StackPush(text_color, v);}
internal Vec4F32 ui_push_border_color(Vec4F32 v) {return UI_StackPush(border_color, v);}
internal Vec4F32 ui_push_overlay_color(Vec4F32 v) {return UI_StackPush(overlay_color, v);}
internal Vec4F32 ui_push_text_select_color(Vec4F32 v) {return UI_StackPush(text_select_color, v);}
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v) {return UI_StackPush(text_cursor_color, v);}
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v) {return UI_StackPush(hover_cursor, v);}
internal F_Tag ui_push_font(F_Tag v) {return UI_StackPush(font, v);}
internal F32 ui_push_font_size(F32 v) {return UI_StackPush(font_size, v);}
internal F32 ui_push_corner_radius_00(F32 v) {return UI_StackPush(corner_radius_00, v);}
internal F32 ui_push_corner_radius_01(F32 v) {return UI_StackPush(corner_radius_01, v);}
internal F32 ui_push_corner_radius_10(F32 v) {return UI_StackPush(corner_radius_10, v);}
internal F32 ui_push_corner_radius_11(F32 v) {return UI_StackPush(corner_radius_11, v);}
internal F32 ui_push_blur_size(F32 v) {return UI_StackPush(blur_size, v);}
internal F32 ui_push_text_padding(F32 v) {return UI_StackPush(text_padding, v);}
internal UI_TextAlign ui_push_text_alignment(UI_TextAlign v) {return UI_StackPush(text_alignment, v);}
internal UI_Box * ui_pop_parent(void) {UI_Box * popped; return UI_StackPop(parent, popped);}
internal Axis2 ui_pop_child_layout_axis(void) {Axis2 popped; return UI_StackPop(child_layout_axis, popped);}
internal F32 ui_pop_fixed_x(void) {F32 popped; return UI_StackPop(fixed_x, popped);}
internal F32 ui_pop_fixed_y(void) {F32 popped; return UI_StackPop(fixed_y, popped);}
internal F32 ui_pop_fixed_width(void) {F32 popped; return UI_StackPop(fixed_width, popped);}
internal F32 ui_pop_fixed_height(void) {F32 popped; return UI_StackPop(fixed_height, popped);}
internal UI_Size ui_pop_pref_width(void) {UI_Size popped; return UI_StackPop(pref_width, popped);}
internal UI_Size ui_pop_pref_height(void) {UI_Size popped; return UI_StackPop(pref_height, popped);}
internal UI_BoxFlags ui_pop_flags(void) {UI_BoxFlags popped; return UI_StackPop(flags, popped);}
internal U32 ui_pop_fastpath_codepoint(void) {U32 popped; return UI_StackPop(fastpath_codepoint, popped);}
internal Vec4F32 ui_pop_background_color(void) {Vec4F32 popped; return UI_StackPop(background_color, popped);}
internal Vec4F32 ui_pop_text_color(void) {Vec4F32 popped; return UI_StackPop(text_color, popped);}
internal Vec4F32 ui_pop_border_color(void) {Vec4F32 popped; return UI_StackPop(border_color, popped);}
internal Vec4F32 ui_pop_overlay_color(void) {Vec4F32 popped; return UI_StackPop(overlay_color, popped);}
internal Vec4F32 ui_pop_text_select_color(void) {Vec4F32 popped; return UI_StackPop(text_select_color, popped);}
internal Vec4F32 ui_pop_text_cursor_color(void) {Vec4F32 popped; return UI_StackPop(text_cursor_color, popped);}
internal OS_Cursor ui_pop_hover_cursor(void) {OS_Cursor popped; return UI_StackPop(hover_cursor, popped);}
internal F_Tag ui_pop_font(void) {F_Tag popped; return UI_StackPop(font, popped);}
internal F32 ui_pop_font_size(void) {F32 popped; return UI_StackPop(font_size, popped);}
internal F32 ui_pop_corner_radius_00(void) {F32 popped; return UI_StackPop(corner_radius_00, popped);}
internal F32 ui_pop_corner_radius_01(void) {F32 popped; return UI_StackPop(corner_radius_01, popped);}
internal F32 ui_pop_corner_radius_10(void) {F32 popped; return UI_StackPop(corner_radius_10, popped);}
internal F32 ui_pop_corner_radius_11(void) {F32 popped; return UI_StackPop(corner_radius_11, popped);}
internal F32 ui_pop_blur_size(void) {F32 popped; return UI_StackPop(blur_size, popped);}
internal F32 ui_pop_text_padding(void) {F32 popped; return UI_StackPop(text_padding, popped);}
internal UI_TextAlign ui_pop_text_alignment(void) {UI_TextAlign popped; return UI_StackPop(text_alignment, popped);}
internal UI_Box * ui_top_parent(void) {return UI_StackTop(parent);}
internal Axis2 ui_top_child_layout_axis(void) {return UI_StackTop(child_layout_axis);}
internal F32 ui_top_fixed_x(void) {return UI_StackTop(fixed_x);}
internal F32 ui_top_fixed_y(void) {return UI_StackTop(fixed_y);}
internal F32 ui_top_fixed_width(void) {return UI_StackTop(fixed_width);}
internal F32 ui_top_fixed_height(void) {return UI_StackTop(fixed_height);}
internal UI_Size ui_top_pref_width(void) {return UI_StackTop(pref_width);}
internal UI_Size ui_top_pref_height(void) {return UI_StackTop(pref_height);}
internal UI_BoxFlags ui_top_flags(void) {return UI_StackTop(flags);}
internal U32 ui_top_fastpath_codepoint(void) {return UI_StackTop(fastpath_codepoint);}
internal Vec4F32 ui_top_background_color(void) {return UI_StackTop(background_color);}
internal Vec4F32 ui_top_text_color(void) {return UI_StackTop(text_color);}
internal Vec4F32 ui_top_border_color(void) {return UI_StackTop(border_color);}
internal Vec4F32 ui_top_overlay_color(void) {return UI_StackTop(overlay_color);}
internal Vec4F32 ui_top_text_select_color(void) {return UI_StackTop(text_select_color);}
internal Vec4F32 ui_top_text_cursor_color(void) {return UI_StackTop(text_cursor_color);}
internal OS_Cursor ui_top_hover_cursor(void) {return UI_StackTop(hover_cursor);}
internal F_Tag ui_top_font(void) {return UI_StackTop(font);}
internal F32 ui_top_font_size(void) {return UI_StackTop(font_size);}
internal F32 ui_top_corner_radius_00(void) {return UI_StackTop(corner_radius_00);}
internal F32 ui_top_corner_radius_01(void) {return UI_StackTop(corner_radius_01);}
internal F32 ui_top_corner_radius_10(void) {return UI_StackTop(corner_radius_10);}
internal F32 ui_top_corner_radius_11(void) {return UI_StackTop(corner_radius_11);}
internal F32 ui_top_blur_size(void) {return UI_StackTop(blur_size);}
internal F32 ui_top_text_padding(void) {return UI_StackTop(text_padding);}
internal UI_TextAlign ui_top_text_alignment(void) {return UI_StackTop(text_alignment);}
internal UI_Box * ui_bottom_parent(void) {return UI_StackBottom(parent);}
internal Axis2 ui_bottom_child_layout_axis(void) {return UI_StackBottom(child_layout_axis);}
internal F32 ui_bottom_fixed_x(void) {return UI_StackBottom(fixed_x);}
internal F32 ui_bottom_fixed_y(void) {return UI_StackBottom(fixed_y);}
internal F32 ui_bottom_fixed_width(void) {return UI_StackBottom(fixed_width);}
internal F32 ui_bottom_fixed_height(void) {return UI_StackBottom(fixed_height);}
internal UI_Size ui_bottom_pref_width(void) {return UI_StackBottom(pref_width);}
internal UI_Size ui_bottom_pref_height(void) {return UI_StackBottom(pref_height);}
internal UI_BoxFlags ui_bottom_flags(void) {return UI_StackBottom(flags);}
internal U32 ui_bottom_fastpath_codepoint(void) {return UI_StackBottom(fastpath_codepoint);}
internal Vec4F32 ui_bottom_background_color(void) {return UI_StackBottom(background_color);}
internal Vec4F32 ui_bottom_text_color(void) {return UI_StackBottom(text_color);}
internal Vec4F32 ui_bottom_border_color(void) {return UI_StackBottom(border_color);}
internal Vec4F32 ui_bottom_overlay_color(void) {return UI_StackBottom(overlay_color);}
internal Vec4F32 ui_bottom_text_select_color(void) {return UI_StackBottom(text_select_color);}
internal Vec4F32 ui_bottom_text_cursor_color(void) {return UI_StackBottom(text_cursor_color);}
internal OS_Cursor ui_bottom_hover_cursor(void) {return UI_StackBottom(hover_cursor);}
internal F_Tag ui_bottom_font(void) {return UI_StackBottom(font);}
internal F32 ui_bottom_font_size(void) {return UI_StackBottom(font_size);}
internal F32 ui_bottom_corner_radius_00(void) {return UI_StackBottom(corner_radius_00);}
internal F32 ui_bottom_corner_radius_01(void) {return UI_StackBottom(corner_radius_01);}
internal F32 ui_bottom_corner_radius_10(void) {return UI_StackBottom(corner_radius_10);}
internal F32 ui_bottom_corner_radius_11(void) {return UI_StackBottom(corner_radius_11);}
internal F32 ui_bottom_blur_size(void) {return UI_StackBottom(blur_size);}
internal F32 ui_bottom_text_padding(void) {return UI_StackBottom(text_padding);}
internal UI_TextAlign ui_bottom_text_alignment(void) {return UI_StackBottom(text_alignment);}
internal UI_Box * ui_set_next_parent(UI_Box * v) {return UI_StackSetNext(parent, v);}
internal Axis2 ui_set_next_child_layout_axis(Axis2 v) {return UI_StackSetNext(child_layout_axis, v);}
internal F32 ui_set_next_fixed_x(F32 v) {return UI_StackSetNext(fixed_x, v);}
internal F32 ui_set_next_fixed_y(F32 v) {return UI_StackSetNext(fixed_y, v);}
internal F32 ui_set_next_fixed_width(F32 v) {return UI_StackSetNext(fixed_width, v);}
internal F32 ui_set_next_fixed_height(F32 v) {return UI_StackSetNext(fixed_height, v);}
internal UI_Size ui_set_next_pref_width(UI_Size v) {return UI_StackSetNext(pref_width, v);}
internal UI_Size ui_set_next_pref_height(UI_Size v) {return UI_StackSetNext(pref_height, v);}
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v) {return UI_StackSetNext(flags, v);}
internal U32 ui_set_next_fastpath_codepoint(U32 v) {return UI_StackSetNext(fastpath_codepoint, v);}
internal Vec4F32 ui_set_next_background_color(Vec4F32 v) {return UI_StackSetNext(background_color, v);}
internal Vec4F32 ui_set_next_text_color(Vec4F32 v) {return UI_StackSetNext(text_color, v);}
internal Vec4F32 ui_set_next_border_color(Vec4F32 v) {return UI_StackSetNext(border_color, v);}
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v) {return UI_StackSetNext(overlay_color, v);}
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v) {return UI_StackSetNext(text_select_color, v);}
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v) {return UI_StackSetNext(text_cursor_color, v);}
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v) {return UI_StackSetNext(hover_cursor, v);}
internal F_Tag ui_set_next_font(F_Tag v) {return UI_StackSetNext(font, v);}
internal F32 ui_set_next_font_size(F32 v) {return UI_StackSetNext(font_size, v);}
internal F32 ui_set_next_corner_radius_00(F32 v) {return UI_StackSetNext(corner_radius_00, v);}
internal F32 ui_set_next_corner_radius_01(F32 v) {return UI_StackSetNext(corner_radius_01, v);}
internal F32 ui_set_next_corner_radius_10(F32 v) {return UI_StackSetNext(corner_radius_10, v);}
internal F32 ui_set_next_corner_radius_11(F32 v) {return UI_StackSetNext(corner_radius_11, v);}
internal F32 ui_set_next_blur_size(F32 v) {return UI_StackSetNext(blur_size, v);}
internal F32 ui_set_next_text_padding(F32 v) {return UI_StackSetNext(text_padding, v);}
internal UI_TextAlign ui_set_next_text_alignment(UI_TextAlign v) {return UI_StackSetNext(text_alignment, v);}
+252
View File
@@ -0,0 +1,252 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
//- GENERATED CODE
#ifndef UI_META_H
#define UI_META_H
#define UI_StackDecls struct{\
struct { UI_Box * active; UI_Box * v[64]; U64 count; B32 auto_pop; } parent;\
struct { Axis2 active; Axis2 v[64]; U64 count; B32 auto_pop; } child_layout_axis;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } fixed_x;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } fixed_y;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } fixed_width;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } fixed_height;\
struct { UI_Size active; UI_Size v[64]; U64 count; B32 auto_pop; } pref_width;\
struct { UI_Size active; UI_Size v[64]; U64 count; B32 auto_pop; } pref_height;\
struct { UI_BoxFlags active; UI_BoxFlags v[64]; U64 count; B32 auto_pop; } flags;\
struct { U32 active; U32 v[64]; U64 count; B32 auto_pop; } fastpath_codepoint;\
struct { Vec4F32 active; Vec4F32 v[64]; U64 count; B32 auto_pop; } background_color;\
struct { Vec4F32 active; Vec4F32 v[64]; U64 count; B32 auto_pop; } text_color;\
struct { Vec4F32 active; Vec4F32 v[64]; U64 count; B32 auto_pop; } border_color;\
struct { Vec4F32 active; Vec4F32 v[64]; U64 count; B32 auto_pop; } overlay_color;\
struct { Vec4F32 active; Vec4F32 v[64]; U64 count; B32 auto_pop; } text_select_color;\
struct { Vec4F32 active; Vec4F32 v[64]; U64 count; B32 auto_pop; } text_cursor_color;\
struct { OS_Cursor active; OS_Cursor v[64]; U64 count; B32 auto_pop; } hover_cursor;\
struct { F_Tag active; F_Tag v[64]; U64 count; B32 auto_pop; } font;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } font_size;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } corner_radius_00;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } corner_radius_01;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } corner_radius_10;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } corner_radius_11;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } blur_size;\
struct { F32 active; F32 v[64]; U64 count; B32 auto_pop; } text_padding;\
struct { UI_TextAlign active; UI_TextAlign v[64]; U64 count; B32 auto_pop; } text_alignment;\
}
#define UI_ZeroAllStacks(ui_state) do{\
MemoryZeroStruct(&ui_state->parent);\
MemoryZeroStruct(&ui_state->child_layout_axis);\
MemoryZeroStruct(&ui_state->fixed_x);\
MemoryZeroStruct(&ui_state->fixed_y);\
MemoryZeroStruct(&ui_state->fixed_width);\
MemoryZeroStruct(&ui_state->fixed_height);\
MemoryZeroStruct(&ui_state->pref_width);\
MemoryZeroStruct(&ui_state->pref_height);\
MemoryZeroStruct(&ui_state->flags);\
MemoryZeroStruct(&ui_state->fastpath_codepoint);\
MemoryZeroStruct(&ui_state->background_color);\
MemoryZeroStruct(&ui_state->text_color);\
MemoryZeroStruct(&ui_state->border_color);\
MemoryZeroStruct(&ui_state->overlay_color);\
MemoryZeroStruct(&ui_state->text_select_color);\
MemoryZeroStruct(&ui_state->text_cursor_color);\
MemoryZeroStruct(&ui_state->hover_cursor);\
MemoryZeroStruct(&ui_state->font);\
MemoryZeroStruct(&ui_state->font_size);\
MemoryZeroStruct(&ui_state->corner_radius_00);\
MemoryZeroStruct(&ui_state->corner_radius_01);\
MemoryZeroStruct(&ui_state->corner_radius_10);\
MemoryZeroStruct(&ui_state->corner_radius_11);\
MemoryZeroStruct(&ui_state->blur_size);\
MemoryZeroStruct(&ui_state->text_padding);\
MemoryZeroStruct(&ui_state->text_alignment);\
} while(0)
#define UI_AutoPopAllStacks(ui_state) do{\
if(ui_state->parent.auto_pop) {ui_state->parent.auto_pop = 0; ui_pop_parent();}\
if(ui_state->child_layout_axis.auto_pop) {ui_state->child_layout_axis.auto_pop = 0; ui_pop_child_layout_axis();}\
if(ui_state->fixed_x.auto_pop) {ui_state->fixed_x.auto_pop = 0; ui_pop_fixed_x();}\
if(ui_state->fixed_y.auto_pop) {ui_state->fixed_y.auto_pop = 0; ui_pop_fixed_y();}\
if(ui_state->fixed_width.auto_pop) {ui_state->fixed_width.auto_pop = 0; ui_pop_fixed_width();}\
if(ui_state->fixed_height.auto_pop) {ui_state->fixed_height.auto_pop = 0; ui_pop_fixed_height();}\
if(ui_state->pref_width.auto_pop) {ui_state->pref_width.auto_pop = 0; ui_pop_pref_width();}\
if(ui_state->pref_height.auto_pop) {ui_state->pref_height.auto_pop = 0; ui_pop_pref_height();}\
if(ui_state->flags.auto_pop) {ui_state->flags.auto_pop = 0; ui_pop_flags();}\
if(ui_state->fastpath_codepoint.auto_pop) {ui_state->fastpath_codepoint.auto_pop = 0; ui_pop_fastpath_codepoint();}\
if(ui_state->background_color.auto_pop) {ui_state->background_color.auto_pop = 0; ui_pop_background_color();}\
if(ui_state->text_color.auto_pop) {ui_state->text_color.auto_pop = 0; ui_pop_text_color();}\
if(ui_state->border_color.auto_pop) {ui_state->border_color.auto_pop = 0; ui_pop_border_color();}\
if(ui_state->overlay_color.auto_pop) {ui_state->overlay_color.auto_pop = 0; ui_pop_overlay_color();}\
if(ui_state->text_select_color.auto_pop) {ui_state->text_select_color.auto_pop = 0; ui_pop_text_select_color();}\
if(ui_state->text_cursor_color.auto_pop) {ui_state->text_cursor_color.auto_pop = 0; ui_pop_text_cursor_color();}\
if(ui_state->hover_cursor.auto_pop) {ui_state->hover_cursor.auto_pop = 0; ui_pop_hover_cursor();}\
if(ui_state->font.auto_pop) {ui_state->font.auto_pop = 0; ui_pop_font();}\
if(ui_state->font_size.auto_pop) {ui_state->font_size.auto_pop = 0; ui_pop_font_size();}\
if(ui_state->corner_radius_00.auto_pop) {ui_state->corner_radius_00.auto_pop = 0; ui_pop_corner_radius_00();}\
if(ui_state->corner_radius_01.auto_pop) {ui_state->corner_radius_01.auto_pop = 0; ui_pop_corner_radius_01();}\
if(ui_state->corner_radius_10.auto_pop) {ui_state->corner_radius_10.auto_pop = 0; ui_pop_corner_radius_10();}\
if(ui_state->corner_radius_11.auto_pop) {ui_state->corner_radius_11.auto_pop = 0; ui_pop_corner_radius_11();}\
if(ui_state->blur_size.auto_pop) {ui_state->blur_size.auto_pop = 0; ui_pop_blur_size();}\
if(ui_state->text_padding.auto_pop) {ui_state->text_padding.auto_pop = 0; ui_pop_text_padding();}\
if(ui_state->text_alignment.auto_pop) {ui_state->text_alignment.auto_pop = 0; ui_pop_text_alignment();}\
} while(0)
internal UI_Box * ui_push_parent(UI_Box * v);
internal Axis2 ui_push_child_layout_axis(Axis2 v);
internal F32 ui_push_fixed_x(F32 v);
internal F32 ui_push_fixed_y(F32 v);
internal F32 ui_push_fixed_width(F32 v);
internal F32 ui_push_fixed_height(F32 v);
internal UI_Size ui_push_pref_width(UI_Size v);
internal UI_Size ui_push_pref_height(UI_Size v);
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v);
internal U32 ui_push_fastpath_codepoint(U32 v);
internal Vec4F32 ui_push_background_color(Vec4F32 v);
internal Vec4F32 ui_push_text_color(Vec4F32 v);
internal Vec4F32 ui_push_border_color(Vec4F32 v);
internal Vec4F32 ui_push_overlay_color(Vec4F32 v);
internal Vec4F32 ui_push_text_select_color(Vec4F32 v);
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v);
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
internal F_Tag ui_push_font(F_Tag v);
internal F32 ui_push_font_size(F32 v);
internal F32 ui_push_corner_radius_00(F32 v);
internal F32 ui_push_corner_radius_01(F32 v);
internal F32 ui_push_corner_radius_10(F32 v);
internal F32 ui_push_corner_radius_11(F32 v);
internal F32 ui_push_blur_size(F32 v);
internal F32 ui_push_text_padding(F32 v);
internal UI_TextAlign ui_push_text_alignment(UI_TextAlign v);
internal UI_Box * ui_pop_parent(void);
internal Axis2 ui_pop_child_layout_axis(void);
internal F32 ui_pop_fixed_x(void);
internal F32 ui_pop_fixed_y(void);
internal F32 ui_pop_fixed_width(void);
internal F32 ui_pop_fixed_height(void);
internal UI_Size ui_pop_pref_width(void);
internal UI_Size ui_pop_pref_height(void);
internal UI_BoxFlags ui_pop_flags(void);
internal U32 ui_pop_fastpath_codepoint(void);
internal Vec4F32 ui_pop_background_color(void);
internal Vec4F32 ui_pop_text_color(void);
internal Vec4F32 ui_pop_border_color(void);
internal Vec4F32 ui_pop_overlay_color(void);
internal Vec4F32 ui_pop_text_select_color(void);
internal Vec4F32 ui_pop_text_cursor_color(void);
internal OS_Cursor ui_pop_hover_cursor(void);
internal F_Tag ui_pop_font(void);
internal F32 ui_pop_font_size(void);
internal F32 ui_pop_corner_radius_00(void);
internal F32 ui_pop_corner_radius_01(void);
internal F32 ui_pop_corner_radius_10(void);
internal F32 ui_pop_corner_radius_11(void);
internal F32 ui_pop_blur_size(void);
internal F32 ui_pop_text_padding(void);
internal UI_TextAlign ui_pop_text_alignment(void);
internal UI_Box * ui_top_parent(void);
internal Axis2 ui_top_child_layout_axis(void);
internal F32 ui_top_fixed_x(void);
internal F32 ui_top_fixed_y(void);
internal F32 ui_top_fixed_width(void);
internal F32 ui_top_fixed_height(void);
internal UI_Size ui_top_pref_width(void);
internal UI_Size ui_top_pref_height(void);
internal UI_BoxFlags ui_top_flags(void);
internal U32 ui_top_fastpath_codepoint(void);
internal Vec4F32 ui_top_background_color(void);
internal Vec4F32 ui_top_text_color(void);
internal Vec4F32 ui_top_border_color(void);
internal Vec4F32 ui_top_overlay_color(void);
internal Vec4F32 ui_top_text_select_color(void);
internal Vec4F32 ui_top_text_cursor_color(void);
internal OS_Cursor ui_top_hover_cursor(void);
internal F_Tag ui_top_font(void);
internal F32 ui_top_font_size(void);
internal F32 ui_top_corner_radius_00(void);
internal F32 ui_top_corner_radius_01(void);
internal F32 ui_top_corner_radius_10(void);
internal F32 ui_top_corner_radius_11(void);
internal F32 ui_top_blur_size(void);
internal F32 ui_top_text_padding(void);
internal UI_TextAlign ui_top_text_alignment(void);
internal UI_Box * ui_bottom_parent(void);
internal Axis2 ui_bottom_child_layout_axis(void);
internal F32 ui_bottom_fixed_x(void);
internal F32 ui_bottom_fixed_y(void);
internal F32 ui_bottom_fixed_width(void);
internal F32 ui_bottom_fixed_height(void);
internal UI_Size ui_bottom_pref_width(void);
internal UI_Size ui_bottom_pref_height(void);
internal UI_BoxFlags ui_bottom_flags(void);
internal U32 ui_bottom_fastpath_codepoint(void);
internal Vec4F32 ui_bottom_background_color(void);
internal Vec4F32 ui_bottom_text_color(void);
internal Vec4F32 ui_bottom_border_color(void);
internal Vec4F32 ui_bottom_overlay_color(void);
internal Vec4F32 ui_bottom_text_select_color(void);
internal Vec4F32 ui_bottom_text_cursor_color(void);
internal OS_Cursor ui_bottom_hover_cursor(void);
internal F_Tag ui_bottom_font(void);
internal F32 ui_bottom_font_size(void);
internal F32 ui_bottom_corner_radius_00(void);
internal F32 ui_bottom_corner_radius_01(void);
internal F32 ui_bottom_corner_radius_10(void);
internal F32 ui_bottom_corner_radius_11(void);
internal F32 ui_bottom_blur_size(void);
internal F32 ui_bottom_text_padding(void);
internal UI_TextAlign ui_bottom_text_alignment(void);
internal UI_Box * ui_set_next_parent(UI_Box * v);
internal Axis2 ui_set_next_child_layout_axis(Axis2 v);
internal F32 ui_set_next_fixed_x(F32 v);
internal F32 ui_set_next_fixed_y(F32 v);
internal F32 ui_set_next_fixed_width(F32 v);
internal F32 ui_set_next_fixed_height(F32 v);
internal UI_Size ui_set_next_pref_width(UI_Size v);
internal UI_Size ui_set_next_pref_height(UI_Size v);
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v);
internal U32 ui_set_next_fastpath_codepoint(U32 v);
internal Vec4F32 ui_set_next_background_color(Vec4F32 v);
internal Vec4F32 ui_set_next_text_color(Vec4F32 v);
internal Vec4F32 ui_set_next_border_color(Vec4F32 v);
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v);
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v);
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v);
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
internal F_Tag ui_set_next_font(F_Tag v);
internal F32 ui_set_next_font_size(F32 v);
internal F32 ui_set_next_corner_radius_00(F32 v);
internal F32 ui_set_next_corner_radius_01(F32 v);
internal F32 ui_set_next_corner_radius_10(F32 v);
internal F32 ui_set_next_corner_radius_11(F32 v);
internal F32 ui_set_next_blur_size(F32 v);
internal F32 ui_set_next_text_padding(F32 v);
internal UI_TextAlign ui_set_next_text_alignment(UI_TextAlign v);
#if 0
#define UI_Parent(v) DeferLoop(ui_push_parent(v), ui_pop_parent())
#define UI_ChildLayoutAxis(v) DeferLoop(ui_push_child_layout_axis(v), ui_pop_child_layout_axis())
#define UI_FixedX(v) DeferLoop(ui_push_fixed_x(v), ui_pop_fixed_x())
#define UI_FixedY(v) DeferLoop(ui_push_fixed_y(v), ui_pop_fixed_y())
#define UI_FixedWidth(v) DeferLoop(ui_push_fixed_width(v), ui_pop_fixed_width())
#define UI_FixedHeight(v) DeferLoop(ui_push_fixed_height(v), ui_pop_fixed_height())
#define UI_PrefWidth(v) DeferLoop(ui_push_pref_width(v), ui_pop_pref_width())
#define UI_PrefHeight(v) DeferLoop(ui_push_pref_height(v), ui_pop_pref_height())
#define UI_Flags(v) DeferLoop(ui_push_flags(v), ui_pop_flags())
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
#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_BorderColor(v) DeferLoop(ui_push_border_color(v), ui_pop_border_color())
#define UI_OverlayColor(v) DeferLoop(ui_push_overlay_color(v), ui_pop_overlay_color())
#define UI_TextSelectColor(v) DeferLoop(ui_push_text_select_color(v), ui_pop_text_select_color())
#define UI_TextCursorColor(v) DeferLoop(ui_push_text_cursor_color(v), ui_pop_text_cursor_color())
#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())
#define UI_FontSize(v) DeferLoop(ui_push_font_size(v), ui_pop_font_size())
#define UI_CornerRadius00(v) DeferLoop(ui_push_corner_radius_00(v), ui_pop_corner_radius_00())
#define UI_CornerRadius01(v) DeferLoop(ui_push_corner_radius_01(v), ui_pop_corner_radius_01())
#define UI_CornerRadius10(v) DeferLoop(ui_push_corner_radius_10(v), ui_pop_corner_radius_10())
#define UI_CornerRadius11(v) DeferLoop(ui_push_corner_radius_11(v), ui_pop_corner_radius_11())
#define UI_BlurSize(v) DeferLoop(ui_push_blur_size(v), ui_pop_blur_size())
#define UI_TextPadding(v) DeferLoop(ui_push_text_padding(v), ui_pop_text_padding())
#define UI_TextAlignment(v) DeferLoop(ui_push_text_alignment(v), ui_pop_text_alignment())
#endif
#endif // UI_META_H
+114
View File
@@ -0,0 +1,114 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
@table(name, name_lower, type)
UI_StackTable:
{
//- rjf: parents
{ Parent parent `UI_Box *` }
//- rjf: layout params
{ ChildLayoutAxis child_layout_axis Axis2 }
//- rjf: size/position
{ FixedX fixed_x F32 }
{ FixedY fixed_y F32 }
{ FixedWidth fixed_width F32 }
{ FixedHeight fixed_height F32 }
{ PrefWidth pref_width UI_Size }
{ PrefHeight pref_height UI_Size }
//- rjf: flags
{ Flags flags UI_BoxFlags }
//- rjf: interaction
{ FastpathCodepoint fastpath_codepoint U32 }
//- rjf: colors
{ BackgroundColor background_color Vec4F32 }
{ TextColor text_color Vec4F32 }
{ BorderColor border_color Vec4F32 }
{ OverlayColor overlay_color Vec4F32 }
{ TextSelectColor text_select_color Vec4F32 }
{ TextCursorColor text_cursor_color Vec4F32 }
//- rjf: hover cursor
{ HoverCursor hover_cursor OS_Cursor }
//- rjf: font
{ Font font F_Tag }
{ FontSize font_size F32 }
//- rjf: corner radii
{ CornerRadius00 corner_radius_00 F32 }
{ CornerRadius01 corner_radius_01 F32 }
{ CornerRadius10 corner_radius_10 F32 }
{ CornerRadius11 corner_radius_11 F32 }
//- rjf: blur size
{ BlurSize blur_size F32 }
//- rjf: text parameters
{ TextPadding text_padding F32 }
{ TextAlignment text_alignment UI_TextAlign }
}
@table_gen
{
`#define UI_StackDecls struct{\\`;
@expand(UI_StackTable a)
`struct { $(a.type) active; $(a.type) v[64]; U64 count; B32 auto_pop; } $(a.name_lower);\\`;
`}`;
}
@table_gen
{
`#define UI_ZeroAllStacks(ui_state) do{\\`;
@expand(UI_StackTable a)
`MemoryZeroStruct(&ui_state->$(a.name_lower));\\`;
`} while(0)`;
}
@table_gen
{
`#define UI_AutoPopAllStacks(ui_state) do{\\`;
@expand(UI_StackTable a)
`if(ui_state->$(a.name_lower).auto_pop) {ui_state->$(a.name_lower).auto_pop = 0; ui_pop_$(a.name_lower)();}\\`;
`} while(0)`;
}
@table_gen
{
@expand(UI_StackTable a)
`internal $(a.type) $(=>35) ui_push_$(a.name_lower)($(a.type) v);`;
@expand(UI_StackTable a)
`internal $(a.type) $(=>35) ui_pop_$(a.name_lower)(void);`;
@expand(UI_StackTable a)
`internal $(a.type) $(=>35) ui_top_$(a.name_lower)(void);`;
@expand(UI_StackTable a)
`internal $(a.type) $(=>35) ui_bottom_$(a.name_lower)(void);`;
@expand(UI_StackTable a)
`internal $(a.type) $(=>35) ui_set_next_$(a.name_lower)($(a.type) v);`;
}
@table_gen
{
`#if 0`;
@expand(UI_StackTable a)
`#define UI_$(a.name)(v) $(=>35) DeferLoop(ui_push_$(a.name_lower)(v), ui_pop_$(a.name_lower)())`;
`#endif`;
}
@table_gen @c_file
{
@expand(UI_StackTable a)
`internal $(a.type) ui_push_$(a.name_lower)($(a.type) v) {return UI_StackPush($(a.name_lower), v);}`;
@expand(UI_StackTable a)
`internal $(a.type) ui_pop_$(a.name_lower)(void) {$(a.type) popped; return UI_StackPop($(a.name_lower), popped);}`;
@expand(UI_StackTable a)
`internal $(a.type) ui_top_$(a.name_lower)(void) {return UI_StackTop($(a.name_lower));}`;
@expand(UI_StackTable a)
`internal $(a.type) ui_bottom_$(a.name_lower)(void) {return UI_StackBottom($(a.name_lower));}`;
@expand(UI_StackTable a)
`internal $(a.type) ui_set_next_$(a.name_lower)($(a.type) v) {return UI_StackSetNext($(a.name_lower), v);}`;
}
File diff suppressed because it is too large Load Diff
+179
View File
@@ -0,0 +1,179 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef UI_BASIC_WIDGETS_H
#define UI_BASIC_WIDGETS_H
////////////////////////////////
//~ rjf: Scroll List Types
typedef U32 UI_ScrollListFlags;
enum
{
UI_ScrollListFlag_Nav = (1<<0),
UI_ScrollListFlag_Snap = (1<<1),
UI_ScrollListFlag_All = 0xffffffff,
};
typedef struct UI_ScrollListRowBlock UI_ScrollListRowBlock;
struct UI_ScrollListRowBlock
{
U64 row_count;
U64 item_count;
};
typedef struct UI_ScrollListRowBlockChunkNode UI_ScrollListRowBlockChunkNode;
struct UI_ScrollListRowBlockChunkNode
{
UI_ScrollListRowBlockChunkNode *next;
UI_ScrollListRowBlock *v;
U64 count;
U64 cap;
};
typedef struct UI_ScrollListRowBlockChunkList UI_ScrollListRowBlockChunkList;
struct UI_ScrollListRowBlockChunkList
{
UI_ScrollListRowBlockChunkNode *first;
UI_ScrollListRowBlockChunkNode *last;
U64 chunk_count;
U64 total_count;
};
typedef struct UI_ScrollListRowBlockArray UI_ScrollListRowBlockArray;
struct UI_ScrollListRowBlockArray
{
UI_ScrollListRowBlock *v;
U64 count;
};
typedef struct UI_ScrollListParams UI_ScrollListParams;
struct UI_ScrollListParams
{
UI_ScrollListFlags flags;
Vec2F32 dim_px;
F32 row_height_px;
UI_ScrollListRowBlockArray row_blocks;
Rng2S64 cursor_range;
Rng1S64 item_range;
B32 cursor_min_is_empty_selection[Axis2_COUNT];
};
typedef struct UI_ScrollListSignal UI_ScrollListSignal;
struct UI_ScrollListSignal
{
B32 cursor_moved;
};
////////////////////////////////
//~ rjf: Basic Widgets
internal UI_Signal ui_spacer(UI_Size size);
internal UI_Signal ui_label(String8 string);
internal UI_Signal ui_labelf(char *fmt, ...);
internal void ui_label_multiline(F32 max, String8 string);
internal void ui_label_multilinef(F32 max, char *fmt, ...);
internal UI_Signal ui_button(String8 string);
internal UI_Signal ui_buttonf(char *fmt, ...);
internal UI_Signal ui_hover_label(String8 string);
internal UI_Signal ui_hover_labelf(char *fmt, ...);
internal UI_Signal ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size, U64 *edit_string_size_out, String8 pre_edit_value, String8 string);
internal UI_Signal ui_line_editf(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size, U64 *edit_string_size_out, String8 pre_edit_value, char *fmt, ...);
////////////////////////////////
//~ rjf: Special Buttons
internal UI_Signal ui_close_button(String8 string);
internal UI_Signal ui_close_buttonf(char *fmt, ...);
internal UI_Signal ui_expander(B32 is_expanded, String8 string);
internal UI_Signal ui_expanderf(B32 is_expanded, char *fmt, ...);
internal UI_Signal ui_sort_header(B32 sorting, B32 ascending, String8 string);
internal UI_Signal ui_sort_headerf(B32 sorting, B32 ascending, char *fmt, ...);
////////////////////////////////
//~ rjf: Color Pickers
//- rjf: tooltips
internal void ui_do_color_tooltip_hsv(Vec3F32 hsv);
internal void ui_do_color_tooltip_hsva(Vec4F32 hsva);
//- rjf: saturation/value picker
internal UI_Signal ui_sat_val_picker(F32 hue, F32 *out_sat, F32 *out_val, String8 string);
internal UI_Signal ui_sat_val_pickerf(F32 hue, F32 *out_sat, F32 *out_val, char *fmt, ...);
//- rjf: hue picker
internal UI_Signal ui_hue_picker(F32 *out_hue, F32 sat, F32 val, String8 string);
internal UI_Signal ui_hue_pickerf(F32 *out_hue, F32 sat, F32 val, char *fmt, ...);
//- rjf: alpha picker
internal UI_Signal ui_alpha_picker(F32 *out_alpha, String8 string);
internal UI_Signal ui_alpha_pickerf(F32 *out_alpha, char *fmt, ...);
////////////////////////////////
//~ rjf: Simple Layout Widgets
internal UI_Signal ui_row_begin(void);
internal void ui_row_end(void);
internal UI_Signal ui_column_begin(void);
internal void ui_column_end(void);
internal UI_Signal ui_named_row_begin(String8 string);
internal void ui_named_row_end(void);
internal UI_Signal ui_named_column_begin(String8 string);
internal void ui_named_column_end(void);
////////////////////////////////
//~ rjf: Floating Panes
internal UI_Box *ui_pane_begin(Rng2F32 rect, String8 string);
internal UI_Box *ui_pane_beginf(Rng2F32 rect, char *fmt, ...);
internal void ui_pane_end(void);
////////////////////////////////
//~ rjf: Tables
internal void ui_table_begin(U64 column_pct_count, F32 **column_pcts, String8 string);
internal void ui_table_beginf(U64 column_pct_count, F32 **column_pcts, char *fmt, ...);
internal void ui_table_end(void);
internal UI_Box * ui_named_table_vector_begin(String8 string);
internal UI_Box * ui_named_table_vector_beginf(char *fmt, ...);
internal UI_Box * ui_table_vector_begin(void);
internal UI_Signal ui_table_vector_end(void);
internal UI_Box * ui_table_cell_begin(void);
internal UI_Signal ui_table_cell_end(void);
internal UI_Box * ui_table_cell_sized_begin(UI_Size size);
////////////////////////////////
//~ rjf: Scroll Regions
internal void ui_scroll_list_row_block_chunk_list_push(Arena *arena, UI_ScrollListRowBlockChunkList *list, U64 cap, UI_ScrollListRowBlock *block);
internal UI_ScrollListRowBlockArray ui_scroll_list_row_block_array_from_chunk_list(Arena *arena, UI_ScrollListRowBlockChunkList *list);
internal U64 ui_scroll_list_row_from_item(UI_ScrollListRowBlockArray *blocks, U64 item);
internal U64 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);
internal void ui_scroll_list_begin(UI_ScrollListParams *params, UI_ScrollPt *scroll_pt_out, Vec2S64 *cursor_out, Rng1S64 *visible_row_range_out, UI_ScrollListSignal *signal_out);
internal void ui_scroll_list_end(void);
////////////////////////////////
//~ rjf: Macro Loop Wrappers
#define UI_Row DeferLoop(ui_row_begin(), ui_row_end())
#define UI_Column DeferLoop(ui_column_begin(), ui_column_end())
#define UI_NamedRow(s) DeferLoop(ui_named_row_begin(s), ui_named_row_end())
#define UI_NamedColumn(s) DeferLoop(ui_named_column_begin(s), ui_named_column_end())
#define UI_Pane(r, s) DeferLoop(ui_pane_begin(r, s), ui_pane_end())
#define UI_PaneF(r, ...) DeferLoop(ui_pane_beginf(r, __VA_ARGS__), ui_pane_end())
#define UI_Padding(size) DeferLoop(ui_spacer(size), ui_spacer(size))
#define UI_Center UI_Padding(ui_pct(1, 0))
#define UI_Table(col_pct_count, col_pcts, s) DeferLoop(ui_table_begin(col_pct_count, col_pcts, s), ui_table_end())
#define UI_TableF(col_pct_count, col_pcts, ...) DeferLoop(ui_table_beginf(col_pct_count, col_pcts, __VA_ARGS__), ui_table_end())
#define UI_NamedTableVector(s) DeferLoop(ui_named_table_vector_begin(s), ui_table_vector_end())
#define UI_NamedTableVectorF(...) DeferLoop(ui_named_table_vector_beginf(__VA_ARGS__), ui_table_vector_end())
#define UI_TableVector DeferLoop(ui_table_vector_begin(), ui_table_vector_end())
#define UI_TableCell DeferLoop(ui_table_cell_begin(), ui_table_cell_end())
#define UI_TableCellSized(size) DeferLoop(ui_table_cell_sized_begin(size), ui_table_cell_end())
#define UI_ScrollList(params, scroll_pt_out, cursor_out, visible_row_range_out, signal_out) DeferLoop(ui_scroll_list_begin((params), (scroll_pt_out), (cursor_out), (visible_row_range_out), (signal_out)), ui_scroll_list_end())
#endif // UI_BASIC_WIDGETS_H
+2700
View File
File diff suppressed because it is too large Load Diff
+794
View File
@@ -0,0 +1,794 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef UI_H
#define UI_H
////////////////////////////////
//~ rjf: Icon Info
typedef enum UI_IconKind
{
UI_IconKind_Null,
UI_IconKind_RightArrow,
UI_IconKind_DownArrow,
UI_IconKind_LeftArrow,
UI_IconKind_UpArrow,
UI_IconKind_RightCaret,
UI_IconKind_DownCaret,
UI_IconKind_LeftCaret,
UI_IconKind_UpCaret,
UI_IconKind_CheckHollow,
UI_IconKind_CheckFilled,
UI_IconKind_COUNT
}
UI_IconKind;
typedef struct UI_IconInfo UI_IconInfo;
struct UI_IconInfo
{
F_Tag icon_font;
String8 icon_kind_text_map[UI_IconKind_COUNT];
};
////////////////////////////////
//~ rjf: Navigation Types
typedef enum UI_NavDeltaUnit
{
UI_NavDeltaUnit_Element,
UI_NavDeltaUnit_Chunk,
UI_NavDeltaUnit_Whole,
UI_NavDeltaUnit_EndPoint,
UI_NavDeltaUnit_COUNT,
}
UI_NavDeltaUnit;
typedef U32 UI_NavActionFlags;
enum
{
UI_NavActionFlag_KeepMark = (1<<0),
UI_NavActionFlag_Delete = (1<<1),
UI_NavActionFlag_Copy = (1<<2),
UI_NavActionFlag_Paste = (1<<3),
UI_NavActionFlag_ZeroDeltaOnSelect = (1<<4),
UI_NavActionFlag_PickSelectSide = (1<<5),
UI_NavActionFlag_CapAtLine = (1<<6),
UI_NavActionFlag_ExplicitDirectional = (1<<7),
UI_NavActionFlag_ReplaceAndCommit = (1<<8),
};
typedef struct UI_NavAction UI_NavAction;
struct UI_NavAction
{
UI_NavActionFlags flags;
Vec2S32 delta;
UI_NavDeltaUnit delta_unit;
String8 insertion;
};
typedef struct UI_NavActionNode UI_NavActionNode;
struct UI_NavActionNode
{
UI_NavActionNode *next;
UI_NavActionNode *prev;
UI_NavAction v;
};
typedef struct UI_NavActionList UI_NavActionList;
struct UI_NavActionList
{
UI_NavActionNode *first;
UI_NavActionNode *last;
U64 count;
};
typedef U32 UI_NavTxtOpFlags;
enum
{
UI_NavTxtOpFlag_Invalid = (1<<0),
UI_NavTxtOpFlag_Copy = (1<<1),
};
typedef struct UI_NavTxtOp UI_NavTxtOp;
struct UI_NavTxtOp
{
UI_NavTxtOpFlags flags;
String8 replace;
String8 copy;
TxtRng range;
TxtPt cursor;
TxtPt mark;
};
////////////////////////////////
//~ rjf: Keys
typedef struct UI_Key UI_Key;
struct UI_Key
{
U64 u64[1];
};
////////////////////////////////
//~ rjf: Sizes
typedef enum UI_SizeKind
{
UI_SizeKind_Null,
UI_SizeKind_Pixels, // size is computed via a preferred pixel value
UI_SizeKind_TextContent, // size is computed via the dimensions of box's rendered string
UI_SizeKind_ParentPct, // size is computed via a well-determined parent or grandparent size
UI_SizeKind_ChildrenSum, // size is computed via summing well-determined sizes of children
}
UI_SizeKind;
typedef struct UI_Size UI_Size;
struct UI_Size
{
UI_SizeKind kind;
F32 value;
F32 strictness;
};
////////////////////////////////
//~ rjf: Scroll Positions
typedef struct UI_ScrollPt UI_ScrollPt;
struct UI_ScrollPt
{
S64 idx;
F32 off;
};
typedef union UI_ScrollPt2 UI_ScrollPt2;
union UI_ScrollPt2
{
UI_ScrollPt v[2];
struct
{
UI_ScrollPt x;
UI_ScrollPt y;
};
};
////////////////////////////////
//~ rjf: Box Types
typedef enum UI_TextAlign
{
UI_TextAlign_Left,
UI_TextAlign_Center,
UI_TextAlign_Right,
UI_TextAlign_COUNT
}
UI_TextAlign;
struct UI_Box;
#define UI_BOX_CUSTOM_DRAW(name) void name(struct UI_Box *box, void *user_data)
typedef UI_BOX_CUSTOM_DRAW(UI_BoxCustomDrawFunctionType);
typedef U64 UI_BoxFlags;
//{
//- rjf: interaction
# define UI_BoxFlag_MouseClickable (UI_BoxFlags)(1ull<<0)
# define UI_BoxFlag_KeyboardClickable (UI_BoxFlags)(1ull<<1)
# define UI_BoxFlag_ClickToFocus (UI_BoxFlags)(1ull<<2)
# define UI_BoxFlag_Scroll (UI_BoxFlags)(1ull<<3)
# define UI_BoxFlag_ViewScroll (UI_BoxFlags)(1ull<<4)
# define UI_BoxFlag_ViewClamp (UI_BoxFlags)(1ull<<5)
# define UI_BoxFlag_FocusHot (UI_BoxFlags)(1ull<<6)
# define UI_BoxFlag_FocusActive (UI_BoxFlags)(1ull<<7)
# define UI_BoxFlag_FocusHotDisabled (UI_BoxFlags)(1ull<<8)
# define UI_BoxFlag_FocusActiveDisabled (UI_BoxFlags)(1ull<<9)
# define UI_BoxFlag_DefaultFocusNavX (UI_BoxFlags)(1ull<<10)
# define UI_BoxFlag_DefaultFocusNavY (UI_BoxFlags)(1ull<<11)
# define UI_BoxFlag_DefaultFocusEdit (UI_BoxFlags)(1ull<<12)
# define UI_BoxFlag_FocusNavSkip (UI_BoxFlags)(1ull<<13)
# define UI_BoxFlag_Disabled (UI_BoxFlags)(1ull<<14)
//- rjf: layout
# define UI_BoxFlag_FloatingX (UI_BoxFlags)(1ull<<15)
# define UI_BoxFlag_FloatingY (UI_BoxFlags)(1ull<<16)
# define UI_BoxFlag_FixedWidth (UI_BoxFlags)(1ull<<17)
# define UI_BoxFlag_FixedHeight (UI_BoxFlags)(1ull<<18)
# define UI_BoxFlag_AllowOverflowX (UI_BoxFlags)(1ull<<19)
# define UI_BoxFlag_AllowOverflowY (UI_BoxFlags)(1ull<<20)
# define UI_BoxFlag_SkipViewOffX (UI_BoxFlags)(1ull<<21)
# define UI_BoxFlag_SkipViewOffY (UI_BoxFlags)(1ull<<22)
//- rjf: appearance / animation
# define UI_BoxFlag_DrawDropShadow (UI_BoxFlags)(1ull<<23)
# define UI_BoxFlag_DrawBackgroundBlur (UI_BoxFlags)(1ull<<24)
# define UI_BoxFlag_DrawBackground (UI_BoxFlags)(1ull<<25)
# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<26)
# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<27)
# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<28)
# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<29)
# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<30)
# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<31)
# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<32)
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<33)
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<34)
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<35)
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<36)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<37)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<38)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<39)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<40)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<41)
# define UI_BoxFlag_DisableFocusViz (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_RequireFocusBackground (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<45)
//- rjf: bundles
# define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable)
# define UI_BoxFlag_DefaultFocusNav (UI_BoxFlag_DefaultFocusNavX|UI_BoxFlag_DefaultFocusNavY|UI_BoxFlag_DefaultFocusEdit)
# define UI_BoxFlag_Floating (UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY)
# define UI_BoxFlag_FixedSize (UI_BoxFlag_FixedWidth|UI_BoxFlag_FixedHeight)
# define UI_BoxFlag_AllowOverflow (UI_BoxFlag_AllowOverflowX|UI_BoxFlag_AllowOverflowY)
# define UI_BoxFlag_AnimatePos (UI_BoxFlag_AnimatePosX|UI_BoxFlag_AnimatePosY)
//}
typedef struct UI_Box UI_Box;
struct UI_Box
{
//- rjf: persistent links
UI_Box *hash_next;
UI_Box *hash_prev;
//- rjf: per-build links/data
UI_Box *first;
UI_Box *last;
UI_Box *next;
UI_Box *prev;
UI_Box *parent;
U64 child_count;
//- rjf: per-build equipment
UI_Key key;
UI_BoxFlags flags;
String8 string;
UI_TextAlign text_align;
Vec2F32 fixed_position;
Vec2F32 fixed_size;
UI_Size pref_size[Axis2_COUNT];
Axis2 child_layout_axis;
OS_Cursor hover_cursor;
U32 fastpath_codepoint;
D_Bucket *draw_bucket;
UI_BoxCustomDrawFunctionType *custom_draw;
void *custom_draw_user_data;
Vec4F32 background_color;
Vec4F32 text_color;
Vec4F32 border_color;
Vec4F32 overlay_color;
F_Tag font;
F32 font_size;
F32 corner_radii[Corner_COUNT];
F32 blur_size;
F32 text_padding;
//- rjf: per-build artifacts
D_FancyRunList display_string_runs;
Rng2F32 rect;
Vec2F32 fixed_position_animated;
Vec2F32 position_delta;
U64 num_focus_children;
//- rjf: persistent data
U64 first_touched_build_index;
U64 last_touched_build_index;
U64 first_disabled_build_index;
F32 hot_t;
F32 active_t;
F32 disabled_t;
F32 focus_hot_t;
F32 focus_active_t;
Vec2F32 view_off;
Vec2F32 view_off_target;
Vec2F32 view_bounds;
UI_Key default_nav_focus_hot_key;
UI_Key default_nav_focus_active_key;
UI_Key default_nav_focus_next_hot_key;
UI_Key default_nav_focus_next_active_key;
};
typedef struct UI_BoxRec UI_BoxRec;
struct UI_BoxRec
{
UI_Box *next;
S32 push_count;
S32 pop_count;
};
typedef struct UI_BoxNode UI_BoxNode;
struct UI_BoxNode
{
UI_BoxNode *next;
UI_Box *box;
};
typedef struct UI_BoxList UI_BoxList;
struct UI_BoxList
{
UI_BoxNode *first;
UI_BoxNode *last;
U64 count;
};
typedef struct UI_Signal UI_Signal;
struct UI_Signal
{
UI_Box *box;
OS_EventFlags event_flags;
Vec2S16 scroll;
B8 clicked :1;
B8 keyboard_clicked :1;
B8 double_clicked :1;
B8 right_clicked :1;
B8 pressed :1;
B8 released :1;
B8 dragging :1;
B8 hovering :1;
B8 mouse_over :1;
B8 commit :1;
};
typedef struct UI_Nav UI_Nav;
struct UI_Nav
{
B32 moved;
Vec2S64 new_p;
};
////////////////////////////////
//~ rjf: Generated Code
#include "generated/ui.meta.h"
////////////////////////////////
//~ rjf: State Types
typedef struct UI_BoxHashSlot UI_BoxHashSlot;
struct UI_BoxHashSlot
{
UI_Box *hash_first;
UI_Box *hash_last;
};
typedef struct UI_State UI_State;
struct UI_State
{
//- rjf: main arena
Arena *arena;
//- rjf: build arenas
Arena *build_arenas[2];
U64 build_index;
//- rjf: box cache
UI_Box *first_free_box;
U64 box_table_size;
UI_BoxHashSlot *box_table;
//- rjf: build phase output
UI_Box *root;
UI_Box *tooltip_root;
UI_Box *ctx_menu_root;
UI_Key default_nav_root_key;
U64 build_box_count;
U64 last_build_box_count;
B32 ctx_menu_touched_this_frame;
B32 is_animating;
//- rjf: build parameters
UI_IconInfo icon_info;
OS_Handle window;
OS_EventList *events;
UI_NavActionList *nav_actions;
Vec2F32 mouse;
F32 animation_dt;
B32 external_focus_commit;
//- rjf: user interaction state
UI_Key hot_box_key;
UI_Key active_box_key[Side_COUNT];
UI_Key clipboard_copy_key;
F32 time_since_last_click[Side_COUNT];
UI_Key last_click_key[Side_COUNT];
Vec2F32 drag_start_mouse;
Arena *drag_state_arena;
String8 drag_state_data;
//- rjf: context menu state
UI_Key ctx_menu_anchor_key;
UI_Key next_ctx_menu_anchor_key;
Vec2F32 ctx_menu_anchor_box_last_pos;
Vec2F32 ctx_menu_anchor_off;
B32 ctx_menu_open;
B32 next_ctx_menu_open;
F32 ctx_menu_open_t;
UI_Key ctx_menu_key;
//- rjf: build phase focus masks
B32 focus_hot_is_set;
B32 focus_hot_is_possible;
B32 focus_active_is_set;
B32 focus_active_is_possible;
//- rjf: build phase stacks
UI_StackDecls;
};
////////////////////////////////
//~ rjf: Basic Type Functions
internal U64 ui_hash_from_string(U64 seed, String8 string);
internal String8 ui_hash_part_from_key_string(String8 string);
internal String8 ui_display_part_from_key_string(String8 string);
internal UI_Key ui_key_zero(void);
internal UI_Key ui_key_make(U64 v);
internal UI_Key ui_key_from_string(UI_Key seed_key, String8 string);
internal UI_Key ui_key_from_stringf(UI_Key seed_key, char *fmt, ...);
internal B32 ui_key_match(UI_Key a, UI_Key b);
////////////////////////////////
//~ rjf: Navigation Action List Building & Consumption Functions
internal void ui_nav_action_list_push(Arena *arena, UI_NavActionList *list, UI_NavAction action);
internal void ui_nav_eat_action_node(UI_NavActionList *list, UI_NavActionNode *node);
////////////////////////////////
//~ rjf: High Level Navigation Action => Text Operations
internal B32 ui_nav_char_is_scan_boundary(U8 c);
internal S64 ui_nav_scanned_column_from_column(String8 string, S64 start_column, Side side);
internal UI_NavTxtOp ui_nav_single_line_txt_op_from_action(Arena *arena, UI_NavAction action, String8 line, TxtPt cursor, TxtPt mark);
////////////////////////////////
//~ rjf: Single-Line String Modification
internal String8 ui_nav_push_string_replace_range(Arena *arena, String8 string, Rng1S64 col_range, String8 replace);
////////////////////////////////
//~ rjf: Size Type Functions
internal UI_Size ui_size(UI_SizeKind kind, F32 value, F32 strictness);
#define ui_px(value, strictness) ui_size(UI_SizeKind_Pixels, value, strictness)
#define ui_em(value, strictness) ui_size(UI_SizeKind_Pixels, (value) * ui_top_font_size(), strictness)
#define ui_text_dim(padding, strictness) ui_size(UI_SizeKind_TextContent, padding, 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: Scroll Point Type Functions
internal UI_ScrollPt ui_scroll_pt(S64 idx, F32 off);
internal void ui_scroll_pt_target_idx(UI_ScrollPt *v, S64 idx);
internal void ui_scroll_pt_clamp_idx(UI_ScrollPt *v, Rng1S64 range);
////////////////////////////////
//~ rjf: Box Type Functions
read_only global UI_Box ui_g_nil_box =
{
&ui_g_nil_box,
&ui_g_nil_box,
&ui_g_nil_box,
&ui_g_nil_box,
&ui_g_nil_box,
&ui_g_nil_box,
&ui_g_nil_box,
};
internal B32 ui_box_is_nil(UI_Box *box);
internal UI_BoxRec ui_box_rec_df(UI_Box *box, UI_Box *root, U64 sib_member_off, U64 child_member_off);
#define ui_box_rec_df_pre(box, root) ui_box_rec_df(box, root, OffsetOf(UI_Box, next), OffsetOf(UI_Box, first))
#define ui_box_rec_df_post(box, root) ui_box_rec_df(box, root, OffsetOf(UI_Box, prev), OffsetOf(UI_Box, last))
internal void ui_box_list_push(Arena *arena, UI_BoxList *list, UI_Box *box);
////////////////////////////////
//~ rjf: State Allocating / Selection
internal UI_State *ui_state_alloc(void);
internal void ui_state_release(UI_State *state);
internal UI_Box * ui_root_from_state(UI_State *state);
internal B32 ui_animating_from_state(UI_State *state);
internal void ui_select_state(UI_State *state);
internal UI_State *ui_get_selected_state(void);
////////////////////////////////
//~ rjf: Implicit State Accessors/Mutators
//- rjf: per-frame info
internal Arena * ui_build_arena(void);
internal OS_Handle ui_window(void);
internal OS_EventList * ui_events(void);
internal UI_NavActionList *ui_nav_actions(void);
internal Vec2F32 ui_mouse(void);
internal F_Tag ui_icon_font(void);
internal String8 ui_icon_string_from_kind(UI_IconKind icon_kind);
internal F32 ui_dt(void);
//- rjf: drag data
internal Vec2F32 ui_drag_delta(void);
internal void ui_store_drag_data(String8 string);
internal String8 ui_get_drag_data(U64 min_required_size);
#define ui_store_drag_struct(ptr) ui_store_drag_data(str8_struct(ptr))
#define ui_get_drag_struct(type) ((type *)ui_get_drag_data(sizeof(type)).str)
//- rjf: interaction keys
internal UI_Key ui_hot_key(void);
internal UI_Key ui_active_key(Side side);
//- rjf: controls over interaction
internal void ui_kill_action(void);
//- rjf: box cache lookup
internal UI_Box * ui_box_from_key(UI_Key key);
////////////////////////////////
//~ rjf: Top-Level Building API
internal void ui_begin_build(OS_EventList *events, OS_Handle window, UI_NavActionList *nav_actions, UI_IconInfo *icon_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);
internal void ui_calc_sizes_downwards_dependent__in_place_rec(UI_Box *root, Axis2 axis);
internal void ui_layout_enforce_constraints__in_place_rec(UI_Box *root, Axis2 axis);
internal void ui_layout_position__in_place_rec(UI_Box *root, Axis2 axis);
internal void ui_layout_root(UI_Box *root, Axis2 axis);
////////////////////////////////
//~ rjf: Box Tree Building API
//- rjf: tooltips
internal void ui_tooltip_begin_base(void);
internal void ui_tooltip_end_base(void);
internal void ui_tooltip_begin(void);
internal void ui_tooltip_end(void);
//- rjf: context menus
internal void ui_ctx_menu_open(UI_Key key, UI_Key anchor_box_key, Vec2F32 anchor_off);
internal void ui_ctx_menu_close(void);
internal B32 ui_begin_ctx_menu(UI_Key key);
internal void ui_end_ctx_menu(void);
internal B32 ui_ctx_menu_is_open(UI_Key key);
internal B32 ui_any_ctx_menu_is_open(void);
//- rjf: focus tree coloring
internal void ui_set_focus_active(B32 check);
internal void ui_unset_focus_active(void);
internal void ui_set_focus_hot(B32 check);
internal void ui_unset_focus_hot(void);
internal B32 ui_is_focus_active(void);
internal B32 ui_is_focus_hot(void);
//- rjf: implicit auto-managed tree-based focus state
internal B32 ui_is_key_auto_focus_active(UI_Key key);
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: box node construction
internal UI_Box * ui_build_box_from_key(UI_BoxFlags flags, UI_Key key);
internal UI_Key ui_active_seed_key(void);
internal UI_Box * ui_build_box_from_string(UI_BoxFlags flags, String8 string);
internal UI_Box * ui_build_box_from_stringf(UI_BoxFlags flags, char *fmt, ...);
//- rjf: box node equipment
internal inline void ui_box_equip_display_string(UI_Box *box, String8 string);
internal inline void ui_box_equip_display_fancy_strings(UI_Box *box, D_FancyStringList *strings);
internal inline void ui_box_equip_draw_bucket(UI_Box *box, D_Bucket *bucket);
internal inline void ui_box_equip_custom_draw(UI_Box *box, UI_BoxCustomDrawFunctionType *custom_draw, void *user_data);
//- rjf: box accessors / queries
internal String8 ui_box_display_string(UI_Box *box);
internal Vec2F32 ui_box_text_position(UI_Box *box);
internal U64 ui_box_char_pos_from_xy(UI_Box *box, Vec2F32 xy);
////////////////////////////////
//~ rjf: User Interaction
//- rjf: single-line string editing
internal B32 ui_do_single_line_string_edits(TxtPt *cursor, TxtPt *mark, U64 string_max, String8 *out_string);
//- rjf: general box interaction path
internal UI_Signal ui_signal_from_box(UI_Box *box);
////////////////////////////////
//~ rjf: Stacks
//- rjf: base
internal UI_Box * ui_push_parent(UI_Box * v);
internal Axis2 ui_push_child_layout_axis(Axis2 v);
internal F32 ui_push_fixed_x(F32 v);
internal F32 ui_push_fixed_y(F32 v);
internal F32 ui_push_fixed_width(F32 v);
internal F32 ui_push_fixed_height(F32 v);
internal UI_Size ui_push_pref_width(UI_Size v);
internal UI_Size ui_push_pref_height(UI_Size v);
internal UI_BoxFlags ui_push_flags(UI_BoxFlags v);
internal U32 ui_push_fastpath_codepoint(U32 v);
internal Vec4F32 ui_push_background_color(Vec4F32 v);
internal Vec4F32 ui_push_text_color(Vec4F32 v);
internal Vec4F32 ui_push_border_color(Vec4F32 v);
internal Vec4F32 ui_push_overlay_color(Vec4F32 v);
internal Vec4F32 ui_push_text_select_color(Vec4F32 v);
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v);
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
internal F_Tag ui_push_font(F_Tag v);
internal F32 ui_push_font_size(F32 v);
internal F32 ui_push_corner_radius_00(F32 v);
internal F32 ui_push_corner_radius_01(F32 v);
internal F32 ui_push_corner_radius_10(F32 v);
internal F32 ui_push_corner_radius_11(F32 v);
internal F32 ui_push_blur_size(F32 v);
internal F32 ui_push_text_padding(F32 v);
internal UI_TextAlign ui_push_text_alignment(UI_TextAlign v);
internal UI_Box * ui_pop_parent(void);
internal Axis2 ui_pop_child_layout_axis(void);
internal F32 ui_pop_fixed_x(void);
internal F32 ui_pop_fixed_y(void);
internal F32 ui_pop_fixed_width(void);
internal F32 ui_pop_fixed_height(void);
internal UI_Size ui_pop_pref_width(void);
internal UI_Size ui_pop_pref_height(void);
internal UI_BoxFlags ui_pop_flags(void);
internal U32 ui_pop_fastpath_codepoint(void);
internal Vec4F32 ui_pop_background_color(void);
internal Vec4F32 ui_pop_text_color(void);
internal Vec4F32 ui_pop_border_color(void);
internal Vec4F32 ui_pop_overlay_color(void);
internal Vec4F32 ui_pop_text_select_color(void);
internal Vec4F32 ui_pop_text_cursor_color(void);
internal OS_Cursor ui_pop_hover_cursor(void);
internal F_Tag ui_pop_font(void);
internal F32 ui_pop_font_size(void);
internal F32 ui_pop_corner_radius_00(void);
internal F32 ui_pop_corner_radius_01(void);
internal F32 ui_pop_corner_radius_10(void);
internal F32 ui_pop_corner_radius_11(void);
internal F32 ui_pop_blur_size(void);
internal F32 ui_pop_text_padding(void);
internal UI_TextAlign ui_pop_text_alignment(void);
internal UI_Box * ui_top_parent(void);
internal Axis2 ui_top_child_layout_axis(void);
internal F32 ui_top_fixed_x(void);
internal F32 ui_top_fixed_y(void);
internal F32 ui_top_fixed_width(void);
internal F32 ui_top_fixed_height(void);
internal UI_Size ui_top_pref_width(void);
internal UI_Size ui_top_pref_height(void);
internal UI_BoxFlags ui_top_flags(void);
internal U32 ui_top_fastpath_codepoint(void);
internal Vec4F32 ui_top_background_color(void);
internal Vec4F32 ui_top_text_color(void);
internal Vec4F32 ui_top_border_color(void);
internal Vec4F32 ui_top_overlay_color(void);
internal Vec4F32 ui_top_text_select_color(void);
internal Vec4F32 ui_top_text_cursor_color(void);
internal OS_Cursor ui_top_hover_cursor(void);
internal F_Tag ui_top_font(void);
internal F32 ui_top_font_size(void);
internal F32 ui_top_corner_radius_00(void);
internal F32 ui_top_corner_radius_01(void);
internal F32 ui_top_corner_radius_10(void);
internal F32 ui_top_corner_radius_11(void);
internal F32 ui_top_blur_size(void);
internal F32 ui_top_text_padding(void);
internal UI_TextAlign ui_top_text_alignment(void);
internal UI_Box * ui_bottom_parent(void);
internal Axis2 ui_bottom_child_layout_axis(void);
internal F32 ui_bottom_fixed_x(void);
internal F32 ui_bottom_fixed_y(void);
internal F32 ui_bottom_fixed_width(void);
internal F32 ui_bottom_fixed_height(void);
internal UI_Size ui_bottom_pref_width(void);
internal UI_Size ui_bottom_pref_height(void);
internal UI_BoxFlags ui_bottom_flags(void);
internal U32 ui_bottom_fastpath_codepoint(void);
internal Vec4F32 ui_bottom_background_color(void);
internal Vec4F32 ui_bottom_text_color(void);
internal Vec4F32 ui_bottom_border_color(void);
internal Vec4F32 ui_bottom_overlay_color(void);
internal Vec4F32 ui_bottom_text_select_color(void);
internal Vec4F32 ui_bottom_text_cursor_color(void);
internal OS_Cursor ui_bottom_hover_cursor(void);
internal F_Tag ui_bottom_font(void);
internal F32 ui_bottom_font_size(void);
internal F32 ui_bottom_corner_radius_00(void);
internal F32 ui_bottom_corner_radius_01(void);
internal F32 ui_bottom_corner_radius_10(void);
internal F32 ui_bottom_corner_radius_11(void);
internal F32 ui_bottom_blur_size(void);
internal F32 ui_bottom_text_padding(void);
internal UI_TextAlign ui_bottom_text_alignment(void);
internal UI_Box * ui_set_next_parent(UI_Box * v);
internal Axis2 ui_set_next_child_layout_axis(Axis2 v);
internal F32 ui_set_next_fixed_x(F32 v);
internal F32 ui_set_next_fixed_y(F32 v);
internal F32 ui_set_next_fixed_width(F32 v);
internal F32 ui_set_next_fixed_height(F32 v);
internal UI_Size ui_set_next_pref_width(UI_Size v);
internal UI_Size ui_set_next_pref_height(UI_Size v);
internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v);
internal U32 ui_set_next_fastpath_codepoint(U32 v);
internal Vec4F32 ui_set_next_background_color(Vec4F32 v);
internal Vec4F32 ui_set_next_text_color(Vec4F32 v);
internal Vec4F32 ui_set_next_border_color(Vec4F32 v);
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v);
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v);
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v);
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
internal F_Tag ui_set_next_font(F_Tag v);
internal F32 ui_set_next_font_size(F32 v);
internal F32 ui_set_next_corner_radius_00(F32 v);
internal F32 ui_set_next_corner_radius_01(F32 v);
internal F32 ui_set_next_corner_radius_10(F32 v);
internal F32 ui_set_next_corner_radius_11(F32 v);
internal F32 ui_set_next_blur_size(F32 v);
internal F32 ui_set_next_text_padding(F32 v);
internal UI_TextAlign ui_set_next_text_alignment(UI_TextAlign v);
//- rjf: helpers
internal Rng2F32 ui_push_rect(Rng2F32 rect);
internal Rng2F32 ui_pop_rect(void);
internal UI_Size ui_push_pref_size(Axis2 axis, UI_Size v);
internal UI_Size ui_pop_pref_size(Axis2 axis);
internal UI_Size ui_set_next_pref_size(Axis2 axis, UI_Size v);
internal void ui_push_corner_radius(F32 v);
internal void ui_pop_corner_radius(void);
////////////////////////////////
//~ rjf: Macro Loop Wrappers
//- rjf: stacks (base)
#define UI_Parent(v) DeferLoop(ui_push_parent(v), ui_pop_parent())
#define UI_ChildLayoutAxis(v) DeferLoop(ui_push_child_layout_axis(v), ui_pop_child_layout_axis())
#define UI_FixedX(v) DeferLoop(ui_push_fixed_x(v), ui_pop_fixed_x())
#define UI_FixedY(v) DeferLoop(ui_push_fixed_y(v), ui_pop_fixed_y())
#define UI_FixedWidth(v) DeferLoop(ui_push_fixed_width(v), ui_pop_fixed_width())
#define UI_FixedHeight(v) DeferLoop(ui_push_fixed_height(v), ui_pop_fixed_height())
#define UI_PrefWidth(v) DeferLoop(ui_push_pref_width(v), ui_pop_pref_width())
#define UI_PrefHeight(v) DeferLoop(ui_push_pref_height(v), ui_pop_pref_height())
#define UI_Flags(v) DeferLoop(ui_push_flags(v), ui_pop_flags())
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
#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_BorderColor(v) DeferLoop(ui_push_border_color(v), ui_pop_border_color())
#define UI_OverlayColor(v) DeferLoop(ui_push_overlay_color(v), ui_pop_overlay_color())
#define UI_TextSelectColor(v) DeferLoop(ui_push_text_select_color(v), ui_pop_text_select_color())
#define UI_TextCursorColor(v) DeferLoop(ui_push_text_cursor_color(v), ui_pop_text_cursor_color())
#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())
#define UI_FontSize(v) DeferLoop(ui_push_font_size(v), ui_pop_font_size())
#define UI_CornerRadius00(v) DeferLoop(ui_push_corner_radius_00(v), ui_pop_corner_radius_00())
#define UI_CornerRadius01(v) DeferLoop(ui_push_corner_radius_01(v), ui_pop_corner_radius_01())
#define UI_CornerRadius10(v) DeferLoop(ui_push_corner_radius_10(v), ui_pop_corner_radius_10())
#define UI_CornerRadius11(v) DeferLoop(ui_push_corner_radius_11(v), ui_pop_corner_radius_11())
#define UI_BlurSize(v) DeferLoop(ui_push_blur_size(v), ui_pop_blur_size())
#define UI_TextPadding(v) DeferLoop(ui_push_text_padding(v), ui_pop_text_padding())
#define UI_TextAlignment(v) DeferLoop(ui_push_text_alignment(v), ui_pop_text_alignment())
//- rjf: stacks (compositions)
#define UI_WidthFill UI_PrefWidth(ui_pct(1.f, 0.f))
#define UI_HeightFill UI_PrefHeight(ui_pct(1.f, 0.f))
#define UI_Rect(r) DeferLoop(ui_push_rect(r), ui_pop_rect())
#define UI_PrefSize(axis, v) DeferLoop(ui_push_pref_size((axis), (v)), ui_pop_pref_size(axis))
#define UI_CornerRadius(v) DeferLoop(ui_push_corner_radius(v), ui_pop_corner_radius())
//- rjf: tooltip
#define UI_TooltipBase DeferLoop(ui_tooltip_begin_base(), ui_tooltip_end_base())
#define UI_Tooltip DeferLoop(ui_tooltip_begin(), ui_tooltip_end())
//- rjf: context menu
#define UI_CtxMenu(key) DeferLoopChecked(ui_begin_ctx_menu(key), ui_end_ctx_menu())
//- rjf: focus
#define UI_FocusHot(is_focused) DeferLoop(ui_set_focus_hot(is_focused), ui_unset_focus_hot())
#define UI_FocusActive(is_focused) DeferLoop(ui_set_focus_active(is_focused), ui_unset_focus_hot())
#define UI_Focus(is_focused) UI_FocusHot(is_focused) UI_FocusActive(is_focused)
#endif // UI_H
+8
View File
@@ -0,0 +1,8 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#undef RADDBG_LAYER_COLOR
#define RADDBG_LAYER_COLOR 0.70f, 0.30f, 0.15f
#include "ui_core.c"
#include "ui_basic_widgets.c"
+10
View File
@@ -0,0 +1,10 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef UI_INC_H
#define UI_INC_H
#include "ui_core.h"
#include "ui_basic_widgets.h"
#endif // UI_INC_H