Skip to content

Commit c874255

Browse files
committed
refactor: extract view overlay menu
1 parent 5c27d45 commit c874255

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

include/MeshCraft/Application/UI/MenuBar.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace MeshCraft::Application::UI {
55
class MenuBar final {
66
public:
77
static void drawPanelToggles(bool& timeline, bool& registry, bool& ai, bool& validation);
8+
static void drawOverlays(bool& edges, bool& wireframe, bool& stats, bool& shadowDebug, bool& snap);
89
};
910

1011
} // namespace MeshCraft::Application::UI

src/MeshCraft/Application/UI/MenuBar.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,8 @@ float MeshCraftApplication::drawMenuBar()
550550
if (walkController_.isActive()) exitWalkMode(); else enterWalkMode();
551551
}
552552
ImGui::Separator();
553-
ImGui::MenuItem("Edge Overlay", "Alt+W", &showEdgeOverlay_);
554-
ImGui::MenuItem("Wireframe Mode", nullptr, &showWireframeMode_);
555-
ImGui::MenuItem("Stats Overlay", nullptr, &showStatsOverlay_);
553+
UI::MenuBar::drawOverlays(showEdgeOverlay_, showWireframeMode_,
554+
showStatsOverlay_, shadowDebugEnabled_, snapEnabled_);
556555
if (supportsTextShaderEffects()) {
557556
ImGui::MenuItem("Bloom (emissive glow)", nullptr, &bloomEnabled_);
558557
if (bloomEnabled_) {
@@ -580,8 +579,6 @@ float MeshCraftApplication::drawMenuBar()
580579
} else {
581580
ImGui::TextDisabled("Bloom and SSAO require cross-backend ShaderEffect support");
582581
}
583-
ImGui::MenuItem("Shadow Map Debug", nullptr, &shadowDebugEnabled_);
584-
ImGui::MenuItem("Snap to Grid", nullptr, &snapEnabled_);
585582
UI::MenuBar::drawPanelToggles(showTimeline_, showRegistryPanel_,
586583
showAiPanel_, showValidationPanel_);
587584
ImGui::EndMenu();
@@ -611,4 +608,12 @@ void MenuBar::drawPanelToggles(bool& timeline, bool& registry, bool& ai, bool& v
611608
ImGui::MenuItem("Validation", nullptr, &validation);
612609
}
613610

611+
void MenuBar::drawOverlays(bool& edges, bool& wireframe, bool& stats, bool& shadowDebug, bool& snap) {
612+
ImGui::MenuItem("Edge Overlay", "Alt+W", &edges);
613+
ImGui::MenuItem("Wireframe Mode", nullptr, &wireframe);
614+
ImGui::MenuItem("Stats Overlay", nullptr, &stats);
615+
ImGui::MenuItem("Shadow Map Debug", nullptr, &shadowDebug);
616+
ImGui::MenuItem("Snap to Grid", nullptr, &snap);
617+
}
618+
614619
} // namespace MeshCraft::Application::UI

0 commit comments

Comments
 (0)