From b3333241c528b9336721d263c2d5f67607694f59 Mon Sep 17 00:00:00 2001 From: Irastris Date: Mon, 27 Apr 2026 22:00:18 -0400 Subject: [PATCH] Add right-pane for item descriptions --- src/dusk/ui/game_menu.cpp | 25 ++++++++++++++++++++++++- src/dusk/ui/window.cpp | 16 ++++++++++++++++ src/dusk/ui/window.hpp | 6 +++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/dusk/ui/game_menu.cpp b/src/dusk/ui/game_menu.cpp index 8ee906e2b2..a6f8d47b46 100644 --- a/src/dusk/ui/game_menu.cpp +++ b/src/dusk/ui/game_menu.cpp @@ -67,6 +67,21 @@ constexpr int kShadowResolutionMax = 8; constexpr std::array kBloomMultiplierStops{0.0f, 0.25f, 0.50f, 0.75f, 1.00f}; constexpr std::array kBloomModeNames{"Off", "Classic", "Dusk"}; +// TODO: Needs more spacing for newlines +static const char* get_description_for_item(std::string_view id) { + if (id == "internal-resolution") { + return "Auto renders at the native window resolution.\nHigher values scale the internal framebuffer."; + } + if (id == "shadow-resolution") { + return "Improves the shadow resolution, making them higher quality."; + } + if (id == "frame-interp") { + return "Uses inter-frame interpolation to enable higher frame rates.\nVisual artifacts, animation glitches, or instability may occur."; + } + + return "No description found."; +} + struct Row { std::string id; std::function activate; @@ -170,6 +185,7 @@ public: } ui::update(); + sync_description_pane(); } void ProcessEvent(Rml::Event& event) override { @@ -199,6 +215,8 @@ private: bool m_requestClose = false; bool m_needsRebuild = false; std::string m_pendingTabId; + Rml::Element* m_descriptionElement = nullptr; + Rml::Element* m_lastDescriptionSyncFocus = nullptr; Row* find_row(std::string_view id) { for (auto& row : m_rows) { @@ -229,6 +247,8 @@ private: m_options.clear(); m_rows.clear(); m_focusIds.clear(); + m_descriptionElement = nullptr; + m_lastDescriptionSyncFocus = nullptr; m_window.reset(); m_document->Close(); m_document = nullptr; @@ -466,7 +486,7 @@ private: add_section_header(scroll, "Display"); - // RMLUI TODO: Replace this with a Display Mode toggle. + // TODO: Replace this with a Display Mode toggle. add_toggle(scroll, "fullscreen", "Toggle Fullscreen", getSettings().video.enableFullscreen, [](bool enabled) { VISetWindowFullscreen(enabled); }); @@ -553,10 +573,12 @@ private: } void build_body() { + m_window->set_right_pane_visible(m_tab == Tab::Graphics); Rml::Element* body = m_window->body(); switch (m_tab) { case Tab::Graphics: build_graphics_tab(body); + build_description_pane(); break; default: build_placeholder_tab(body, kTabs[static_cast(m_tab)].label); @@ -602,6 +624,7 @@ private: m_document->Show(); focus_id(preferredFocus.empty() ? first_focus_id() : preferredFocus); + sync_description_pane(); } void request_close() { m_requestClose = true; } diff --git a/src/dusk/ui/window.cpp b/src/dusk/ui/window.cpp index c85fc52dfb..d92451542b 100644 --- a/src/dusk/ui/window.cpp +++ b/src/dusk/ui/window.cpp @@ -266,6 +266,22 @@ Window::Window(Rml::Element* parent, std::string_view id, std::function {"overflow-y", "auto"}, }); + m_rightPane = append(m_contentRow, "div"); + set_props(m_rightPane, { + {"display", "none"}, + {"flex-direction", "column"}, + {"box-sizing", "border-box"}, + {"min-width", "0"}, + {"min-height", "0"}, + {"padding-top", "24dp"}, + {"padding-bottom", "24dp"}, + {"padding-right", "24dp"}, + {"padding-left", "8dp"}, + {"align-items", "flex-start"}, + {"overflow-y", "auto"}, + }); + + apply_pane_layout(); apply_close_style(); } diff --git a/src/dusk/ui/window.hpp b/src/dusk/ui/window.hpp index ae8433fd91..9cc366adb3 100644 --- a/src/dusk/ui/window.hpp +++ b/src/dusk/ui/window.hpp @@ -67,12 +67,16 @@ private: Rml::Element* m_tabBar = nullptr; Rml::Element* m_tabStrip = nullptr; Rml::Element* m_closeButton = nullptr; - Rml::Element* m_body = nullptr; + Rml::Element* m_contentRow = nullptr; + Rml::Element* m_leftPane = nullptr; + Rml::Element* m_rightPane = nullptr; + bool m_rightPaneVisible = false; std::function m_closeCallback; std::vector > m_tabs; bool m_closeHovered = false; bool m_closeFocused = false; void apply_close_style(); + void apply_pane_layout(); }; } // namespace dusk::ui