mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
visual jank-fix/polish pass
This commit is contained in:
@@ -141,6 +141,15 @@ make_translate_3x3f32(Vec2F32 delta)
|
||||
return mat;
|
||||
}
|
||||
|
||||
internal Mat3x3F32
|
||||
make_scale_3x3f32(Vec2F32 scale)
|
||||
{
|
||||
Mat3x3F32 mat = mat_3x3f32(1.f);
|
||||
mat.v[0][0] = scale.x;
|
||||
mat.v[1][1] = scale.y;
|
||||
return mat;
|
||||
}
|
||||
|
||||
internal Mat3x3F32
|
||||
mul_3x3f32(Mat3x3F32 a, Mat3x3F32 b)
|
||||
{
|
||||
|
||||
@@ -507,6 +507,7 @@ internal Vec4S32 mix_4s32(Vec4S32 a, Vec4S32 b, F32 t);
|
||||
|
||||
internal Mat3x3F32 mat_3x3f32(F32 diagonal);
|
||||
internal Mat3x3F32 make_translate_3x3f32(Vec2F32 delta);
|
||||
internal Mat3x3F32 make_scale_3x3f32(Vec2F32 scale);
|
||||
internal Mat3x3F32 mul_3x3f32(Mat3x3F32 a, Mat3x3F32 b);
|
||||
|
||||
internal Mat4x4F32 mat_4x4f32(F32 diagonal);
|
||||
|
||||
+114
-22
@@ -3852,17 +3852,36 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
DF_AutoCompListerItemArray item_array = df_autocomp_lister_item_array_from_chunk_list(scratch.arena, &item_list);
|
||||
df_autocomp_lister_item_array_sort__in_place(&item_array);
|
||||
|
||||
//- rjf: animate toward capped number of items
|
||||
//- rjf: animate
|
||||
F32 rate = 1 - pow_f32(2, (-40.f * df_dt()));
|
||||
F32 target = Min((F32)item_array.count, 8.f);
|
||||
if(abs_f32(target - ws->autocomp_num_visible_rows_t) > 0.01f)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
}
|
||||
ws->autocomp_num_visible_rows_t += (target - ws->autocomp_num_visible_rows_t) * rate;
|
||||
if(abs_f32(target - ws->autocomp_num_visible_rows_t) <= 0.02f)
|
||||
{
|
||||
ws->autocomp_num_visible_rows_t = target;
|
||||
// rjf: animate target # of rows
|
||||
{
|
||||
F32 target = Min((F32)item_array.count, 8.f);
|
||||
if(abs_f32(target - ws->autocomp_num_visible_rows_t) > 0.01f)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
}
|
||||
ws->autocomp_num_visible_rows_t += (target - ws->autocomp_num_visible_rows_t) * rate;
|
||||
if(abs_f32(target - ws->autocomp_num_visible_rows_t) <= 0.02f)
|
||||
{
|
||||
ws->autocomp_num_visible_rows_t = target;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: animate open
|
||||
{
|
||||
F32 diff = 1.f-ws->autocomp_open_t;
|
||||
ws->autocomp_open_t += diff*rate;
|
||||
if(abs_f32(diff) < 0.05f)
|
||||
{
|
||||
ws->autocomp_open_t = 1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: build
|
||||
@@ -3878,6 +3897,8 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
ui_set_next_corner_radius_11(ui_top_font_size()*0.25f);
|
||||
ui_set_next_corner_radius_10(ui_top_font_size()*0.25f);
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
UI_Squish(0.25f-0.25f*ws->autocomp_open_t)
|
||||
UI_Transparency(1.f-ws->autocomp_open_t)
|
||||
{
|
||||
autocomp_box = ui_build_box_from_stringf(UI_BoxFlag_DefaultFocusNavY|UI_BoxFlag_Clip|UI_BoxFlag_RoundChildrenByParent|UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_DrawDropShadow|UI_BoxFlag_DrawBackground, "autocomp_box");
|
||||
}
|
||||
@@ -3947,6 +3968,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
// rjf: reset open animation
|
||||
if(ws->hover_eval_string.size == 0)
|
||||
{
|
||||
ws->hover_eval_open_t = 0;
|
||||
ws->hover_eval_num_visible_rows_t = 0;
|
||||
}
|
||||
|
||||
@@ -3955,6 +3977,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
ws->hover_eval_num_visible_rows_t = 0;
|
||||
ws->hover_eval_open_t = 0;
|
||||
}
|
||||
|
||||
// rjf: build hover eval
|
||||
@@ -3985,18 +4008,39 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
DF_EvalVizBlockList viz_blocks = df_eval_viz_block_list_from_eval_view_expr(scratch.arena, scope, &ctrl_ctx, &parse_ctx, eval_view, expr);
|
||||
DF_EvalVizWindowedRowList viz_rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, scope, &ctrl_ctx, &parse_ctx, 10, ui_top_font(), ui_top_font_size(), r1s64(0, 50), &viz_blocks);
|
||||
|
||||
//- rjf: build hover eval box
|
||||
//- rjf: animate
|
||||
F32 fish_rate = 1 - pow_f32(2, (-40.f * df_dt()));
|
||||
F32 hover_eval_container_height_target = row_height * Min(30, viz_blocks.total_visual_row_count);
|
||||
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * fish_rate;
|
||||
if(abs_f32(hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) > 0.5f)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
}
|
||||
else
|
||||
{
|
||||
ws->hover_eval_num_visible_rows_t = hover_eval_container_height_target;
|
||||
// rjf: animate height
|
||||
{
|
||||
F32 hover_eval_container_height_target = row_height * Min(30, viz_blocks.total_visual_row_count);
|
||||
ws->hover_eval_num_visible_rows_t += (hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) * fish_rate;
|
||||
if(abs_f32(hover_eval_container_height_target - ws->hover_eval_num_visible_rows_t) > 0.5f)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
}
|
||||
else
|
||||
{
|
||||
ws->hover_eval_num_visible_rows_t = hover_eval_container_height_target;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: animate open
|
||||
{
|
||||
F32 diff = 1.f - ws->hover_eval_open_t;
|
||||
ws->hover_eval_open_t += diff*fish_rate;
|
||||
if(abs_f32(diff) < 0.01f)
|
||||
{
|
||||
ws->hover_eval_open_t = 1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: build hover eval box
|
||||
F32 hover_eval_container_height = ws->hover_eval_num_visible_rows_t;
|
||||
F32 corner_radius = ui_top_font_size()*0.25f;
|
||||
ui_set_next_fixed_x(ws->hover_eval_spawn_pos.x);
|
||||
@@ -4009,6 +4053,8 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
ui_set_next_corner_radius_10(corner_radius);
|
||||
ui_set_next_corner_radius_11(corner_radius);
|
||||
ui_set_next_child_layout_axis(Axis2_Y);
|
||||
ui_set_next_squish(0.25f-0.25f*ws->hover_eval_open_t);
|
||||
ui_set_next_transparency(1.f-ws->hover_eval_open_t);
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
{
|
||||
hover_eval_box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|
|
||||
@@ -5068,7 +5114,11 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
|
||||
//- rjf: build floating query view container
|
||||
UI_Box *query_container_box = &ui_g_nil_box;
|
||||
UI_Rect(query_container_rect) UI_CornerRadius(ui_top_font_size()*0.2f) UI_ChildLayoutAxis(Axis2_Y)
|
||||
UI_Rect(query_container_rect)
|
||||
UI_CornerRadius(ui_top_font_size()*0.2f)
|
||||
UI_ChildLayoutAxis(Axis2_Y)
|
||||
UI_Squish(0.25f-ws->query_view_t*0.25f)
|
||||
UI_Transparency(1-ws->query_view_t)
|
||||
{
|
||||
query_container_box = ui_build_box_from_stringf(UI_BoxFlag_Floating|
|
||||
UI_BoxFlag_AllowOverflow|
|
||||
@@ -6128,6 +6178,23 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: push transparency
|
||||
if(box->transparency != 0)
|
||||
{
|
||||
d_push_transparency(box->transparency);
|
||||
}
|
||||
|
||||
// rjf: push squish
|
||||
if(box->squish != 0)
|
||||
{
|
||||
Vec2F32 box_dim = dim_2f32(box->rect);
|
||||
Mat3x3F32 box2origin_xform = make_translate_3x3f32(v2f32(-box->rect.x0 - box_dim.x/2, -box->rect.y0));
|
||||
Mat3x3F32 scale_xform = make_scale_3x3f32(v2f32(1-box->squish, 1-box->squish));
|
||||
Mat3x3F32 origin2box_xform = make_translate_3x3f32(v2f32(box->rect.x0 + box_dim.x/2, box->rect.y0));
|
||||
Mat3x3F32 xform = mul_3x3f32(origin2box_xform, mul_3x3f32(scale_xform, box2origin_xform));
|
||||
d_push_xform2d(xform);
|
||||
}
|
||||
|
||||
// rjf: draw drop shadow
|
||||
if(box->flags & UI_BoxFlag_DrawDropShadow)
|
||||
{
|
||||
@@ -6139,7 +6206,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
// rjf: blur background
|
||||
if(box->flags & UI_BoxFlag_DrawBackgroundBlur)
|
||||
{
|
||||
R_PassParams_Blur *params = d_blur(box->rect, box->blur_size, 0);
|
||||
R_PassParams_Blur *params = d_blur(box->rect, box->blur_size*(1-box->transparency), 0);
|
||||
MemoryCopyArray(params->corner_radii, box->corner_radii);
|
||||
}
|
||||
|
||||
@@ -6329,6 +6396,12 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
d_pop_clip();
|
||||
}
|
||||
|
||||
// rjf: draw debug border
|
||||
if(0)
|
||||
{
|
||||
R_Rect2DInst *inst = d_rect(pad_2f32(b->rect, 1), v4f32(1, 0, 1, 0.5f), 0, 1.f, 1.f);
|
||||
}
|
||||
|
||||
// rjf: draw border
|
||||
if(b->flags & UI_BoxFlag_DrawBorder)
|
||||
{
|
||||
@@ -6423,6 +6496,18 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
MemoryCopyArray(inst->corner_radii, b->corner_radii);
|
||||
}
|
||||
|
||||
// rjf: pop squish
|
||||
if((b != box || rec.push_count == 0) && b->squish != 0)
|
||||
{
|
||||
d_pop_xform2d();
|
||||
}
|
||||
|
||||
// rjf: pop transparency
|
||||
if((b != box || rec.push_count == 0) && b->transparency != 0)
|
||||
{
|
||||
d_pop_transparency();
|
||||
}
|
||||
|
||||
pop_idx += 1;
|
||||
}
|
||||
}
|
||||
@@ -7511,11 +7596,13 @@ df_set_autocomp_lister_query(DF_Window *ws, UI_Key root_key, DF_CtrlCtx ctrl_ctx
|
||||
{
|
||||
ws->autocomp_force_closed = 0;
|
||||
ws->autocomp_num_visible_rows_t = 0;
|
||||
ws->autocomp_open_t = 0;
|
||||
}
|
||||
if(ws->autocomp_last_frame_idx+1 < df_frame_index())
|
||||
{
|
||||
ws->autocomp_force_closed = 0;
|
||||
ws->autocomp_num_visible_rows_t = 0;
|
||||
ws->autocomp_open_t = 0;
|
||||
}
|
||||
ws->autocomp_ctrl_ctx = ctrl_ctx;
|
||||
ws->autocomp_root_key = root_key;
|
||||
@@ -8549,15 +8636,17 @@ internal void
|
||||
df_entity_tooltips(DF_Entity *entity)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
UI_Tooltip UI_PrefWidth(ui_text_dim(10, 1)) switch(entity->kind)
|
||||
switch(entity->kind)
|
||||
{
|
||||
default:break;
|
||||
case DF_EntityKind_File:
|
||||
UI_Tooltip UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
String8 full_path = df_full_path_from_entity(scratch.arena, entity);
|
||||
ui_label(full_path);
|
||||
}break;
|
||||
case DF_EntityKind_Thread: UI_Flags(0)
|
||||
UI_Tooltip UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
String8 display_string = df_display_string_from_entity(scratch.arena, entity);
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread(entity);
|
||||
@@ -8609,6 +8698,7 @@ df_entity_tooltips(DF_Entity *entity)
|
||||
}
|
||||
}break;
|
||||
case DF_EntityKind_Breakpoint: UI_Flags(0)
|
||||
UI_Tooltip UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
if(entity->flags & DF_EntityFlag_HasColor)
|
||||
{
|
||||
@@ -8635,7 +8725,9 @@ df_entity_tooltips(DF_Entity *entity)
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), hit_count_text);
|
||||
}
|
||||
}break;
|
||||
case DF_EntityKind_WatchPin: UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
case DF_EntityKind_WatchPin:
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
UI_Tooltip UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
if(entity->flags & DF_EntityFlag_HasColor)
|
||||
{
|
||||
|
||||
@@ -561,6 +561,7 @@ struct DF_Window
|
||||
DF_AutoCompListerFlags autocomp_lister_flags;
|
||||
U8 autocomp_lister_query_buffer[1024];
|
||||
U64 autocomp_lister_query_size;
|
||||
F32 autocomp_open_t;
|
||||
F32 autocomp_num_visible_rows_t;
|
||||
S64 autocomp_cursor_num;
|
||||
|
||||
@@ -591,6 +592,7 @@ struct DF_Window
|
||||
DF_Handle hover_eval_file;
|
||||
TxtPt hover_eval_file_pt;
|
||||
U64 hover_eval_vaddr;
|
||||
F32 hover_eval_open_t;
|
||||
F32 hover_eval_num_visible_rows_t;
|
||||
|
||||
// rjf: error state
|
||||
|
||||
@@ -191,7 +191,7 @@ str8_lit_comp(
|
||||
" // rjf: form+return final color\n"
|
||||
" float4 final_color = albedo_sample;\n"
|
||||
" final_color *= tint;\n"
|
||||
" final_color *= opacity;\n"
|
||||
" final_color.a *= opacity;\n"
|
||||
" final_color.a *= corner_sdf_t;\n"
|
||||
" final_color.a *= border_sdf_t;\n"
|
||||
" return final_color;\n"
|
||||
|
||||
@@ -190,7 +190,7 @@ ps_main(Vertex2Pixel vertex2pixel) : SV_TARGET
|
||||
// rjf: form+return final color
|
||||
float4 final_color = albedo_sample;
|
||||
final_color *= tint;
|
||||
final_color *= opacity;
|
||||
final_color.a *= opacity;
|
||||
final_color.a *= corner_sdf_t;
|
||||
final_color.a *= border_sdf_t;
|
||||
return final_color;
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
#define UI_FocusHot(v) DeferLoop(ui_push_focus_hot(v), ui_pop_focus_hot())
|
||||
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
|
||||
#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_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())
|
||||
#define UI_FontSize(v) DeferLoop(ui_push_font_size(v), ui_pop_font_size())
|
||||
@@ -45,12 +47,14 @@ internal UI_BoxFlags ui_top_flags(void) { UI_StackTopImpl(ui_state, Flags, flags
|
||||
internal UI_FocusKind ui_top_focus_hot(void) { UI_StackTopImpl(ui_state, FocusHot, focus_hot) }
|
||||
internal UI_FocusKind ui_top_focus_active(void) { UI_StackTopImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_top_fastpath_codepoint(void) { UI_StackTopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal F32 ui_top_transparency(void) { UI_StackTopImpl(ui_state, Transparency, transparency) }
|
||||
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 Vec4F32 ui_top_border_color(void) { UI_StackTopImpl(ui_state, BorderColor, border_color) }
|
||||
internal Vec4F32 ui_top_overlay_color(void) { UI_StackTopImpl(ui_state, OverlayColor, overlay_color) }
|
||||
internal Vec4F32 ui_top_text_select_color(void) { UI_StackTopImpl(ui_state, TextSelectColor, text_select_color) }
|
||||
internal Vec4F32 ui_top_text_cursor_color(void) { UI_StackTopImpl(ui_state, TextCursorColor, text_cursor_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 F_Tag ui_top_font(void) { UI_StackTopImpl(ui_state, Font, font) }
|
||||
internal F32 ui_top_font_size(void) { UI_StackTopImpl(ui_state, FontSize, font_size) }
|
||||
@@ -73,12 +77,14 @@ internal UI_BoxFlags ui_bottom_flags(void) { UI_StackBottomImpl(ui_state, Flags,
|
||||
internal UI_FocusKind ui_bottom_focus_hot(void) { UI_StackBottomImpl(ui_state, FocusHot, focus_hot) }
|
||||
internal UI_FocusKind ui_bottom_focus_active(void) { UI_StackBottomImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_bottom_fastpath_codepoint(void) { UI_StackBottomImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal F32 ui_bottom_transparency(void) { UI_StackBottomImpl(ui_state, Transparency, transparency) }
|
||||
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 Vec4F32 ui_bottom_border_color(void) { UI_StackBottomImpl(ui_state, BorderColor, border_color) }
|
||||
internal Vec4F32 ui_bottom_overlay_color(void) { UI_StackBottomImpl(ui_state, OverlayColor, overlay_color) }
|
||||
internal Vec4F32 ui_bottom_text_select_color(void) { UI_StackBottomImpl(ui_state, TextSelectColor, text_select_color) }
|
||||
internal Vec4F32 ui_bottom_text_cursor_color(void) { UI_StackBottomImpl(ui_state, TextCursorColor, text_cursor_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 F_Tag ui_bottom_font(void) { UI_StackBottomImpl(ui_state, Font, font) }
|
||||
internal F32 ui_bottom_font_size(void) { UI_StackBottomImpl(ui_state, FontSize, font_size) }
|
||||
@@ -101,12 +107,14 @@ internal UI_BoxFlags ui_push_flags(UI_BoxFlags v) { UI_StackPushImpl(ui_state, F
|
||||
internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusHot, focus_hot, UI_FocusKind, v) }
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v) { UI_StackPushImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
internal F32 ui_push_transparency(F32 v) { UI_StackPushImpl(ui_state, Transparency, transparency, F32, 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 Vec4F32 ui_push_border_color(Vec4F32 v) { UI_StackPushImpl(ui_state, BorderColor, border_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_overlay_color(Vec4F32 v) { UI_StackPushImpl(ui_state, OverlayColor, overlay_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_select_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextSelectColor, text_select_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextCursorColor, text_cursor_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 F_Tag ui_push_font(F_Tag v) { UI_StackPushImpl(ui_state, Font, font, F_Tag, v) }
|
||||
internal F32 ui_push_font_size(F32 v) { UI_StackPushImpl(ui_state, FontSize, font_size, F32, v) }
|
||||
@@ -129,12 +137,14 @@ internal UI_BoxFlags ui_pop_flags(void) { UI_StackPopImpl(ui_state, Flags, flags
|
||||
internal UI_FocusKind ui_pop_focus_hot(void) { UI_StackPopImpl(ui_state, FocusHot, focus_hot) }
|
||||
internal UI_FocusKind ui_pop_focus_active(void) { UI_StackPopImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_pop_fastpath_codepoint(void) { UI_StackPopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal F32 ui_pop_transparency(void) { UI_StackPopImpl(ui_state, Transparency, transparency) }
|
||||
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 Vec4F32 ui_pop_border_color(void) { UI_StackPopImpl(ui_state, BorderColor, border_color) }
|
||||
internal Vec4F32 ui_pop_overlay_color(void) { UI_StackPopImpl(ui_state, OverlayColor, overlay_color) }
|
||||
internal Vec4F32 ui_pop_text_select_color(void) { UI_StackPopImpl(ui_state, TextSelectColor, text_select_color) }
|
||||
internal Vec4F32 ui_pop_text_cursor_color(void) { UI_StackPopImpl(ui_state, TextCursorColor, text_cursor_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 F_Tag ui_pop_font(void) { UI_StackPopImpl(ui_state, Font, font) }
|
||||
internal F32 ui_pop_font_size(void) { UI_StackPopImpl(ui_state, FontSize, font_size) }
|
||||
@@ -157,12 +167,14 @@ internal UI_BoxFlags ui_set_next_flags(UI_BoxFlags v) { UI_StackSetNextImpl(ui_s
|
||||
internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusHot, focus_hot, UI_FocusKind, v) }
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v) { UI_StackSetNextImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
internal F32 ui_set_next_transparency(F32 v) { UI_StackSetNextImpl(ui_state, Transparency, transparency, F32, 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 Vec4F32 ui_set_next_border_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, BorderColor, border_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, OverlayColor, overlay_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextSelectColor, text_select_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextCursorColor, text_cursor_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 F_Tag ui_set_next_font(F_Tag v) { UI_StackSetNextImpl(ui_state, Font, font, F_Tag, v) }
|
||||
internal F32 ui_set_next_font_size(F32 v) { UI_StackSetNextImpl(ui_state, FontSize, font_size, F32, v) }
|
||||
|
||||
@@ -18,12 +18,14 @@ typedef struct UI_FlagsNode UI_FlagsNode; struct UI_FlagsNode{UI_FlagsNode *next
|
||||
typedef struct UI_FocusHotNode UI_FocusHotNode; struct UI_FocusHotNode{UI_FocusHotNode *next; UI_FocusKind v;};
|
||||
typedef struct UI_FocusActiveNode UI_FocusActiveNode; struct UI_FocusActiveNode{UI_FocusActiveNode *next; UI_FocusKind v;};
|
||||
typedef struct UI_FastpathCodepointNode UI_FastpathCodepointNode; struct UI_FastpathCodepointNode{UI_FastpathCodepointNode *next; U32 v;};
|
||||
typedef struct UI_TransparencyNode UI_TransparencyNode; struct UI_TransparencyNode{UI_TransparencyNode *next; F32 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_BorderColorNode UI_BorderColorNode; struct UI_BorderColorNode{UI_BorderColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_OverlayColorNode UI_OverlayColorNode; struct UI_OverlayColorNode{UI_OverlayColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextSelectColorNode UI_TextSelectColorNode; struct UI_TextSelectColorNode{UI_TextSelectColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextCursorColorNode UI_TextCursorColorNode; struct UI_TextCursorColorNode{UI_TextCursorColorNode *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; F_Tag v;};
|
||||
typedef struct UI_FontSizeNode UI_FontSizeNode; struct UI_FontSizeNode{UI_FontSizeNode *next; F32 v;};
|
||||
@@ -49,12 +51,14 @@ UI_FlagsNode flags_nil_stack_top;\
|
||||
UI_FocusHotNode focus_hot_nil_stack_top;\
|
||||
UI_FocusActiveNode focus_active_nil_stack_top;\
|
||||
UI_FastpathCodepointNode fastpath_codepoint_nil_stack_top;\
|
||||
UI_TransparencyNode transparency_nil_stack_top;\
|
||||
UI_BackgroundColorNode background_color_nil_stack_top;\
|
||||
UI_TextColorNode text_color_nil_stack_top;\
|
||||
UI_BorderColorNode border_color_nil_stack_top;\
|
||||
UI_OverlayColorNode overlay_color_nil_stack_top;\
|
||||
UI_TextSelectColorNode text_select_color_nil_stack_top;\
|
||||
UI_TextCursorColorNode text_cursor_color_nil_stack_top;\
|
||||
UI_SquishNode squish_nil_stack_top;\
|
||||
UI_HoverCursorNode hover_cursor_nil_stack_top;\
|
||||
UI_FontNode font_nil_stack_top;\
|
||||
UI_FontSizeNode font_size_nil_stack_top;\
|
||||
@@ -79,12 +83,14 @@ state->flags_nil_stack_top.v = 0;\
|
||||
state->focus_hot_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
state->focus_active_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
state->fastpath_codepoint_nil_stack_top.v = 0;\
|
||||
state->transparency_nil_stack_top.v = 0;\
|
||||
state->background_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->text_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->border_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->overlay_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->text_select_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->text_cursor_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->squish_nil_stack_top.v = 0;\
|
||||
state->hover_cursor_nil_stack_top.v = OS_Cursor_Pointer;\
|
||||
state->font_nil_stack_top.v = f_tag_zero();\
|
||||
state->font_size_nil_stack_top.v = 24.f;\
|
||||
@@ -111,12 +117,14 @@ struct { UI_FlagsNode *top; UI_BoxFlags bottom_val; UI_FlagsNode *free; B32 auto
|
||||
struct { UI_FocusHotNode *top; UI_FocusKind bottom_val; UI_FocusHotNode *free; B32 auto_pop; } focus_hot_stack;\
|
||||
struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *free; B32 auto_pop; } focus_active_stack;\
|
||||
struct { UI_FastpathCodepointNode *top; U32 bottom_val; UI_FastpathCodepointNode *free; B32 auto_pop; } fastpath_codepoint_stack;\
|
||||
struct { UI_TransparencyNode *top; F32 bottom_val; UI_TransparencyNode *free; B32 auto_pop; } transparency_stack;\
|
||||
struct { UI_BackgroundColorNode *top; Vec4F32 bottom_val; UI_BackgroundColorNode *free; B32 auto_pop; } background_color_stack;\
|
||||
struct { UI_TextColorNode *top; Vec4F32 bottom_val; UI_TextColorNode *free; B32 auto_pop; } text_color_stack;\
|
||||
struct { UI_BorderColorNode *top; Vec4F32 bottom_val; UI_BorderColorNode *free; B32 auto_pop; } border_color_stack;\
|
||||
struct { UI_OverlayColorNode *top; Vec4F32 bottom_val; UI_OverlayColorNode *free; B32 auto_pop; } overlay_color_stack;\
|
||||
struct { UI_TextSelectColorNode *top; Vec4F32 bottom_val; UI_TextSelectColorNode *free; B32 auto_pop; } text_select_color_stack;\
|
||||
struct { UI_TextCursorColorNode *top; Vec4F32 bottom_val; UI_TextCursorColorNode *free; B32 auto_pop; } text_cursor_color_stack;\
|
||||
struct { UI_SquishNode *top; F32 bottom_val; UI_SquishNode *free; B32 auto_pop; } squish_stack;\
|
||||
struct { UI_HoverCursorNode *top; OS_Cursor bottom_val; UI_HoverCursorNode *free; B32 auto_pop; } hover_cursor_stack;\
|
||||
struct { UI_FontNode *top; F_Tag bottom_val; UI_FontNode *free; B32 auto_pop; } font_stack;\
|
||||
struct { UI_FontSizeNode *top; F32 bottom_val; UI_FontSizeNode *free; B32 auto_pop; } font_size_stack;\
|
||||
@@ -141,12 +149,14 @@ state->flags_stack.top = &state->flags_nil_stack_top; state->flags_stack.bottom_
|
||||
state->focus_hot_stack.top = &state->focus_hot_nil_stack_top; state->focus_hot_stack.bottom_val = UI_FocusKind_Null; state->focus_hot_stack.free = 0; state->focus_hot_stack.auto_pop = 0;\
|
||||
state->focus_active_stack.top = &state->focus_active_nil_stack_top; state->focus_active_stack.bottom_val = UI_FocusKind_Null; state->focus_active_stack.free = 0; state->focus_active_stack.auto_pop = 0;\
|
||||
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->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->background_color_stack.top = &state->background_color_nil_stack_top; state->background_color_stack.bottom_val = v4f32(1, 0, 1, 1); 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(1, 0, 1, 1); state->text_color_stack.free = 0; state->text_color_stack.auto_pop = 0;\
|
||||
state->border_color_stack.top = &state->border_color_nil_stack_top; state->border_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->border_color_stack.free = 0; state->border_color_stack.auto_pop = 0;\
|
||||
state->overlay_color_stack.top = &state->overlay_color_nil_stack_top; state->overlay_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->overlay_color_stack.free = 0; state->overlay_color_stack.auto_pop = 0;\
|
||||
state->text_select_color_stack.top = &state->text_select_color_nil_stack_top; state->text_select_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->text_select_color_stack.free = 0; state->text_select_color_stack.auto_pop = 0;\
|
||||
state->text_cursor_color_stack.top = &state->text_cursor_color_nil_stack_top; state->text_cursor_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->text_cursor_color_stack.free = 0; state->text_cursor_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 = f_tag_zero(); state->font_stack.free = 0; state->font_stack.auto_pop = 0;\
|
||||
state->font_size_stack.top = &state->font_size_nil_stack_top; state->font_size_stack.bottom_val = 24.f; state->font_size_stack.free = 0; state->font_size_stack.auto_pop = 0;\
|
||||
@@ -171,12 +181,14 @@ if(state->flags_stack.auto_pop) { ui_pop_flags(); state->flags_stack.auto_pop =
|
||||
if(state->focus_hot_stack.auto_pop) { ui_pop_focus_hot(); state->focus_hot_stack.auto_pop = 0; }\
|
||||
if(state->focus_active_stack.auto_pop) { ui_pop_focus_active(); state->focus_active_stack.auto_pop = 0; }\
|
||||
if(state->fastpath_codepoint_stack.auto_pop) { ui_pop_fastpath_codepoint(); state->fastpath_codepoint_stack.auto_pop = 0; }\
|
||||
if(state->transparency_stack.auto_pop) { ui_pop_transparency(); state->transparency_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->border_color_stack.auto_pop) { ui_pop_border_color(); state->border_color_stack.auto_pop = 0; }\
|
||||
if(state->overlay_color_stack.auto_pop) { ui_pop_overlay_color(); state->overlay_color_stack.auto_pop = 0; }\
|
||||
if(state->text_select_color_stack.auto_pop) { ui_pop_text_select_color(); state->text_select_color_stack.auto_pop = 0; }\
|
||||
if(state->text_cursor_color_stack.auto_pop) { ui_pop_text_cursor_color(); state->text_cursor_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; }\
|
||||
if(state->font_size_stack.auto_pop) { ui_pop_font_size(); state->font_size_stack.auto_pop = 0; }\
|
||||
@@ -200,12 +212,14 @@ internal UI_BoxFlags ui_top_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 F32 ui_top_transparency(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 F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal F_Tag ui_top_font(void);
|
||||
internal F32 ui_top_font_size(void);
|
||||
@@ -228,12 +242,14 @@ internal UI_BoxFlags ui_bottom_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 F32 ui_bottom_transparency(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 F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal F_Tag ui_bottom_font(void);
|
||||
internal F32 ui_bottom_font_size(void);
|
||||
@@ -256,12 +272,14 @@ internal UI_BoxFlags ui_push_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 F32 ui_push_transparency(F32 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 F32 ui_push_squish(F32 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);
|
||||
@@ -284,12 +302,14 @@ internal UI_BoxFlags ui_pop_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 F32 ui_pop_transparency(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 F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal F_Tag ui_pop_font(void);
|
||||
internal F32 ui_pop_font_size(void);
|
||||
@@ -312,12 +332,14 @@ internal UI_BoxFlags ui_set_next_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 F32 ui_set_next_transparency(F32 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 F32 ui_set_next_squish(F32 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);
|
||||
|
||||
@@ -29,6 +29,7 @@ UI_StackTable:
|
||||
{ FastpathCodepoint fastpath_codepoint U32 0 }
|
||||
|
||||
//- rjf: colors
|
||||
{ Transparency transparency F32 0 }
|
||||
{ BackgroundColor background_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ TextColor text_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ BorderColor border_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
@@ -36,6 +37,9 @@ UI_StackTable:
|
||||
{ TextSelectColor text_select_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ TextCursorColor text_cursor_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
|
||||
//- rjf: squish
|
||||
{ Squish squish F32 0 }
|
||||
|
||||
//- rjf: hover cursor
|
||||
{ HoverCursor hover_cursor OS_Cursor OS_Cursor_Pointer }
|
||||
|
||||
|
||||
+35
-4
@@ -611,6 +611,8 @@ ui_begin_build(OS_EventList *events, OS_Handle window, UI_NavActionList *nav_act
|
||||
ui_state->clipboard_copy_key = ui_key_zero();
|
||||
ui_state->last_build_box_count = ui_state->build_box_count;
|
||||
ui_state->build_box_count = 0;
|
||||
ui_state->tooltip_open = 0;
|
||||
ui_state->ctx_menu_changed = 0;
|
||||
}
|
||||
|
||||
//- rjf: fill build phase parameters
|
||||
@@ -908,6 +910,8 @@ ui_begin_build(OS_EventList *events, OS_Handle window, UI_NavActionList *nav_act
|
||||
Vec2F32 anchor = add_2f32(ui_state->ctx_menu_anchor_box_last_pos, ui_state->ctx_menu_anchor_off);
|
||||
UI_FixedX(anchor.x) UI_FixedY(anchor.y) UI_PrefWidth(ui_children_sum(1.f)) UI_PrefHeight(ui_children_sum(1.f))
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
UI_Squish(0.25f-ui_state->ctx_menu_open_t*0.25f)
|
||||
UI_Transparency(1-ui_state->ctx_menu_open_t)
|
||||
{
|
||||
ui_set_next_child_layout_axis(Axis2_Y);
|
||||
ui_state->ctx_menu_root = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawDropShadow|(ui_state->ctx_menu_open*UI_BoxFlag_DefaultFocusNavY), "###ctx_menu_%I64x", window.u64[0]);
|
||||
@@ -1014,7 +1018,7 @@ ui_end_build(void)
|
||||
}
|
||||
|
||||
//- rjf: stick ctx menu to anchor
|
||||
if(ui_state->ctx_menu_touched_this_frame)
|
||||
if(ui_state->ctx_menu_touched_this_frame && !ui_state->ctx_menu_changed)
|
||||
{
|
||||
UI_Box *anchor_box = ui_box_from_key(ui_state->ctx_menu_anchor_key);
|
||||
if(!ui_box_is_nil(anchor_box))
|
||||
@@ -1092,11 +1096,17 @@ ui_end_build(void)
|
||||
F32 slug_rate = 1 - pow_f32(2, (-15.f * ui_state->animation_dt));
|
||||
F32 slaf_rate = 1 - pow_f32(2, (-8.f * ui_state->animation_dt));
|
||||
ui_state->ctx_menu_open_t += ((F32)!!ui_state->ctx_menu_open - ui_state->ctx_menu_open_t) * fish_rate;
|
||||
ui_state->is_animating = (ui_state->is_animating || fabsf((F32)!!ui_state->ctx_menu_open - ui_state->ctx_menu_open_t) > 0.01f);
|
||||
if(ui_state->ctx_menu_open_t >= 0.99f)
|
||||
ui_state->is_animating = (ui_state->is_animating || abs_f32((F32)!!ui_state->ctx_menu_open - ui_state->ctx_menu_open_t) > 0.01f);
|
||||
if(ui_state->ctx_menu_open_t >= 0.99f && ui_state->ctx_menu_open)
|
||||
{
|
||||
ui_state->ctx_menu_open_t = 1.f;
|
||||
}
|
||||
ui_state->tooltip_open_t += ((F32)!!ui_state->tooltip_open - ui_state->tooltip_open_t) * fish_rate;
|
||||
ui_state->is_animating = (ui_state->is_animating || abs_f32((F32)!!ui_state->tooltip_open - ui_state->tooltip_open_t) > 0.01f);
|
||||
if(ui_state->tooltip_open_t >= 0.99f && ui_state->tooltip_open)
|
||||
{
|
||||
ui_state->tooltip_open_t = 1.f;
|
||||
}
|
||||
for(U64 slot_idx = 0; slot_idx < ui_state->box_table_size; slot_idx += 1)
|
||||
{
|
||||
for(UI_Box *box = ui_state->box_table[slot_idx].hash_first;
|
||||
@@ -1578,13 +1588,17 @@ ui_layout_root(UI_Box *root, Axis2 axis)
|
||||
internal void
|
||||
ui_tooltip_begin_base(void)
|
||||
{
|
||||
ui_state->tooltip_open = 1;
|
||||
ui_push_parent(ui_root_from_state(ui_state));
|
||||
ui_push_parent(ui_state->tooltip_root);
|
||||
ui_push_flags(0);
|
||||
}
|
||||
|
||||
internal void
|
||||
ui_tooltip_end_base(void)
|
||||
{
|
||||
ui_pop_flags();
|
||||
ui_pop_transparency();
|
||||
ui_pop_parent();
|
||||
ui_pop_parent();
|
||||
}
|
||||
@@ -1593,11 +1607,21 @@ internal void
|
||||
ui_tooltip_begin(void)
|
||||
{
|
||||
ui_tooltip_begin_base();
|
||||
UI_Flags(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_DrawDropShadow|UI_BoxFlag_RoundChildrenByParent)
|
||||
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)
|
||||
UI_PrefWidth(ui_children_sum(1))
|
||||
UI_PrefHeight(ui_children_sum(1))
|
||||
UI_CornerRadius(ui_top_font_size()*0.25f)
|
||||
ui_column_begin();
|
||||
UI_PrefWidth(ui_px(0, 1)) ui_spacer(ui_em(0.5f, 1.f));
|
||||
UI_PrefWidth(ui_children_sum(1))
|
||||
UI_PrefHeight(ui_children_sum(1))
|
||||
ui_row_begin();
|
||||
UI_PrefHeight(ui_px(0, 1)) ui_spacer(ui_em(0.5f, 1.f));
|
||||
UI_PrefWidth(ui_children_sum(1))
|
||||
UI_PrefHeight(ui_children_sum(1))
|
||||
ui_column_begin();
|
||||
ui_push_pref_width(ui_text_dim(10.f, 1.f));
|
||||
ui_push_pref_height(ui_em(2.f, 1.f));
|
||||
ui_push_text_alignment(UI_TextAlign_Center);
|
||||
@@ -1610,6 +1634,10 @@ ui_tooltip_end(void)
|
||||
ui_pop_pref_width();
|
||||
ui_pop_pref_height();
|
||||
ui_column_end();
|
||||
UI_PrefHeight(ui_px(0, 1)) ui_spacer(ui_em(0.5f, 1.f));
|
||||
ui_row_end();
|
||||
UI_PrefWidth(ui_px(0, 1)) ui_spacer(ui_em(0.5f, 1.f));
|
||||
ui_column_end();
|
||||
ui_tooltip_end_base();
|
||||
}
|
||||
|
||||
@@ -1621,6 +1649,7 @@ ui_ctx_menu_open(UI_Key key, UI_Key anchor_box_key, Vec2F32 anchor_off)
|
||||
anchor_off.x = (F32)(int)anchor_off.x;
|
||||
anchor_off.y = (F32)(int)anchor_off.y;
|
||||
ui_state->next_ctx_menu_open = 1;
|
||||
ui_state->ctx_menu_changed = 1;
|
||||
ui_state->ctx_menu_open_t = 0;
|
||||
ui_state->ctx_menu_key = key;
|
||||
ui_state->next_ctx_menu_anchor_key = anchor_box_key;
|
||||
@@ -1955,6 +1984,8 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
box->corner_radii[Corner_10] = ui_state->corner_radius_10_stack.top->v;
|
||||
box->corner_radii[Corner_11] = ui_state->corner_radius_11_stack.top->v;
|
||||
box->blur_size = ui_state->blur_size_stack.top->v;
|
||||
box->transparency = ui_state->transparency_stack.top->v;
|
||||
box->squish = ui_state->squish_stack.top->v;
|
||||
box->text_padding = ui_state->text_padding_stack.top->v;
|
||||
box->hover_cursor = ui_state->hover_cursor_stack.top->v;
|
||||
box->custom_draw = 0;
|
||||
|
||||
@@ -281,6 +281,8 @@ struct UI_Box
|
||||
F32 font_size;
|
||||
F32 corner_radii[Corner_COUNT];
|
||||
F32 blur_size;
|
||||
F32 transparency;
|
||||
F32 squish;
|
||||
F32 text_padding;
|
||||
|
||||
//- rjf: per-build artifacts
|
||||
@@ -415,6 +417,10 @@ struct UI_State
|
||||
Arena *drag_state_arena;
|
||||
String8 drag_state_data;
|
||||
|
||||
//- rjf: tooltip state
|
||||
F32 tooltip_open_t;
|
||||
B32 tooltip_open;
|
||||
|
||||
//- rjf: context menu state
|
||||
UI_Key ctx_menu_anchor_key;
|
||||
UI_Key next_ctx_menu_anchor_key;
|
||||
@@ -424,6 +430,7 @@ struct UI_State
|
||||
B32 next_ctx_menu_open;
|
||||
F32 ctx_menu_open_t;
|
||||
UI_Key ctx_menu_key;
|
||||
B32 ctx_menu_changed;
|
||||
|
||||
//- rjf: build phase stacks
|
||||
UI_DeclStackNils;
|
||||
@@ -617,12 +624,14 @@ internal UI_BoxFlags ui_top_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 F32 ui_top_transparency(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 F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal F_Tag ui_top_font(void);
|
||||
internal F32 ui_top_font_size(void);
|
||||
@@ -645,12 +654,14 @@ internal UI_BoxFlags ui_bottom_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 F32 ui_bottom_transparency(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 F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal F_Tag ui_bottom_font(void);
|
||||
internal F32 ui_bottom_font_size(void);
|
||||
@@ -673,12 +684,14 @@ internal UI_BoxFlags ui_push_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 F32 ui_push_transparency(F32 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 F32 ui_push_squish(F32 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);
|
||||
@@ -701,12 +714,14 @@ internal UI_BoxFlags ui_pop_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 F32 ui_pop_transparency(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 F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal F_Tag ui_pop_font(void);
|
||||
internal F32 ui_pop_font_size(void);
|
||||
@@ -729,12 +744,14 @@ internal UI_BoxFlags ui_set_next_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 F32 ui_set_next_transparency(F32 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 F32 ui_set_next_squish(F32 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);
|
||||
@@ -771,12 +788,14 @@ internal void ui_pop_corner_radius(void);
|
||||
#define UI_FocusHot(v) DeferLoop(ui_push_focus_hot(v), ui_pop_focus_hot())
|
||||
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
|
||||
#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_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())
|
||||
#define UI_FontSize(v) DeferLoop(ui_push_font_size(v), ui_pop_font_size())
|
||||
|
||||
Reference in New Issue
Block a user