yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overlay_manager_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_OVERLAY_MANAGER_PANEL_H
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_OVERLAY_MANAGER_PANEL_H
3
6#include "imgui/imgui.h"
7#include "util/i18n/tr.h"
8
9namespace yaze::editor {
10
11class DungeonCanvasViewer;
12class DungeonEditorV2ReloadTestPeer;
13
14// Lightweight dockable panel that consolidates all overlay toggles.
15// Replaces the need to dig through context menus to toggle overlays.
17 public:
18 // Overlay state — mirrors the booleans in DungeonCanvasViewer.
19 struct OverlayState {
20 bool* show_grid = nullptr;
21 bool* show_object_bounds = nullptr;
22 bool* show_coordinate_overlay = nullptr;
23 bool* show_room_debug_info = nullptr;
24 bool* show_texture_debug = nullptr;
25 bool* show_layer_info = nullptr;
26 bool* show_minecart_tracks = nullptr;
27 bool* show_custom_collision = nullptr;
28 bool* show_track_collision = nullptr;
29 bool* show_camera_quadrants = nullptr;
30 bool* show_minecart_sprites = nullptr;
31 bool* show_collision_legend = nullptr;
32 };
33
35 explicit OverlayManagerPanel(OverlayState state) : state_(state) {}
36
37 void SetState(OverlayState state) { state_ = state; }
38
39 // WindowContent identity
40 std::string GetId() const override { return "dungeon.overlay_manager"; }
41 std::string GetDisplayName() const override { return "Overlay Manager"; }
42 std::string GetIcon() const override { return ICON_MD_LAYERS; }
43 std::string GetEditorCategory() const override { return "Dungeon"; }
44 int GetPriority() const override { return 25; }
45 std::string GetWorkflowGroup() const override { return "Editors"; }
46
47 void Draw(bool* p_open) override {
48 if (!p_open || !*p_open)
49 return;
50
51 ImGui::SetNextWindowSize(ImVec2(260, 360), ImGuiCond_FirstUseEver);
52 if (!ImGui::Begin(ICON_MD_LAYERS " Overlays", p_open)) {
53 ImGui::End();
54 return;
55 }
56
57 // Quick actions
58 if (ImGui::SmallButton(tr("All On"))) {
59 SetAll(true);
60 }
61 ImGui::SameLine();
62 if (ImGui::SmallButton(tr("All Off"))) {
63 SetAll(false);
64 }
65 ImGui::Separator();
66
67 // Display section
68 ImGui::TextDisabled(ICON_MD_VISIBILITY " Display");
70 OverlayToggle("Object Bounds", state_.show_object_bounds);
72 OverlayToggle("Camera Quadrants", state_.show_camera_quadrants);
73 ImGui::Spacing();
74
75 // Game Data section
76 ImGui::TextDisabled(ICON_MD_TRAIN " Game Data");
77 OverlayToggle("Minecart Tracks", state_.show_minecart_tracks);
78 OverlayToggle("Minecart Sprites", state_.show_minecart_sprites);
79 OverlayToggle("Custom Collision", state_.show_custom_collision);
80 OverlayToggle("Track Collision", state_.show_track_collision);
81 OverlayToggle("Collision Legend", state_.show_collision_legend);
82 ImGui::Spacing();
83
84 // Debug section
85 ImGui::TextDisabled(ICON_MD_BUG_REPORT " Debug");
87 OverlayToggle("Texture Debug", state_.show_texture_debug);
89
90 ImGui::End();
91 }
92
93 private:
95
96 void OverlayToggle(const char* label, bool* value) {
97 if (!value) {
98 ImGui::BeginDisabled();
99 bool dummy = false;
100 ImGui::Checkbox(label, &dummy);
101 ImGui::EndDisabled();
102 } else {
103 ImGui::Checkbox(label, value);
104 }
105 }
106
127
129};
130
131} // namespace yaze::editor
132
133#endif // YAZE_APP_EDITOR_DUNGEON_PANELS_OVERLAY_MANAGER_PANEL_H
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::string GetIcon() const override
Material Design icon for this panel.
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void OverlayToggle(const char *label, bool *value)
void Draw(bool *p_open) override
Draw the panel content.
std::string GetWorkflowGroup() const override
Optional workflow group for hack-centric actions.
int GetPriority() const override
Get display priority for menu ordering.
std::string GetId() const override
Unique identifier for this panel.
Base interface for all logical window content components.
#define ICON_MD_TRAIN
Definition icons.h:2005
#define ICON_MD_VISIBILITY
Definition icons.h:2101
#define ICON_MD_BUG_REPORT
Definition icons.h:327
#define ICON_MD_LAYERS
Definition icons.h:1068
Editors are the view controllers for the application.