From 80ee73128d5e917a2ae16d03ca337f4d1cdd3c67 Mon Sep 17 00:00:00 2001 From: ahsanswr Date: Mon, 15 Jun 2026 16:05:56 +0500 Subject: [PATCH] Code cleanup --- client/configuration.cpp | 9 +-- client/configuration.h | 2 +- client/constants.h | 4 +- client/render/imgui_impl.cpp | 10 ++- client/render/imgui_impl.h | 6 +- client/render/ui_theme.cpp | 2 +- client/render/ui_theme.h | 28 ++++---- client/render/ui_widgets.cpp | 95 +++++++++++++----------- client/render/ui_widgets.h | 100 +++++++++++--------------- client/scenes/app_launcher.cpp | 11 ++- client/scenes/gui_common.h | 5 +- client/scenes/gui_settings.cpp | 18 ++--- client/scenes/lobby_gui.cpp | 36 ++++------ client/scenes/lobby_gui_customize.cpp | 5 +- client/scenes/lobby_gui_theme.cpp | 5 +- client/scenes/stream.cpp | 4 +- client/scenes/stream.h | 2 +- client/scenes/stream_gui.cpp | 24 +++---- 18 files changed, 159 insertions(+), 207 deletions(-) diff --git a/client/configuration.cpp b/client/configuration.cpp index 195f435e..562c4e5b 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -39,9 +39,8 @@ static const float max_default_rate = 100; namespace { -// Plain scalar settings whose JSON load/save is purely mechanical (key <-> member). -// Settings needing validation, optionals, enums, nested objects or maps are handled -// explicitly in the constructor and save() below. +// scalar settings with a mechanical key <-> member mapping +// everything else is handled explicitly in the constructor and save() below using config_member = std::variant< bool configuration::*, float configuration::*, @@ -239,11 +238,10 @@ configuration::configuration(xr::system & system, xr::session & session) servers.emplace(data.service.txt["cookie"], data); } - // plain scalar settings for (const auto & f: scalar_fields()) load_field(root, *this, f); - // settings that need more than a mechanical key <-> member mapping + // settings with non-mechanical encoding if (auto val = root["preferred_refresh_rate"]; val.is_double()) { float f = val.get_double(); @@ -362,7 +360,6 @@ void configuration::save() json << "{\"servers\":[" << servers_str << "]"; - // plain scalar settings for (const auto & f: scalar_fields()) save_field(json, *this, f); diff --git a/client/configuration.h b/client/configuration.h index 6fac3dca..90ed37ce 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -82,7 +82,7 @@ public: bool app_list_view = false; uint32_t app_icon_size = 0; - // Interface theme; defaults match the built-in "Dark" preset / "Blue" accent + // interface theme, defaults match the built-in "Dark" preset and "Blue" accent std::string theme_preset = "Dark"; std::string theme_accent = "Blue"; float theme_rounding = 8; diff --git a/client/constants.h b/client/constants.h index 23bbed3e..d5744c90 100644 --- a/client/constants.h +++ b/client/constants.h @@ -65,10 +65,10 @@ constexpr float pointer_fading_distance = 40; constexpr uint32_t pointer_color = 0x40ffffff; constexpr uint32_t pointer_color_border = 0xff000000; -// Offset of a popup composition layer in front of its main GUI panel, so combos/modals pop out +// offset of a popup layer in front of its main GUI panel constexpr glm::vec3 popup_position = {0, 0, 0.05}; -// Color scale/bias applied to the main GUI panel while a modal popup is shown, so it dims behind the popup +// scale/bias dimming the main GUI panel behind a popup constexpr XrColor4f popup_dimming_scale = {0.5, 0.5, 0.5, 1}; constexpr XrColor4f popup_dimming_bias = {0.25, 0.25, 0.25, 0}; } // namespace constants::gui diff --git a/client/render/imgui_impl.cpp b/client/render/imgui_impl.cpp index 6c076f31..82144441 100644 --- a/client/render/imgui_impl.cpp +++ b/client/render/imgui_impl.cpp @@ -1278,7 +1278,7 @@ void imgui_context::tooltip(std::string_view text, std::optional anchor) assert(std::ranges::contains(layers_, true, &viewport::tooltip_viewport)); auto & tooltip_layer = *std::ranges::find(layers_, true, &viewport::tooltip_viewport); - // Anchor above the given display point, or above the last item's rect (top center) + // anchor above the given display point, or above the last item's rect (top center) ImVec2 item_position = anchor.value_or(ImVec2{ (ImGui::GetItemRectMin().x + ImGui::GetItemRectMax().x) / 2, ImGui::GetItemRectMin().y, @@ -1289,7 +1289,7 @@ void imgui_context::tooltip(std::string_view text, std::optional anchor) viewport->Pos = ImVec2(tooltip_layer.vp_origin.x, tooltip_layer.vp_origin.y); viewport->Size = ImVec2(tooltip_layer.vp_size.x, tooltip_layer.vp_size.y); - // Draw the tooltip in the tooltip layer, styled to match the active theme + // Draw the tooltip in the tooltip layer, themed // Clamp position to avoid overflowing on the left or the right const wivrn::ui::theme & t = wivrn::ui::current(); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, constants::style::tooltip_padding); @@ -1343,15 +1343,13 @@ void ScrollWhenDragging() static int active_id; static ImVec2 cumulated_delta; - // Don't start a drag while a popup is open or just closed: in VR the ray snaps back - // and can synthesise a click that would scroll right after picking a combo value. + // don't drag while a popup is open or just closed: the ray snaps back and synthesises a click static bool popup_was_open; const bool popup_open = ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel); bool HoveredIdAllowOverlap_backup = std::exchange(g.HoveredIdAllowOverlap, true); bool ActiveIdAllowOverlap_backup = std::exchange(g.ActiveIdAllowOverlap, true); - // Start only over this window or a child panel with no active widget. ChildWindows - // lets it work over cards; the ActiveId guard keeps controls from scrolling the page. + // start only over this window or a child card, and only with no active widget const bool over = ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows); if (active_id == 0 and g.ActiveId == 0 and not popup_open and not popup_was_open and over and ImGui::IsMouseClicked(mouse_button, ImGuiInputFlags_None, /*id*/ ImGuiKeyOwner_Any)) { diff --git a/client/render/imgui_impl.h b/client/render/imgui_impl.h index 83202a12..978d22a8 100644 --- a/client/render/imgui_impl.h +++ b/client/render/imgui_impl.h @@ -226,8 +226,7 @@ public: return layers_; } - // Place a satellite layer (popup, keyboard, …) relative to a base layer: same - // orientation as the base (optionally post-rotated), offset in the base's local frame. + // place a satellite layer at base orientation (optionally post-rotated), offset in the base's local frame void place_layer_relative(size_t layer, size_t base, glm::vec3 offset, glm::quat extra_rotation = glm::quat(1, 0, 0, 0)); std::vector windows(); @@ -255,8 +254,7 @@ public: void vibrate_on_hover(); void set_hovered_item(); void set_controllers_enabled(bool value); - // anchor, if set, positions the tooltip above that display point (e.g. the mouse) - // instead of above the last item's rect + // anchor, if set, positions the tooltip above that display point instead of above the last item's rect void tooltip(std::string_view text, std::optional anchor = std::nullopt); std::array is_aim_interaction() const { diff --git a/client/render/ui_theme.cpp b/client/render/ui_theme.cpp index af7ef2a0..77d92737 100644 --- a/client/render/ui_theme.cpp +++ b/client/render/ui_theme.cpp @@ -56,7 +56,7 @@ static theme dark_default() t.rounding = 8; t.card_rounding = 14; t.border_size = 1; - t.font_scale = 1.0; // user multiplier; 100% maps to metrics::font_base + t.font_scale = 1.0; // user multiplier, 100% maps to metrics::font_base return t; } diff --git a/client/render/ui_theme.h b/client/render/ui_theme.h index cd188e2a..924191aa 100644 --- a/client/render/ui_theme.h +++ b/client/render/ui_theme.h @@ -62,8 +62,7 @@ struct theme float font_scale; // global text size multiplier - // Convert to packed color, applying the current global alpha so widgets drawn - // through the draw list dim with ImGui::BeginDisabled() (and any pushed alpha). + // packed color with the current global alpha applied, so draw-list widgets dim with BeginDisabled() ImU32 col(const ImVec4 & c) const { ImVec4 v = c; @@ -71,23 +70,22 @@ struct theme return ImGui::ColorConvertFloat4ToU32(v); } - // Push colors and metrics into the global ImGui style + // push colors and metrics into the global ImGui style void apply() const; }; -// Fixed design tokens shared by the widgets +// fixed design tokens shared by the widgets namespace metrics { -constexpr float font_base = 0.765; // design default text scale, i.e. what the user-facing 100% maps to +constexpr float font_base = 0.765; // user-facing 100% text scale constexpr float font_title = 1.7; // page header, x base font size constexpr float font_description = 0.82; // muted secondary text, x base font size constexpr ImVec2 button_padding = {26, 14}; -constexpr ImVec2 card_padding = {28, 22}; // regular cards (settings, etc.) -constexpr ImVec2 list_card_padding = {18, 18}; // cards holding a list of rows (server list) +constexpr ImVec2 card_padding = {28, 22}; // regular cards +constexpr ImVec2 list_card_padding = {18, 18}; // cards holding a list of rows -// Shared height of every full-width control (slider, segmented, combo, input) -// so they line up in a setting row, in multiples of ImGui::GetFrameHeight() +// shared height of every full-width control so they line up in a setting row, x frame height constexpr float control_height = 1.65; constexpr float toggle_aspect = 1.9; // track width / height @@ -109,7 +107,7 @@ constexpr float list_row_box = 52; // leading icon/thumbnail size in a li constexpr float list_row_box_large = 80; // min thumbnail size for full-height list rows constexpr float list_row_pad = 12; // inner padding of a list row, both axes constexpr ImVec2 chip_padding = {12, 6}; // inner padding of a chip/badge -constexpr float chip_pill_padding_x = 18; // roomier horizontal padding for height-override pill chips (top bar) +constexpr float chip_pill_padding_x = 18; // roomier horizontal padding for top-bar pill chips constexpr float input_padding_x = 14; // horizontal text padding inside inputs constexpr float font_modal_title = 1.2; // modal heading, x base font size @@ -120,13 +118,12 @@ constexpr float nav_section_gap = 18; // space above a sidebar section header constexpr ImVec2 card_item_spacing = {12, 10}; // ItemSpacing pushed around a card section constexpr float setting_control_width = 480; // width of the control in a setting row -// Application shell (top bar + navigation sidebar + content panel), shared by the lobby -// and the in-stream window +// application shell: top bar, sidebar, content panel, shared by lobby and in-stream window constexpr float sidebar_width = 300; constexpr float top_bar_height = 72; constexpr float content_margin = 20; // gap around the main content panel -// Application launcher grid +// application launcher grid constexpr float app_icon_small = 120; constexpr float app_icon_medium = 176; constexpr float app_icon_large = 240; @@ -137,12 +134,11 @@ constexpr float app_spinner_radius = 110; // app-starting spinner constexpr float app_spinner_thickness = 22; } // namespace metrics -// Theme in effect, call current().apply() after mutating +// theme in effect, call current().apply() after mutating theme & current(); void set_theme(const theme & t); -// Opacity of the panel and card backgrounds, 0..1. Kept separate from the theme -// presets so switching palette never resets the user's transparency. +// panel and card background opacity, 0..1, kept out of the presets so switching palette keeps it float & background_alpha(); std::vector presets(); diff --git a/client/render/ui_widgets.cpp b/client/render/ui_widgets.cpp index dc300cb7..9124177d 100644 --- a/client/render/ui_widgets.cpp +++ b/client/render/ui_widgets.cpp @@ -34,6 +34,9 @@ #include #include +// drag-to-scroll helper, defined in imgui_impl.cpp +void ScrollWhenDragging(); + namespace wivrn::ui { @@ -41,6 +44,9 @@ namespace { std::function hover_haptic_hook; std::function tooltip_hook; + +// height reserved for the pinned sidebar footer, set by begin_sidebar +float sidebar_footer_height = 0; } // namespace void set_hover_haptic(std::function hook) @@ -53,15 +59,14 @@ void set_tooltip_hook(std::function hook) tooltip_hook = std::move(hook); } -// Fire the hover haptic for the last submitted item, if a hook is installed. -// The hook itself checks whether that item is actually hovered. +// fire the hover haptic for the last submitted item, hook checks if it is hovered static void hover_haptic() { if (hover_haptic_hook) hover_haptic_hook(); } -// Show a tooltip for the last item; caller ensures it is hovered +// show a tooltip for the last item, caller ensures it is hovered static void show_tooltip(const std::string & text) { if (not text.empty() and tooltip_hook) @@ -85,8 +90,8 @@ void page_header(const std::string & title, const std::string & subtitle) ImGui::Dummy({0, ImGui::GetStyle().ItemSpacing.y}); } -// A card is a visual rounded panel, not a child window, so the page stays one scroll -// surface. Drawn behind the content using last frame's height; pair with end_card. +// a rounded panel, not a child window, so the page stays one scroll surface, drawn behind +// the content using last frame's height, pair with end_card namespace { struct card_frame @@ -194,7 +199,7 @@ float setting_label(const std::string & title, const std::string & description, { ImGui::PushFont(nullptr, style.FontSizeBase * metrics::font_description); ImGui::PushStyleColor(ImGuiCol_Text, t.text_muted); - // never wider than half the row; wrap to as many lines as needed so it shows in full + // never wider than half the row, wrap to as many lines as needed const float desc_w = ImMin(text_w, avail * 0.5f); ImGui::PushTextWrapPos(start.x + desc_w); ImGui::TextUnformatted(description.c_str()); @@ -343,7 +348,7 @@ bool button(const char * icon, const std::string & label, button_style s, const ImGui::PushFont(nullptr, glyph_size); unsigned int codepoint = 0; ImTextCharFromUtf8(&codepoint, icon, nullptr); - const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph((ImWchar)codepoint); + const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph(ImWchar(codepoint)); if (glyph) draw->AddText({x, center.y - (glyph->Y0 + glyph->Y1) * 0.5f}, col, icon); else @@ -392,7 +397,7 @@ bool icon_button(const char * icon, const ImVec2 & size_arg, bool active, const ImDrawList * draw = window->DrawList; draw->AddRectFilled(bb.Min, bb.Max, t.col(bg), t.rounding); - // centre the glyph on its ink box, not CalcTextSize (which includes bearing/leading) + // centre the glyph on its ink box, not CalcTextSize const float glyph_size = size.y * metrics::icon_button_glyph; ImGui::PushFont(nullptr, glyph_size); const ImU32 col = t.col(active ? t.on_accent : t.text); @@ -400,7 +405,7 @@ bool icon_button(const char * icon, const ImVec2 & size_arg, bool active, const unsigned int codepoint = 0; ImTextCharFromUtf8(&codepoint, icon, nullptr); - const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph((ImWchar)codepoint); + const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph(ImWchar(codepoint)); if (glyph) draw->AddText({center.x - (glyph->X0 + glyph->X1) * 0.5f, center.y - (glyph->Y0 + glyph->Y1) * 0.5f}, col, icon); else @@ -458,7 +463,7 @@ bool cancel_progress_button(const char * id, float fraction, const ImVec2 & size else { // indeterminate: a rotating quarter arc - const float a0 = (float)g.Time * 3.5f; + const float a0 = float(g.Time) * 3.5f; draw->PathArcTo(center, radius, a0, a0 + IM_PI * 0.5f, 24); draw->PathStroke(accent, ImDrawFlags_None, thickness); } @@ -469,7 +474,7 @@ bool cancel_progress_button(const char * id, float fraction, const ImVec2 & size const ImU32 col = t.col(hovered or held ? t.text : t.text_muted); unsigned int codepoint = 0; ImTextCharFromUtf8(&codepoint, ICON_FA_STOP, nullptr); - const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph((ImWchar)codepoint); + const ImFontGlyph * glyph = ImGui::GetFontBaked()->FindGlyph(ImWchar(codepoint)); if (glyph) draw->AddText({center.x - (glyph->X0 + glyph->X1) * 0.5f, center.y - (glyph->Y0 + glyph->Y1) * 0.5f}, col, ICON_FA_STOP); ImGui::PopFont(); @@ -483,8 +488,7 @@ float reset_slot_width() return ImGui::GetFrameHeight() * metrics::control_height + ImGui::GetStyle().ItemSpacing.x; } -// Trailing reset button on a value control's row; empty slot when show is false so the -// right edge stays put. Returns true when tapped. +// trailing reset button on a value control's row, empty slot when not shown so the right edge stays put static bool reset_slot(const char * id, bool show) { const float side = ImGui::GetFrameHeight() * metrics::control_height; @@ -509,7 +513,7 @@ bool toggle(const char * id, bool * v, const bool * default_value) const theme & t = current(); const ImGuiStyle & style = ImGui::GetStyle(); - // match the height of the other controls (sliders, combo, ...) + // match the height of the other controls const float height = ImGui::GetFrameHeight() * metrics::control_height; const float width = height * metrics::toggle_aspect; const float radius = height * 0.5f; @@ -591,7 +595,7 @@ bool slider_int(const char * id, int * v, int v_min, int v_max, const char * for draw->AddRectFilled(bb.Min, bb.Max, t.col(t.control), t.rounding); if (fraction > 0) { - // round the right corners too once the fill reaches the box edge, else they stay sharp over the rounded background + // round the right corners too once the fill reaches the box edge const ImDrawFlags fill_flags = fill_x >= bb.Max.x - t.rounding ? ImDrawFlags_RoundCornersAll : ImDrawFlags_RoundCornersLeft; draw->AddRectFilled(bb.Min, {fill_x, bb.Max.y}, t.col(t.accent_active), t.rounding, fill_flags); } @@ -686,13 +690,12 @@ bool segmented(const char * id, const std::vector & options, int * namespace { -// Where combo modals open, in imgui display coords. Set each frame by the lobby. +// where combo modals open, in imgui display coords, set each frame by the lobby ImVec2 popup_center = {0, 0}; -// Height of the popup layer; caps tall combo lists so they scroll. 0 = unbounded. +// height of the popup layer, caps tall combo lists so they scroll, 0 = unbounded float popup_available_height = 0; -// One selectable option inside the combo modal. A tall, full-width touch target -// with the name and an optional muted description. +// one selectable option inside the combo modal, tall full-width touch target with an optional description bool combo_row(const combo_item & item, bool selected) { ImGuiWindow * window = ImGui::GetCurrentWindow(); @@ -829,11 +832,9 @@ bool combo(const char * id, const std::string & title, const std::vector 0) { @@ -859,7 +860,7 @@ bool combo(const char * id, const std::string & title, const std::vector 0 ? metrics::chip_pill_padding_x : pad.x; const float dot_r = ts.y * 0.26f; const float dot_gap = dot ? dot_r * 2 + pad_x * 0.55f : 0; @@ -982,16 +983,14 @@ bool nav_item(const char * icon, const std::string & label, bool selected) const float lum = t.background.x * 0.299f + t.background.y * 0.587f + t.background.z * 0.114f; if (selected) { - // Pure accent fill for the active tab. + // accent fill for the active tab draw->AddRectFilled(bb.Min, bb.Max, t.col(t.accent), t.rounding); } else if (hovered) { - // Subtle lighten on dark themes, darken on light ones. The framebuffer - // blends in linear light, so a fixed alpha would look far stronger on a - // dark surface than a light one. Solve for the alpha that yields a constant - // *perceived* (gamma-space) step instead. - const float step = lum < 0.5f ? 0.10f : 0.06f; // perceptual lightness delta; stronger on dark + // lighten on dark themes, darken on light ones, the framebuffer blends in linear + // light, so solve for the alpha that yields a constant perceived (gamma-space) step + const float step = lum < 0.5f ? 0.10f : 0.06f; // perceptual lightness delta, stronger on dark auto to_linear = [](float c) { return c <= 0.04045f ? c / 12.92f : std::pow((c + 0.055f) / 1.055f, 2.4f); }; const float overlay = lum < 0.5f ? 1.f : 0.f; // lighten vs darken const float ys = to_linear(lum); @@ -1023,8 +1022,7 @@ static int input_text_resize(ImGuiInputTextCallbackData * data) return 0; } -// Common frame styling for the input widgets, control height. Returns the count of -// style colors / vars pushed so the caller can pop them. +// common frame styling for the input widgets, paired with pop_input_style static void push_input_style(float height) { const theme & t = current(); @@ -1194,8 +1192,7 @@ list_row_result begin_list_row(const char * id, const char * icon, ImTextureID i const ImVec2 p0 = window->DC.CursorPos; const float avail = ImGui::GetContentRegionAvail().x; - // non-interactive rows (the body does nothing, only trailing controls act) just reserve - // layout space -- no click area and no hover highlight on the row itself + // non-interactive rows just reserve layout space, no click area and no hover highlight bool clicked = false; if (interactive) { @@ -1211,12 +1208,11 @@ list_row_result begin_list_row(const char * id, const char * icon, ImTextureID i ImDrawList * draw = window->DrawList; const ImRect bb(p0, p0 + ImVec2(avail, row_h)); - // No tinted background for the selected row -- callers indicate the active item with a - // chip instead. Still show the hover highlight. + // no tinted background for the selected row, callers mark the active item with a chip if (hovered) draw->AddRectFilled(bb.Min, bb.Max, t.col(t.control), t.card_rounding); - // leading thumbnail or icon box; large_thumb spans the full row height + // leading thumbnail or icon box, large_thumb spans the full row height const float thumb = large_thumb ? row_h - 2 * pad : box; const ImVec2 box_min = {p0.x + pad, p0.y + (row_h - thumb) * 0.5f}; const ImVec2 box_max = box_min + ImVec2(thumb, thumb); @@ -1322,7 +1318,7 @@ int action_menu(const char * id, const char * icon, const std::vector & r ImGui::PopStyleColor(); } -void begin_sidebar(float top_bar_h, float tab_width) +void begin_sidebar(float top_bar_h, float tab_width, int footer_items) { - // shares the transparent window background; sections separated by shell_dividers + // shares the transparent window background, sections separated by shell_dividers ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4{0, 0, 0, 0}); ImGui::SetCursorPos({0, top_bar_h}); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {16, 16}); ImGui::BeginChild("Tabs", {tab_width, ImGui::GetWindowSize().y - top_bar_h}, ImGuiChildFlags_AlwaysUseWindowPadding); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {0, 4}); + + // nav list scrolls in a child that fills the rest, footer stays pinned in footer_items rows + const float row_h = ImGui::GetFrameHeight() * metrics::control_height + ImGui::GetStyle().ItemSpacing.y; + sidebar_footer_height = footer_items > 0 ? footer_items * row_h : 0; + ImGui::BeginChild("TabsScroll", {0, ImGui::GetContentRegionAvail().y - sidebar_footer_height}); +} + +void sidebar_footer() +{ + ::ScrollWhenDragging(); // drag to scroll the nav list, like the rest of the GUI + ImGui::EndChild(); // TabsScroll + // pin the footer to the bottom of the sidebar + ImGui::SetCursorPosY(ImGui::GetContentRegionMax().y - sidebar_footer_height); } void end_sidebar() { - ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing - ImGui::EndChild(); + ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing + ImGui::EndChild(); // Tabs ImGui::PopStyleVar(); // ImGuiStyleVar_WindowPadding ImGui::PopStyleColor(); // ImGuiCol_ChildBg } diff --git a/client/render/ui_widgets.h b/client/render/ui_widgets.h index 89c95bc9..f3aeccaa 100644 --- a/client/render/ui_widgets.h +++ b/client/render/ui_widgets.h @@ -24,8 +24,8 @@ #include #include -// Themed, reusable UI widgets. Colors and metrics come from wivrn::ui::current(). -// Display text is taken by const std::string &; ids and icon glyphs stay const char *. +// Themed, reusable UI widgets, colors and metrics from wivrn::ui::current() +// Display text takes const std::string &, ids and icon glyphs stay const char * namespace wivrn::ui { @@ -42,49 +42,44 @@ void page_header(const std::string & title, const std::string & subtitle = {}); // Rounded panel, pair with end_card bool begin_card(const char * id, const ImVec2 & size = {0, 0}); -// Same, but with tighter padding for cards that hold a list of rows +// Tighter padding, for cards holding a list of rows bool begin_list_card(const char * id); void end_card(); // Full-width divider between rows of a card void row_separator(); -// Title and wrapped muted description on the left, control_width reserved on the right. -// Returns the window-local y of the label bottom, so the caller can keep the row tall -// enough for a multi-line label. +// Title and wrapped muted description on the left, control_width reserved on the right +// Returns the window-local y of the label bottom, to keep the row tall enough for a multi-line label float setting_label(const std::string & title, const std::string & description, float control_width); -// "