From 818de6581336e6ba6b45b522598265d57a0722fe Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 1 Jan 2026 20:26:21 -0600 Subject: [PATCH] styling --- src/pp/pp_vis/pp_vis_core.c | 81 ++++++++++++++++++++++--------------- src/ui/ui_core.c | 2 +- src/ui/ui_core.h | 2 +- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index fa01b634..f62fe137 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -83,7 +83,7 @@ V_WidgetTheme V_GetWidgetTheme(void) theme.icon_font = UI_BuiltinIconFont(); // theme.font_size = 14; - theme.font_size = TweakFloat("Font size", 14, 6, 50, .precision = 0); + theme.font_size = TweakFloat("Font size", 16, 6, 50, .precision = 0); theme.h1 = 2.00; theme.h2 = 1.50; theme.h3 = 1.25; @@ -116,7 +116,8 @@ V_WidgetTheme V_GetWidgetTheme(void) theme.col.negative = VEC4(0.5, 0.25, 0.25, 1); theme.col.text = Rgb32(0xffdddee0); - theme.col.hint = Rgb32(0xff71767f); + // theme.col.hint = Rgb32(0xff71767f); + theme.col.hint = Rgb32(0xff6b7078); return theme; } @@ -355,7 +356,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_Push(ChildLayoutAxis, Axis_Y); UI_Push(Width, UI_GROW(1, 0)); UI_Push(Height, UI_GROW(1, 0)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_Push(Parent, UI_BuildColumnEx(vis_box)); } @@ -891,7 +892,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Width, UI_GROW(1, 0)); UI_SetNext(Height, UI_SHRINK(0, 1)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildRowEx(tab_row_key)); ////////////////////////////// @@ -1041,7 +1042,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Height, UI_SHRINK(0, 0)); UI_SetNext(ChildAlignment, UI_Region_Left); UI_SetNext(Misc, window == active_window); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_SetNext(Text, tab_name); UI_PushCP(UI_BuildRowEx(tab->key)); { @@ -1069,7 +1070,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(BorderColor, close_border_color); UI_SetNext(BorderSize, 2); UI_SetNext(ChildAlignment, UI_Region_Center); - UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); UI_SetNext(Text, Lit("x")); UI_SetNext(Width, UI_SHRINK(6, 0)); UI_SetNext(Height, UI_SHRINK(2, 0)); @@ -1138,7 +1139,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Height, UI_SHRINK(2, 0)); UI_SetNext(ChildAlignment, UI_Region_Center); // UI_SetNext(FontSize, theme.font_size * 1.5); - UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); UI_SetNext(Text, Lit("+")); UI_PushCP(UI_BuildRowEx(key)); { @@ -1165,7 +1166,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(BorderSize, 1); UI_SetNext(Width, UI_GROW(1, 0)); UI_SetNext(Height, UI_GROW(1, 0)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildColumn()); { UI_Push(Tag, window->key.hash); @@ -1198,7 +1199,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Width, UI_GROW(1, 0)); UI_SetNext(Height, UI_SHRINK(0, 0)); UI_SetNext(Misc, is_selected); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildRowEx(key)); { UI_SetNext(ChildAlignment, UI_Region_Center); @@ -1245,7 +1246,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(BackgroundColor, bg_color); UI_SetNext(BorderColor, border_color); UI_SetNext(BorderSize, MaxF32((divider_size / 2.0) - (visible_size / 2.0), 0)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_SetNext(AxisSize, UI_GROW(1, 1), .axis = panel->axis); UI_SetNext(AxisSize, UI_PIX(divider_size, 1), .axis = !panel->axis); UI_BuildBoxEx(panel->divider_key); @@ -1329,13 +1330,14 @@ void V_TickForever(WaveLaneCtx *lane) UI_Push(BackgroundColor, window_background_color); UI_Push(BorderColor, window_border_color); UI_Push(BorderSize, theme.window_bd_sz); - UI_Push(Rounding, UI_RPIX(15 * theme.rounding)); + // UI_Push(Rounding, UI_RPIX(15 * theme.rounding)); + UI_Push(Rounding, UI_RGROW(0.1 * theme.rounding)); UI_Push(Width, UI_FNT(50, 0)); UI_Push(Height, UI_SHRINK(0, 0)); UI_Push(ChildLayoutAxis, Axis_Y); UI_Push(FloatingPos, palette->pos); UI_SetNext(Anchor, UI_Region_Center); - UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildBoxEx(palette->key)); { // Title bar @@ -1347,7 +1349,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_Push(ChildLayoutAxis, Axis_X); UI_Push(Width, UI_GROW(1, 0)); UI_Push(Height, UI_FNT(2, 1)); - UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildBoxEx(titlebar_key)); { UI_Push(Width, UI_GROW(1, 0)); @@ -1500,7 +1502,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Width, UI_GROW(1, 0)); UI_SetNext(Height, UI_PIX(item_size_px, 1)); UI_SetNext(ChildAlignment, UI_Region_Left); - UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildRowEx(item->key)); { UI_Push(Tag, item->key.hash); @@ -1521,13 +1523,23 @@ void V_TickForever(WaveLaneCtx *lane) TweakVar tweak_var = item->tweak_var; String old_tweak_str = tweak_var.value; String new_tweak_str = tweak_var.value; + b32 is_default = MatchString(new_tweak_str, tweak_var.initial); // Tweak label UI_BuildSpacer(UI_PIX(spacing, 1), Axis_X); + if (is_default) + { + UI_SetNext(TextColor, theme.col.hint); + UI_SetNext(FontSize, UI_Top(FontSize) * theme.h5); + } + else + { + UI_SetNext(TextColor, Color_White); + } UI_BuildLabel(new_tweak_str); // Reset button - if (!MatchString(new_tweak_str, tweak_var.initial)) + if (!is_default) { UI_BuildSpacer(UI_PIX(spacing * 0.5, 1), Axis_X); UI_Key reset_key = UI_KeyF("reset"); @@ -1547,22 +1559,23 @@ void V_TickForever(WaveLaneCtx *lane) // reset_bg = LerpSrgb(reset_bg, theme.col.button_active, reset_rep.active); Vec4 reset_bd = Zi; - reset_bd = LerpSrgb(reset_bd, theme.col.button_active, reset_rep.hot); + // reset_bd = LerpSrgb(reset_bd, theme.col.button_active, reset_rep.hot); + // reset_bd = LerpSrgb(reset_bd, theme.col.text, reset_rep.hot); Vec4 reset_text_col = theme.col.hint; reset_text_col = LerpSrgb(reset_text_col, theme.col.text, reset_rep.hot); - UI_SetNext(Rounding, UI_RGROW(0.5 * theme.rounding)); - UI_SetNext(ChildAlignment, UI_Region_Center); + UI_SetNext(Rounding, UI_RGROW(0.75 * theme.rounding)); + UI_SetNext(ChildAlignment, UI_Region_Bottom); UI_SetNext(BackgroundColor, reset_bg); UI_SetNext(BorderColor, reset_bd); - UI_SetNext(BorderSize, 1); + UI_SetNext(BorderSize, 0); UI_SetNext(TextColor, reset_text_col); - UI_SetNext(Width, UI_SHRINK(3, 1)); - UI_SetNext(Height, UI_SHRINK(3, 1)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Width, UI_SHRINK(0, 1)); + UI_SetNext(Height, UI_SHRINK(0, 1)); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); - UI_BuildIconEx(reset_key, UI_Icon_Undo, theme.icon_font); + UI_BuildIconEx(reset_key, UI_Icon_Loop2, theme.icon_font); } UI_BuildSpacer(UI_PIX(spacing, 1), Axis_X); @@ -1594,7 +1607,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(BorderSize, 1); UI_SetNext(Width, UI_FNT(1.25, 1)); UI_SetNext(Height, UI_FNT(1.25, 1)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildRowEx(cb_key)); { } @@ -1610,6 +1623,10 @@ void V_TickForever(WaveLaneCtx *lane) UI_BoxReports slider_reps = UI_ReportsFromKey(slider_key); UI_BoxReports marker_reps = UI_ReportsFromKey(marker_key); + b32 is_hot = slider_reps.draw.is_hot || marker_reps.draw.is_hot; + b32 is_active = slider_reps.draw.m1.held || marker_reps.draw.m1.held; + f32 hot = MaxF32(slider_reps.draw.hot, marker_reps.draw.hot); + Vec2 slider_pos = slider_reps.draw.screen_rect.p0; Vec2 slider_dims = DimsFromRng2(slider_reps.draw.screen_rect); Vec2 marker_dims = DimsFromRng2(marker_reps.draw.screen_rect); @@ -1624,7 +1641,7 @@ void V_TickForever(WaveLaneCtx *lane) f64 tweak_float = FloatFromString(new_tweak_str); { - if (slider_reps.draw.m1.held && (frame->ui_cursor.x != last_frame->ui_cursor.x)) + if (is_active && (frame->ui_cursor.x != last_frame->ui_cursor.x)) { f64 initial_slider_pos = slider_reps.drag.screen_rect.p0.x; f64 initial_marker_width = DimsFromRng2(marker_reps.drag.screen_rect).x; @@ -1640,7 +1657,7 @@ void V_TickForever(WaveLaneCtx *lane) tweak_float = ClampF64(tweak_float, range_min, range_max); new_tweak_str = StringFromFloat(frame->arena, tweak_float, tweak_var.precision); } - if (slider_reps.draw.is_hot) + if (is_hot) { WND_SetCursor(window_frame, WND_CursorKind_HorizontalResize); } @@ -1653,8 +1670,8 @@ void V_TickForever(WaveLaneCtx *lane) Vec4 slider_border_color = theme.col.window_bd; Vec4 slider_progress_color = theme.col.positive; Vec4 marker_bg_color = slider_progress_color; - slider_border_color = LerpSrgb(slider_border_color, theme.col.button_active, slider_reps.draw.hot); - marker_bg_color = LerpSrgb(marker_bg_color, theme.col.text, slider_reps.draw.hot); + slider_border_color = LerpSrgb(slider_border_color, theme.col.button_active, hot); + marker_bg_color = LerpSrgb(marker_bg_color, theme.col.text, hot); UI_SetNext(BackgroundColor, slider_bg_color); UI_SetNext(BorderColor, slider_border_color); @@ -1662,7 +1679,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(BorderSize, 1); UI_SetNext(Width, UI_FNT(10, 1)); UI_SetNext(Height, UI_PIX(tweak_size_px * 0.75, 1)); - UI_SetNext(Flags, UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); UI_SetNext(Misc, ratio); UI_PushCP(UI_BuildRowEx(slider_key)); { @@ -1691,7 +1708,7 @@ void V_TickForever(WaveLaneCtx *lane) // UI_SetNext(Anchor, UI_Region_Center); // UI_SetNext(FloatingPos, VEC2(marker_pos, (marker_size_px * 0.5))); UI_SetNext(FloatingPos, VEC2(marker_pos, -marker_dims.y * 0.125)); - UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_NoFloatingClamp); + UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_NoFloatingClamp | UI_BoxFlag_CaptureMouse); UI_BuildBoxEx(marker_key); } } @@ -1745,7 +1762,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Rounding, UI_RPIX(5)); UI_SetNext(BorderSize, 1); UI_SetNext(ChildAlignment, UI_Region_Center); - UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable); + UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); UI_PushCP(UI_BuildRowEx(hotkey_key)); { } @@ -1893,7 +1910,7 @@ void V_TickForever(WaveLaneCtx *lane) if (minimized) { UI_SetNext(BackgroundColor, 0); - UI_SetNext(Width, UI_PIX(500, 0)); + UI_SetNext(Width, UI_FNT(50, 0)); UI_SetNext(Height, UI_SHRINK(0, 1)); } else diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index ec1de7a4..2bc6f8b1 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -677,7 +677,7 @@ UI_Frame *UI_BeginFrame(UI_FrameFlag frame_flags, Vec4 swapchain_color) is_cursor_in_box = non_corner_edge_dist >= 0 && corner_edge_dist >= 0; } report->is_hovered = is_cursor_in_box; - if (top_hovered_box == 0 && box->desc.flags & UI_BoxFlag_Interactable && is_cursor_in_box) + if (top_hovered_box == 0 && box->desc.flags & UI_BoxFlag_CaptureMouse && is_cursor_in_box) { top_hovered_box = box; } diff --git a/src/ui/ui_core.h b/src/ui/ui_core.h index 18a46425..2cd8212a 100644 --- a/src/ui/ui_core.h +++ b/src/ui/ui_core.h @@ -87,7 +87,7 @@ Enum(UI_BoxFlag) { UI_BoxFlag_None = 0, UI_BoxFlag_DrawText = (1 << 0), - UI_BoxFlag_Interactable = (1 << 1), + UI_BoxFlag_CaptureMouse = (1 << 1), UI_BoxFlag_NoTextTruncation = (1 << 2), UI_BoxFlag_Floating = (1 << 3), UI_BoxFlag_NoFloatingClamp = (1 << 4),