From 3998e5b713ff231494fbea6d34ad34a40e6a2d31 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 6 Apr 2026 02:02:21 -0500 Subject: [PATCH] palette reset button alignment --- src/pp/pp_vis/pp_vis_core.c | 1197 ++--------------------------------- 1 file changed, 47 insertions(+), 1150 deletions(-) diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 220d31bc..457d8669 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -3157,7 +3157,7 @@ void V_TickForever(WaveLaneCtx *lane) // Bullet fired if (event->is_first_trail) { - frame->camera_shake = MaxF32(frame->camera_shake, 2); + frame->camera_shake = MaxF32(frame->camera_shake, 4); //- Bullet particle { @@ -6959,46 +6959,52 @@ void V_TickForever(WaveLaneCtx *lane) String new_tweak_str = tweak_var.value; b32 is_default = MatchString(new_tweak_str, tweak_var.initial); - // Reset button - if (!is_default) + //- Tweak reset + // UI_PushDF(Parent, UI_BuildRow()) { - // UI_BuildSpacer(UI_Px(spacing * 0.5, 1), Axis_X); - UI_Key reset_key = UI_KeyF("reset"); - - if (UI_Downs(reset_key, Button_M1)) + if (!is_default) { - new_tweak_str = tweak_var.initial; + // UI_BuildSpacer(UI_Px(spacing * 0.5, 1), Axis_X); + UI_Key reset_key = UI_KeyF("reset"); + + if (UI_Downs(reset_key, Button_M1)) + { + new_tweak_str = tweak_var.initial; + } + if (UI_HotAbsolute(reset_key)) + { + WND_SetCursor(window_frame, WND_CursorKind_Hand); + } + + Vec4 reset_bg = Zi; + // reset_bg = LerpSrgb(reset_bg, theme.col.button_hot, UI_Hot(reset_key)); + // reset_bg = LerpSrgb(reset_bg, theme.col.button_active, UI_Active(reset_key)); + + Vec4 reset_bd = Zi; + // reset_bd = LerpSrgb(reset_bd, theme.col.button_active, UI_Hot(reset_key)); + // reset_bd = LerpSrgb(reset_bd, theme.col.text, UI_Hot(reset_key)); + + Vec4 reset_text_col = theme.col.hint; + reset_text_col = LerpSrgb(reset_text_col, theme.col.text, UI_Hot(reset_key)); + + 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, 0); + UI_SetNext(TextColor, reset_text_col); + UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext(Width, UI_Px(10, 1)); + UI_SetNext(Height, UI_Shrink(0, 1)); + UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); + UI_SetNext(Font, theme.icon_font); + UI_SetNext(Icon, UI_Icon_Loop2); + UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_DrawText); + UI_BuildBoxEx(reset_key); } - if (UI_HotAbsolute(reset_key)) - { - WND_SetCursor(window_frame, WND_CursorKind_Hand); - } - - Vec4 reset_bg = Zi; - // reset_bg = LerpSrgb(reset_bg, theme.col.button_hot, UI_Hot(reset_key)); - // reset_bg = LerpSrgb(reset_bg, theme.col.button_active, UI_Active(reset_key)); - - Vec4 reset_bd = Zi; - // reset_bd = LerpSrgb(reset_bd, theme.col.button_active, UI_Hot(reset_key)); - // reset_bd = LerpSrgb(reset_bd, theme.col.text, UI_Hot(reset_key)); - - Vec4 reset_text_col = theme.col.hint; - reset_text_col = LerpSrgb(reset_text_col, theme.col.text, UI_Hot(reset_key)); - - 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, 0); - UI_SetNext(TextColor, reset_text_col); - 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, theme.icon_font, UI_Icon_Loop2); } - // Tweak label + //- Tweak label { UI_BuildSpacer(icon_col_width, Axis_X); if (is_default) @@ -7011,7 +7017,8 @@ void V_TickForever(WaveLaneCtx *lane) } UI_SetNext(FontSize, UI_Top(FontSize) * theme.h5); UI_SetNext(ChildAlignment, UI_Region_Left); - UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext(Width, UI_Shrink(0, 1)); + UI_SetNext(Width, icon_col_width); UI_SetNext(Height, UI_Shrink(0, 1)); UI_SetNext(Text, new_tweak_str); UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_DontTruncateText); @@ -7022,6 +7029,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_BuildSpacer(icon_col_width, Axis_X); + //- Tweak adjust switch (tweak_var.kind) { // Boolean tweak @@ -7052,7 +7060,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_BuildRowEx(cb_key); } break; - // Float tweak + // Float tweak slider case TweakKind_Float: { UI_Key slider_key = UI_KeyF("tweak slider"); @@ -7203,7 +7211,7 @@ void V_TickForever(WaveLaneCtx *lane) } } - // UI_BuildSpacer(icon_col_width, Axis_X); + UI_BuildSpacer(icon_col_width, Axis_X); } } } @@ -7401,1117 +7409,6 @@ void V_TickForever(WaveLaneCtx *lane) - - - - - - - - - - - - - - - - - - // ////////////////////////////// - // //- Build command palette - - // V_Palette *palette = &frame->palette; - // UI_PushDF(Parent, UI_RootKey) - // { - // UI_Push(Tag, HashF("developer command palette")); - - // // FIXME: Remove this - // if (frame->tick == 1) - // { - // palette->pos = VEC2(1000, 1000); - // } - - // UI_Size total_width = UI_Fnt(40, 1); - // UI_Size total_height = UI_Fnt(30, 1); - // UI_Size header_height = UI_Fnt(1.3, 1); - // UI_Size window_padding = UI_Fnt(0.5, 1); - // UI_Size icon_col_width = UI_Fnt(1.75, 1); - // UI_Size item_col_width = UI_Fnt(30, 1); - // // UI_Size col2_width = UI_Fnt(10, 1); - // UI_Size scrollbar_width = UI_Fnt(1, 1); - // f32 item_size_px = UI_Fnt(1.5, 1).v; - - // UI_Key scissor_key = UI_KeyF("scissor"); - // UI_Key lister_key = UI_KeyF("lister"); - // UI_Key scrollbar_key = UI_KeyF("scrollbar"); - // UI_Key thumb_key = UI_KeyF("scrollbar thumb"); - // UI_Key scrollbar_up_key = UI_KeyF("scrollbar up"); - // UI_Key scrollbar_down_key = UI_KeyF("scrollbar down"); - // UI_Key track_key = UI_KeyF("scrollbar track"); - - // f32 lister_start = UI_Rect(lister_key).p0.y; - // f32 lister_end = UI_Rect(lister_key).p1.y; - // f32 lister_height = MaxF32(lister_end - lister_start, 1); - - // f32 scissor_start = UI_Rect(scissor_key).p0.y; - // f32 scissor_end = UI_Rect(scissor_key).p1.y; - // f32 scissor_height = MaxF32(scissor_end - scissor_start, 1); - - // f32 track_start = UI_Rect(track_key).p0.y; - // f32 track_end = UI_Rect(track_key).p1.y; - // f32 track_height = MaxF32(track_end - track_start, 1); - - // f32 thumb_start = UI_Rect(thumb_key).p0.y; - // f32 thumb_end = UI_Rect(thumb_key).p1.y; - // f32 thumb_height = MaxF32(thumb_end - thumb_start, 1); - - // f32 wheel_scroll_amount = 3 * item_size_px; - // f32 button_scroll_amount = 20 * item_size_px * frame->dt; - // f32 scroll_height = MaxF32(lister_height - scissor_height, 1); - // { - // f32 wheel_scrolls = UI_Downs(lister_key, Button_WheelDown) - UI_Downs(lister_key, Button_WheelUp); - // f32 button_scrolls = UI_Held(scrollbar_down_key, Button_M1) - UI_Held(scrollbar_up_key, Button_M1); - // if (UI_Downs(thumb_key, Button_M1)) - // { - // palette->drag_lister = UI_Rect(lister_key); - // palette->drag_scissor = UI_Rect(scissor_key); - // palette->drag_track = UI_Rect(track_key); - // palette->drag_thumb = UI_Rect(thumb_key); - // palette->drag_cursor = UI_CursorPos(); - - // palette->drag_scroll = palette->scroll; - // } - // if (UI_Held(thumb_key, Button_M1)) - // { - // f32 drag_track_height = palette->drag_track.p1.y - palette->drag_track.p0.y; - // f32 drag_thumb_height = palette->drag_thumb.p1.y - palette->drag_thumb.p0.y; - // f32 drag_scroll_height = (palette->drag_lister.p1.y - palette->drag_lister.p0.y) - (palette->drag_scissor.p1.y - palette->drag_scissor.p0.y); - // f32 delta_ratio = (UI_CursorPos().y - palette->drag_cursor.y) / (drag_track_height - drag_thumb_height); - // palette->scroll = palette->drag_scroll + delta_ratio * drag_scroll_height; - // palette->target_scroll = palette->scroll; - // } - // palette->target_scroll += wheel_scrolls * wheel_scroll_amount; - // palette->target_scroll += button_scrolls * button_scroll_amount; - // palette->target_scroll = ClampF32(palette->target_scroll, 0, scroll_height); - // palette->scroll = LerpF32(palette->scroll, palette->target_scroll, SaturateF32(20 * frame->dt)); - // palette->scroll = ClampF32(palette->scroll, 0, scroll_height); - // } - - // f32 scroll_ratio = palette->scroll / scroll_height; - // f32 lister_offset = scroll_ratio * scroll_height; - - // f32 new_thumb_height = track_height * (scissor_height / lister_height); - // f32 new_thumb_start = scroll_ratio * track_height - scroll_ratio * thumb_height; - - // b32 scrollbar_visible = new_thumb_height < track_height; - - // { - // f32 ease_rate = TweakFloat("Debug palette ease rate", 20, 1, 100) * frame->dt; - // f32 ease_in_target = TweakFloat("Debug palette ease-in target", 1.3, 0, 2); - // f32 pref_show = palette->should_show ? ease_in_target : 0; - // palette->show = SaturateF32(LerpF32(palette->show, pref_show, ease_rate)); - // } - - // if (palette->should_show || palette->show > 0.001) - // { - // f32 tweak_size_px = UI_Fnt(1.25, 1).v; - - // palette->key = UI_KeyF("command palette"); - // UI_Checkpoint palette_cp = UI_PushCp(UI_NilKey); - // { - // UI_Push(Tag, palette->key.v); - // UI_Key titlebar_key = UI_KeyF("title bar"); - - // Vec4 window_background_color = theme.col.window_bg; - // Vec4 window_border_color = theme.col.window_bd; - // Vec4 titlebar_color = Zi; - // Vec4 titlebar_border_color = Zi; - // Vec4 divider_color = theme.col.divider; - // if (UI_Held(titlebar_key, Button_M1)) - // { - // Vec2 drag_offset = SubVec2(ui_frame->drag_cursor_pos, UI_DragAnchor(palette->key)); - // palette->pos = SubVec2(UI_CursorPos(), drag_offset); - // } - // window_border_color = LerpSrgb(window_border_color, theme.col.button_active, UI_Hot(titlebar_key)); - - // f32 scale = LerpF32(0.85, 1, palette->show); - // UI_Push(Tint, VEC4(1, 1, 1, palette->show)); - // UI_SetNext(Scale, VEC2(scale, scale)); - - // UI_SetNext(BackgroundColor, window_background_color); - // UI_SetNext(BorderColor, window_border_color); - // // UI_SetNext(BorderSize, theme.window_bd_sz); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Rounding, UI_Rgrow(0.06 * theme.rounding)); - // UI_SetNext(Width, total_width); - // UI_SetNext(Height, total_height); - // UI_SetNext(FloatingPos, palette->pos); - // UI_SetNext(ChildLayoutAxis, Axis_Y); - // UI_SetNext(Anchor, UI_Region_Center); - // UI_SetNext(Flags, UI_BoxFlag_Floating | (UI_BoxFlag_CaptureMouse * !!palette->should_show)); - // UI_PushDF(Parent, UI_BuildBoxEx(palette->key)) - // { - // //- Title bar - // UI_SetNext(Flags, UI_BoxFlag_DrawText | (UI_BoxFlag_CaptureMouse * !!palette->should_show)); - // UI_PushDF(BackgroundColor, titlebar_color) - // UI_PushDF(BorderColor, titlebar_border_color) - // UI_PushDF(Rounding, UI_Rpx(0)) - // UI_PushDF(ChildLayoutAxis, Axis_X) - // UI_PushDF(Width, UI_Grow(1, 0)) - // UI_PushDF(Height, header_height) - // UI_PushDF(FontSize, UI_Top(FontSize) * theme.h5) - // UI_PushDF(TextColor, theme.col.hint) - // UI_PushDF(ChildAlignment, UI_Region_Center) - // UI_PushDF(Parent, UI_BuildBoxEx(titlebar_key)) - // { - // UI_Push(Width, UI_Grow(1, 0)); - // UI_Push(BorderColor, 0); - - // // Left title box - // UI_BuildRow(); - - // UI_SetNext(Width, UI_Shrink(0, 1)); - // UI_BuildIcon(theme.icon_font, UI_Icon_Wrench); - - // // Title box - // // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h3); - // UI_SetNext(Width, UI_Shrink(0, 1)); - // UI_SetNext(Text, Lit(" Developer Palette")); - // UI_SetNext(Flags, UI_BoxFlag_DrawText); - // UI_BuildBox(); - - // // Right title box - // UI_BuildRow(); - // } - - // //- Window box - // UI_SetNext(BackgroundColor, 0); - // UI_SetNext(Rounding, 0); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Grow(1, 0)); - // UI_PushDF(Parent, UI_BuildRow()) - // { - // UI_BuildSpacer(window_padding, Axis_X); - - // UI_SetNext(BackgroundColor, 0); - // UI_SetNext(Rounding, 0); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Grow(1, 0)); - // UI_PushDF(Parent, UI_BuildColumn()) - // { - // ////////////////////////////// - // //- Build searchbox - - // b32 is_searching = 0; - // String search_pattern = Zi; - // { - // UI_Size search_height = UI_Px(item_size_px * 1.25, 1); - - // UI_SetNext(BackgroundColor, 0); - // UI_SetNext(ChildAlignment, UI_Region_Left); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, search_height); - // UI_PushCp(UI_BuildRow()); - // { - // //- Search icon - // { - // f32 size_px = UI_Top(FontSize) * 1.25; - - // UI_SetNext(Rounding, UI_Rgrow(0.75 * theme.rounding)); - // UI_SetNext(ChildAlignment, UI_Region_Center); - // UI_SetNext(BackgroundColor, 0); - // // UI_SetNext(BorderColor, reset_bd); - // UI_SetNext(BorderSize, 0); - // UI_SetNext(Rounding, 0); - // UI_SetNext(TextColor, theme.col.hint); - // UI_SetNext(Width, icon_col_width); - // UI_SetNext(Height, UI_Px(size_px * 1.5, 1)); - // // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); - // UI_SetNext(FontSize, size_px * theme.h6); - // UI_BuildIcon(theme.icon_font, UI_Icon_Search); - // // UI_BuildRow(); - // } - - // //- Search box - // { - // UI_Key search_box = UI_KeyF("search box"); - // UI_Key search_scroll_box = UI_KeyF("search scroll box"); - // V_TextboxState *search_state = &palette->search_state; - - // f32 font_size = UI_Top(FontSize); - // GC_FontKey font = UI_Top(Font); - - // // Vec4 search_color = Color_Black; - // Vec4 search_color = Zi; - - // b32 has_focus = UI_MatchKey(search_box, prev_frame->text_input_focus); - // { - // // FIXME: Remove this - // has_focus = 1; - // if (UI_Downs(search_box, Button_M1)) - // { - // has_focus = 1; - // V.text_input_ns = frame->time_ns; - // } - // if (!palette->should_show) - // { - // has_focus = 0; - // } - // } - - // if (UI_HotAbsolute(search_box)) - // { - // WND_SetCursor(window_frame, WND_CursorKind_Text); - // } - - // V_TextboxDeltaFlag tb_applied_flags = 0; - - // // Apply text input deltas - // { - // frame->text_input_focus = search_box; - // if (text_input_deltas.first) - // { - // V.text_input_ns = frame->time_ns; - // tb_applied_flags |= V_ApplyTextboxDeltas(search_state, text_input_deltas); - // } - // } - - // String search_text = V_StringFromTextbox(frame->arena, search_state); - // search_pattern = LowerString(frame->arena, search_text); - // is_searching = search_text.len != 0; - - // String display_text = search_text; - // Vec4 display_text_color = Color_White; - // if (!is_searching) - // { - // display_text_color = theme.col.hint; - // display_text = Lit(" Search..."); - // } - - // // TODO: Cache run for UI - // String32 codepoints = String32FromString(frame->arena, search_text); - // GC_Run run = GC_RunFromString32(frame->arena, codepoints, font, font_size); - - // b32 started_dragging_text = 0; - // b32 is_dragging_text = 0; - // if (has_focus) - // { - // // Generate & apply mouse text selection delta - // if (UI_Held(search_box, Button_M1)) - // { - // V.text_input_ns = frame->time_ns; - // is_dragging_text = 1; - // f32 mouse_text_px = UI_CursorPos().x - UI_Anchor(search_scroll_box).x; - // i64 rect_idx = 0; - // for (; rect_idx < (i64)run.rects_count; ++rect_idx) - // { - // GC_RunRect rect = run.rects[rect_idx]; - // if (rect.baseline_pos + rect.advance / 2 > mouse_text_px) - // { - // break; - // } - // } - // { - // V_TextboxDelta delta = Zi; - // delta.flags |= V_TextboxDeltaFlag_NavDirectEnd; - // delta.flags |= V_TextboxDeltaFlag_NavSelect; - // delta.direct_end = rect_idx; - // if (UI_Downs(search_box, Button_M1)) - // { - // delta.flags |= V_TextboxDeltaFlag_NavDirectStart; - // delta.direct_start = delta.direct_end; - // started_dragging_text = 1; - // } - // tb_applied_flags |= V_ApplyTextboxDelta(search_state, delta); - // } - // } - // } - - - - - - - - - - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, search_height); - // UI_SetNext(BackgroundColor, search_color); - // UI_SetNext(ChildAlignment, UI_Region_Right); - // // UI_SetNext(BorderColor, item_border_color); - // // UI_SetNext(Rounding, UI_Rpx(5)); - // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Scissor); - // // UI_PushDF(BorderSize, 0) - // UI_PushDF(Parent, UI_BuildRowEx(search_box)) - // { - // //- Compute caret / selection pos - // { - // f32 target_caret_start_px = 0; - // f32 target_caret_end_px = 0; - // if (search_text.len > 0) - // { - // for (i64 rect_idx = 0; rect_idx < (i64)run.rects_count; ++rect_idx) - // { - // GC_RunRect rect = run.rects[rect_idx]; - // if (rect_idx < search_state->start) - // { - // target_caret_start_px = rect.baseline_pos + rect.advance; - // } - // if (rect_idx < search_state->end) - // { - // target_caret_end_px = rect.baseline_pos + rect.advance; - // } - // if (rect_idx >= search_state->start && rect_idx >= search_state->end) - // { - // break; - // } - // } - // } - - // f32 caret_start_lerp_rate = 20 * frame->dt; - // f32 caret_end_lerp_rate = 50 * frame->dt; - // { - // if (started_dragging_text) - // { - // caret_start_lerp_rate = 1; - // caret_end_lerp_rate = 1; - // } - // // if (tb_applied_flags & V_TextboxDeltaFlag_UpdateText) - // // { - // // caret_end_lerp_rate = 1; - // // } - // caret_start_lerp_rate = SaturateF32(caret_start_lerp_rate); - // caret_end_lerp_rate = SaturateF32(caret_end_lerp_rate); - // } - // palette->caret_start_px = LerpF32(palette->caret_start_px, target_caret_start_px, caret_start_lerp_rate); - // palette->caret_end_px = LerpF32(palette->caret_end_px, target_caret_end_px, caret_end_lerp_rate); - // } - - // // Calculate textbox width if we're not scaling up - // if (palette->show > 0.99) - // { - // palette->text_scroll_view_width_px = DimsFromRng2(UI_Rect(search_box)).x; - // } - - // //- Determine text scroll pos - // { - // { - // f32 new_text_scroll_px = palette->caret_end_px - 10; - // palette->text_scroll_px = MinF32(palette->text_scroll_px, new_text_scroll_px); - // } - // { - // f32 new_text_scroll_px = palette->caret_end_px - palette->text_scroll_view_width_px + 10; - // palette->text_scroll_px = MaxF32(palette->text_scroll_px, new_text_scroll_px); - // } - // palette->text_scroll_px = MaxF32(palette->text_scroll_px, 0); - // } - - // UI_Size caret_width = UI_Px(1, 1); - // UI_Size caret_height = UI_Px(search_height.v, 1); - // f32 h = TweakFloat("Text selection hue", 200, 0, 360); - // f32 s = TweakFloat("Text selection saturation", 1, 0, 1); - // f32 v = TweakFloat("Text selection brightness", 0.6, 0, 1); - // Vec4 selection_color = SrgbFromHsv(HSV(h, s, v)); - // // Vec4 selection_color = theme.col.button_active; - // // selection_color.a = 1; - - // Vec4 caret_color = VEC4(1, 1, 1, 0.75); - // caret_color.a *= AbsF32(CosF32(SecondsFromNs(frame->time_ns - V.text_input_ns) * 3)); - - // //- Text region - // UI_SetNext(FloatingPos, VEC2(-palette->text_scroll_px, 0)); - // UI_SetNext(Anchor, UI_Region_Left); - // UI_SetNext(ChildAlignment, UI_Region_Left); - // UI_SetNext(Width, UI_Shrink(0, 1)); - // UI_SetNext( - // Flags, - // UI_BoxFlag_DrawText | - // UI_BoxFlag_Floating | - // UI_BoxFlag_DontClampFloatingX - // ); - // // UI_PushDF(Parent, UI_BuildRowEx(search_scroll_box)) - // UI_PushDF(Parent, UI_BuildRowEx(search_scroll_box)) - // { - // UI_Key caret_box = UI_KeyF("search caret"); - // UI_Key selection_box = UI_KeyF("search selection"); - - // //- Selection - // { - // f32 min = MinF32(palette->caret_end_px, palette->caret_start_px); - // f32 max = MaxF32(palette->caret_end_px, palette->caret_start_px); - // UI_SetNext(Width, UI_Px(max - min, 1)); - // UI_SetNext(Height, caret_height); - // UI_SetNext(FloatingPos, VEC2(min, 0)); - // UI_SetNext(Anchor, UI_Region_Left); - // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingX); - // UI_SetNext(BackgroundColor, selection_color); - // UI_SetNext(FontSize, font_size); - // UI_BuildBoxEx(selection_box); - // } - - // //- Text - // { - // UI_SetNext(ChildAlignment, UI_Region_Left); - // UI_SetNext(Width, UI_Shrink(0, 1)); - // UI_SetNext(TextColor, display_text_color); - // UI_SetNext(Text, display_text); - // UI_SetNext( - // Flags, - // UI_BoxFlag_DrawText | - // UI_BoxFlag_DontTruncateText - // ); - // UI_BuildBox(); - // } - - // //- Caret - // if (has_focus) - // { - // UI_SetNext(Width, caret_width); - // UI_SetNext(Height, caret_height); - // UI_SetNext(FloatingPos, VEC2(palette->caret_end_px, 0)); - // UI_SetNext(Anchor, UI_Region_Left); - // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingX); - // UI_SetNext(BorderSize, 0); - // UI_SetNext(BackgroundColor, caret_color); - // UI_SetNext(FontSize, font_size); - // UI_BuildBoxEx(caret_box); - // } - // } - // } - // } - // } - // UI_PopCp(UI_TopCp()); - // } - - // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); - - // ////////////////////////////// - // //- Build palette items list - - // // Scissor box - // UI_SetNext(BackgroundColor, 0); - // UI_SetNext(Rounding, 0); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Grow(1, 0)); - // UI_SetNext(Flags, UI_BoxFlag_Scissor); - // UI_PushDF(Parent, UI_BuildRowEx(scissor_key)) - // { - // // Items & Scrollbar group - // UI_SetNext(Tint, 0); - // UI_SetNext(Rounding, 0); - // UI_PushDF(Parent, UI_BuildRow()) - // { - // // Items box - // UI_SetNext(BackgroundColor, 0); - // UI_SetNext(Rounding, 0); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Shrink(0, 1)); - // UI_SetNext(FloatingPos, VEC2(0, -lister_offset)); - // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingY | UI_BoxFlag_CaptureMouse | UI_BoxFlag_CaptureThroughChildren); - // UI_PushDF(Parent, UI_BuildRowEx(lister_key)) - // { - // UI_SetNext(Tint, 0); - // UI_SetNext(Rounding, 0); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Shrink(0, 1)); - // UI_PushDF(Parent, UI_BuildColumn()) - // { - // Enum(PaletteItemFlag) - // { - // PaletteItemFlag_None = 0, - // PaletteItemFlag_IsCmd = (1 << 0), - // PaletteItemFlag_IsTweakVar = (2 << 0), - // }; - - // Struct(PaletteItem) - // { - // PaletteItem *next; - // PaletteItem *prev; - - // UI_Key key; - // PaletteItemFlag flags; - - // V_Hotkey hotkeys[8]; - // String display_name; - - // V_CmdDesc cmd_desc; - // TweakVar tweak_var; - // }; - // PaletteItem *first_item = 0; - // PaletteItem *last_item = 0; - - // ////////////////////////////// - // //- Push command items - - // { - // for (u64 cmd_desc_idx = 0; cmd_desc_idx < countof(V_cmd_descs); ++cmd_desc_idx) - // { - // V_CmdDesc cmd_desc = V_cmd_descs[cmd_desc_idx]; - // if (!(cmd_desc.flags & V_CmdDescFlag_HideFromPalette)) - // { - // PaletteItem *item = PushStruct(frame->arena, PaletteItem); - // { - // item->key = UI_KeyF("cmd palette item %F", FmtString(cmd_desc.name)); - // item->display_name = cmd_desc.display_name; - // item->flags |= PaletteItemFlag_IsCmd; - // item->cmd_desc = cmd_desc; - // // FIXME: Attach active shortcuts instead of default hotkeys - // CopyStructs(item->hotkeys, cmd_desc.default_hotkeys, MinU32(countof(item->hotkeys), countof(cmd_desc.default_hotkeys))); - // } - // DllQueuePush(first_item, last_item, item); - // } - // } - // } - - // ////////////////////////////// - // //- Push tweak variables - - // TweakVarArray tweak_vars = GetAllTweakVars(frame->arena); - - // { - // for (i64 tweak_idx = 0; tweak_idx < tweak_vars.count; ++tweak_idx) - // { - // TweakVar tweak_var = tweak_vars.v[tweak_idx]; - // PaletteItem *item = PushStruct(frame->arena, PaletteItem); - // { - // item->key = UI_KeyF("tweak var palette item %F", FmtString(tweak_var.name)); - // item->display_name = tweak_var.name; - // item->flags |= PaletteItemFlag_IsTweakVar; - // item->tweak_var = tweak_var; - // } - // DllQueuePush(first_item, last_item, item); - // } - // } - - // ////////////////////////////// - // //- Prune non-matching items - - // if (is_searching) - // { - // for (PaletteItem *item = first_item; item;) - // { - // PaletteItem *next = item->next; - // { - // b32 prune = !StringContains(LowerString(frame->arena, item->display_name), search_pattern); - // if (prune) - // { - // DllQueueRemove(first_item, last_item, item); - // } - // } - // item = next; - // } - // } - - // ////////////////////////////// - // //- Build items - - // for (PaletteItem *item = first_item; item; item = item->next) - // { - // // Divider - // if (item != first_item) - // { - // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); - // } - - // if (UI_Presses(item->key, Button_M1)) - // { - // if (item->flags & PaletteItemFlag_IsCmd) - // { - // String cmd_name = item->cmd_desc.name; - // V_PushVisCmd(cmd_name); - // } - // } - - // // Vec4 item_color = theme.col.window_bg; - // Vec4 item_color = Zi; - // // Vec4 item_color = theme.col.hint; - // Vec4 item_border_color = Zi; - // if (item->flags & PaletteItemFlag_IsCmd) - // { - // item_color = LerpSrgb(item_color, theme.col.button_hot, UI_Hot(item->key)); - // item_color = LerpSrgb(item_color, theme.col.button_active, UI_Active(item->key)); - // item_border_color = LerpSrgb(item_border_color, theme.col.button_active, UI_Hot(item->key)); - // } - // else - // { - // item_border_color = LerpSrgb(item_border_color, theme.col.button_active, UI_Hot(item->key)); - // } - - // UI_SetNext(Tint, 0); - // // UI_SetNext(Width, UI_Px(total_width.v - window_padding.v * 2, 1)); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Fnt(1.5, 1)); - // UI_PushDF(Parent, UI_BuildRow()) - // { - // UI_SetNext(BackgroundColor, item_color); - // UI_SetNext(BorderColor, item_border_color); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Rounding, UI_Rpx(5)); - // // UI_SetNext(Width, item_col_width); - // UI_SetNext(Width, UI_Grow(1, 0)); - // // UI_SetNext(Height, UI_Px(item_size_px, 1)); - // // UI_SetNext(Height, UI_Fnt(1, 0)); - // UI_SetNext(ChildAlignment, UI_Region_Left); - // UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); - // UI_PushDF(Parent, UI_BuildRowEx(item->key)) - // { - // UI_Push(Tag, item->key.v); - - // UI_BuildSpacer(icon_col_width, Axis_X); - - // // Command label - // UI_SetNext(ChildAlignment, UI_Region_Left); - // UI_BuildLabel(item->display_name); - - // // Middle spacer - // UI_BuildSpacer(UI_Grow(1, 0), Axis_X); - - // // Tweak - // if (item->flags & PaletteItemFlag_IsTweakVar) - // { - // 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); - - // // Reset button - // if (!is_default) - // { - // // UI_BuildSpacer(UI_Px(spacing * 0.5, 1), Axis_X); - // UI_Key reset_key = UI_KeyF("reset"); - - // if (UI_Downs(reset_key, Button_M1)) - // { - // new_tweak_str = tweak_var.initial; - // } - // if (UI_HotAbsolute(reset_key)) - // { - // WND_SetCursor(window_frame, WND_CursorKind_Hand); - // } - - // Vec4 reset_bg = Zi; - // // reset_bg = LerpSrgb(reset_bg, theme.col.button_hot, UI_Hot(reset_key)); - // // reset_bg = LerpSrgb(reset_bg, theme.col.button_active, UI_Active(reset_key)); - - // Vec4 reset_bd = Zi; - // // reset_bd = LerpSrgb(reset_bd, theme.col.button_active, UI_Hot(reset_key)); - // // reset_bd = LerpSrgb(reset_bd, theme.col.text, UI_Hot(reset_key)); - - // Vec4 reset_text_col = theme.col.hint; - // reset_text_col = LerpSrgb(reset_text_col, theme.col.text, UI_Hot(reset_key)); - - // 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, 0); - // UI_SetNext(TextColor, reset_text_col); - // 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, theme.icon_font, UI_Icon_Loop2); - // } - - // // Tweak label - // { - // UI_BuildSpacer(icon_col_width, Axis_X); - // if (is_default) - // { - // UI_SetNext(TextColor, theme.col.hint); - // } - // else - // { - // UI_SetNext(TextColor, Color_White); - // } - // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h5); - // UI_SetNext(ChildAlignment, UI_Region_Left); - // UI_SetNext(Width, UI_Shrink(0, 1)); - // UI_SetNext(Height, UI_Shrink(0, 1)); - // UI_SetNext(Text, new_tweak_str); - // UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_DontTruncateText); - // UI_SetNext(BackgroundColor, 0); - // UI_SetNext(BorderColor, 0); - // UI_BuildBox(); - // } - - // UI_BuildSpacer(icon_col_width, Axis_X); - - // switch (tweak_var.kind) - // { - // // Boolean tweak - // case TweakKind_Bool: - // { - // UI_Key cb_key = UI_KeyF("tweak checkbox"); - - // b32 tweak_bool = CR_BoolFromString(new_tweak_str); - // if (UI_Downs(cb_key, Button_M1)) - // { - // tweak_bool = !tweak_bool; - // new_tweak_str = StringFromBool(frame->arena, tweak_bool); - // } - - // // Tweak checkbox - // Vec4 cb_bg_color = Zi; - // Vec4 cb_border_color = theme.col.window_bd; - // cb_bg_color = LerpSrgb(cb_bg_color, theme.col.positive, tweak_bool); - // cb_border_color = LerpSrgb(cb_border_color, theme.col.button_active, UI_Hot(cb_key)); - - // UI_SetNext(BackgroundColor, cb_bg_color); - // UI_SetNext(BorderColor, cb_border_color); - // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); - // 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_CaptureMouse); - // UI_BuildRowEx(cb_key); - // } break; - - // // Float tweak - // case TweakKind_Float: - // { - // UI_Key slider_key = UI_KeyF("tweak slider"); - // UI_Key marker_key = UI_KeyF("tweak slider marker"); - - // b32 is_hot = UI_HotAbsolute(slider_key) || UI_HotAbsolute(marker_key); - // b32 is_active = UI_Held(slider_key, Button_M1) || UI_Held(marker_key, Button_M1); - // f32 hot = MaxF32(UI_Hot(slider_key), UI_Hot(marker_key)); - - // Vec2 slider_pos = UI_Rect(slider_key).p0; - // Vec2 slider_dims = DimsFromRng2(UI_Rect(slider_key)); - // Vec2 marker_dims = DimsFromRng2(UI_Rect(marker_key)); - // Vec2 half_marker_dims = MulVec2(marker_dims, 0.5); - - // f64 range_min = tweak_var.range.min; - // f64 range_max = tweak_var.range.max; - // if (range_max <= range_min) - // { - // range_max = range_min + 1; - // } - - // f64 tweak_float = CR_FloatFromString(new_tweak_str); - // { - // if (is_active) - // { - // f64 initial_slider_pos = UI_DragRect(slider_key).p0.x; - // f64 initial_marker_width = DimsFromRng2(UI_DragRect(marker_key)).x; - // f64 initial_slider_width = DimsFromRng2(UI_DragRect(slider_key)).x - initial_marker_width; - // f64 initial_cursor = ui_frame->drag_cursor_pos.x; - // f64 initial_ratio = UI_DragMisc(slider_key); - - // f64 virtual_slider_start = initial_cursor - (initial_slider_width * initial_ratio); - // f64 virtual_slider_end = virtual_slider_start + initial_slider_width; - // f64 virtual_cursor_ratio = (frame->ui_cursor.x - virtual_slider_start) / (virtual_slider_end - virtual_slider_start); - - // tweak_float = LerpF64(range_min, range_max, virtual_cursor_ratio); - // tweak_float = ClampF64(tweak_float, range_min, range_max); - // if (frame->ui_cursor.x != prev_frame->ui_cursor.x) - // { - // new_tweak_str = StringFromFloat(frame->arena, tweak_float, tweak_var.precision); - // } - // } - // if (is_hot) - // { - // WND_SetCursor(window_frame, WND_CursorKind_HorizontalResize); - // } - // } - // f32 ratio = 0; - // ratio = (tweak_float - range_min) / (range_max - range_min); - // ratio = ClampF32(ratio, 0, 1); - - // Vec4 slider_bg_color = theme.col.window_bg; - // 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, hot); - // marker_bg_color = LerpSrgb(marker_bg_color, theme.col.text, hot); - - // UI_SetNext(BackgroundColor, slider_bg_color); - // UI_SetNext(BorderColor, slider_border_color); - // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Width, UI_Fnt(10, 1)); - // UI_SetNext(Height, UI_Px(tweak_size_px * 0.75, 1)); - // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); - // UI_SetNext(Misc, ratio); - // UI_PushDF(Parent, UI_BuildRowEx(slider_key)) - // { - // f32 marker_pos = ratio * (slider_dims.x - marker_dims.x); - - // // Slider progress - // { - // UI_SetNext(BackgroundColor, slider_progress_color); - // // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); - // UI_SetNext(Rounding, 0); - // UI_SetNext(BorderColor, 0); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Width, UI_Px(marker_pos + half_marker_dims.x, 0)); - // UI_SetNext(Height, UI_Px(tweak_size_px * 0.75, 1)); - // UI_BuildBox(); - // } - - // // Slider marker - // { - // UI_SetNext(BackgroundColor, marker_bg_color); - // UI_SetNext(BorderColor, slider_border_color); - // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Width, UI_Px(tweak_size_px, 1)); - // UI_SetNext(Height, UI_Px(tweak_size_px, 1)); - // // 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_DontClampFloatingX | UI_BoxFlag_DontClampFloatingY | UI_BoxFlag_CaptureMouse); - // UI_BuildBoxEx(marker_key); - // } - // } - // } break; - // } - - // if (!MatchString(old_tweak_str, new_tweak_str)) - // { - // TweakVar new_tweak_var = tweak_var; - // new_tweak_var.value = new_tweak_str; - // TweakEx(frame->arena, new_tweak_var, 1); - // } - // } - - // // Command hotkey buttons - // for (u64 i = 0; i < countof(item->hotkeys); ++i) - // { - // UI_Key hotkey_box = UI_KeyF("hotkey%F", FmtUint(i)); - - // Vec4 hotkey_color = Zi; - // Vec4 hotkey_border_color = Zi; - // { - // Vec4 hovered_color = Rgb32(0x103c4c); - // Vec4 pressed_color = hovered_color; - // pressed_color.w = 0.2; - // f32 hotkey_hot = UI_Hot(hotkey_box); - // f32 hotkey_active = UI_Active(hotkey_box); - // f32 hotkey_hovered = UI_HotAbsolute(hotkey_box); - // hotkey_color = LerpSrgb(hotkey_color, hovered_color, hotkey_hot); - // hotkey_color = LerpSrgb(hotkey_color, pressed_color, hotkey_active * hotkey_hovered); - // hotkey_border_color = LerpSrgb(hotkey_border_color, Rgb32(0x0078a6), hotkey_hot); - // } - - // V_Hotkey hotkey = item->hotkeys[i]; - // if (hotkey.button == Button_None) - // { - // break; - // } - // else - // { - // UI_BuildSpacer(UI_Px(10, 1), Axis_X); - - // String hotkey_name = V_StringFromHotkey(UI_FrameArena(), hotkey); - // UI_SetNext(BackgroundColor, hotkey_color); - // UI_SetNext(BorderColor, hotkey_border_color); - // UI_SetNext(Text, hotkey_name); - // UI_SetNext(Width, UI_Shrink(theme.text_padding_x, 1)); - // UI_SetNext(Height, UI_Grow(1, 0)); - // UI_SetNext(Rounding, UI_Rpx(5)); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(ChildAlignment, UI_Region_Center); - // UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); - // UI_BuildRowEx(hotkey_box); - // } - // } - - // // UI_BuildSpacer(icon_col_width, Axis_X); - // } - // } - // } - // } - // } - // } - - - - - - - - - - // //- Scrollbar - // if (scrollbar_visible) - // { - // UI_BuildSpacer(window_padding, Axis_X); - - // UI_SetNext(Width, scrollbar_width); - // UI_PushDF(Parent, UI_BuildBoxEx(scrollbar_key)) - // { - // //- Scrollbar up button - // { - // Vec4 col = theme.col.hint; - // Vec4 bd_col = Zi; - // col = LerpSrgb(col, theme.col.button_active, UI_Active(scrollbar_up_key)); - // bd_col = LerpSrgb(bd_col, theme.col.button_hot, UI_Hot(scrollbar_up_key)); - // bd_col = LerpSrgb(bd_col, theme.col.button_active, UI_Active(scrollbar_up_key)); - // UI_SetNext(ChildAlignment, UI_Region_Center); - // UI_SetNext(BorderColor, bd_col); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Rounding, UI_Rgrow(theme.rounding * 0.5)); - // UI_SetNext(TextColor, col); - // UI_SetNext(Width, UI_Grow(1, 1)); - // UI_SetNext(Height, UI_Fnt(1.5, 1)); - // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); - // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); - // UI_BuildIconEx(scrollbar_up_key, theme.icon_font, UI_Icon_ArrowUp2); - // } - - // //- Scrollbar thumb - // { - // UI_SetNext(Height, UI_Grow(1, 0)); - // UI_PushCp(UI_BuildBoxEx(track_key)); - // { - // Vec4 bg = theme.col.button_hot; - // Vec4 bd = bg; - // bg = LerpSrgb(bg, theme.col.button_active, UI_Active(thumb_key)); - // bd = LerpSrgb(bg, theme.col.button_active, UI_Hot(thumb_key)); - - // UI_SetNext(BackgroundColor, bg); - // UI_SetNext(Width, UI_Grow(1, 0)); - // UI_SetNext(Height, UI_Px(new_thumb_height, 1)); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(BorderColor, bd); - // UI_SetNext(Rounding, UI_Rgrow(0.75 * theme.rounding)); - // UI_SetNext(FloatingPos, VEC2(0, new_thumb_start)); - // UI_SetNext(Anchor, UI_Region_Center); - // UI_SetNext(Anchor, UI_Region_Top); - // // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Floating); - // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingY); - // UI_SetNext(Anchor, UI_Region_Top); - // UI_BuildBoxEx(thumb_key); - // } - // UI_PopCp(UI_TopCp()); - // } - - // //- Scrollbar down button - // { - // Vec4 col = theme.col.hint; - // Vec4 bd_col = Zi; - // col = LerpSrgb(col, theme.col.button_active, UI_Active(scrollbar_down_key)); - // bd_col = LerpSrgb(bd_col, theme.col.button_hot, UI_Hot(scrollbar_down_key)); - // bd_col = LerpSrgb(bd_col, theme.col.button_active, UI_Active(scrollbar_down_key)); - // UI_SetNext(ChildAlignment, UI_Region_Center); - // UI_SetNext(BorderColor, bd_col); - // UI_SetNext(BorderSize, 1); - // UI_SetNext(Rounding, UI_Rgrow(theme.rounding * 0.5)); - // UI_SetNext(TextColor, col); - // UI_SetNext(Width, UI_Grow(1, 1)); - // UI_SetNext(Height, UI_Fnt(1.5, 1)); - // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); - // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); - // UI_BuildIconEx(scrollbar_down_key, theme.icon_font, UI_Icon_ArrowDown2); - // } - // } - // } - // } - // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); - // } - - // UI_BuildSpacer(window_padding, Axis_X); - // // UI_BuildSpacer(UI_Fnt(100, 1), Axis_Y); - - - - // // FIXME: Remove this - // // if (scrollbar_visible) - // // { - - // // Vec2 scrollbar_pos = scrollbar_reps.UI_Rect().p0; - // // Vec2 scrollbar_dims = DimsFromRng2(scrollbar_reps.UI_Rect()); - // // Vec2 thumb_dims = DimsFromRng2(UI_Rect(thumb_key)); - // // // Vec2 half_thumb_dims = MulVec2(thumb_dims, 0.5); - - - // // // f32 range_min = tweak_var.range.min; - // // // f32 range_max = tweak_var.range.max; - // // // if (range_max <= range_min) - // // // { - // // // range_max = range_min + 1; - // // // } - - - - - - - // // // f32 ratio = 0; - // // // ratio = (tweak_float - range_min) / (range_max - range_min); - // // // ratio = ClampF32(ratio, 0, 1); - - // // if (thumb_reps.draw.buttons[Button_M1].downs) - // // { - // // palette->scroll_begin = palette->scroll; - // // } - // // if (thumb_reps.draw.buttons[Button_M1].held) - // // { - // // palette->scroll = palette->scroll_begin + (frame->screen_cursor.y - ui_frame->drag_cursor_pos.y); - // // } - // // palette->scroll = MaxF32(palette->scroll, 0); - - // // // f32 thumb_offset = 50; - // // f32 thumb_offset = palette->scroll; - - - - - - - // // UI_SetNext(Width, scrollbar_width); - // // UI_PushCp(UI_BuildBoxEx(scrollbar_key)); - // // { - // // UI_Size thumb_height = UI_Fnt(10, 1); - - // // Vec4 thumb_color = VEC4(0, 0.5, 1, 1); - // // thumb_color.a = thumb_reps.UI_Hot() * 0.5 + 0.5; - - // // UI_SetNext(BackgroundColor, thumb_color); - // // UI_SetNext(Width, UI_Grow(1, 0)); - // // UI_SetNext(Height, thumb_height); - // // UI_SetNext(Rounding, UI_Rgrow(1 * theme.rounding)); - // // UI_SetNext(FloatingPos, VEC2(0, thumb_offset)); - // // // UI_SetNext(Anchor, UI_Region_Center); - // // UI_SetNext(Anchor, UI_Region_Top); - // // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Floating); - // // UI_SetNext(Anchor, UI_Region_Top); - // // UI_BuildBoxEx(thumb_key); - // // } - // // UI_PopCp(UI_TopCp()); - // // } - // } - // // UI_BuildSpacer(window_padding, Axis_Y); - - // // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); - - // UI_BuildSpacer(header_height, Axis_Y); - // } - // } - // // UI_PopCp(UI_TopCp()); - // UI_PopCp(palette_cp); - // } - - // UI_Pop(Tag); - // } - - - - - - - - - - - - - -