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
46 void Draw(bool* p_open) override {
47 if (!p_open || !*p_open)
48 return;
49
50 ImGui::SetNextWindowSize(ImVec2(260, 360), ImGuiCond_FirstUseEver);
51 if (!ImGui::Begin(ICON_MD_LAYERS " Overlays", p_open)) {
52 ImGui::End();
53 return;
54 }
55
56 // Quick actions
57 if (ImGui::SmallButton(tr("All On"))) {
58 SetAll(true);
59 }
60 ImGui::SameLine();
61 if (ImGui::SmallButton(tr("All Off"))) {
62 SetAll(false);
63 }
64 ImGui::Separator();
65
66 // Display section
67 ImGui::TextDisabled(ICON_MD_VISIBILITY " Display");
69 OverlayToggle("Object Bounds", state_.show_object_bounds);
71 OverlayToggle("Camera Quadrants", state_.show_camera_quadrants);
72 ImGui::Spacing();
73
74 // Game Data section
75 ImGui::TextDisabled(ICON_MD_TRAIN " Game Data");
76 OverlayToggle("Minecart Tracks", state_.show_minecart_tracks);
77 OverlayToggle("Minecart Sprites", state_.show_minecart_sprites);
78 OverlayToggle("Custom Collision", state_.show_custom_collision);
79 OverlayToggle("Track Collision", state_.show_track_collision);
80 OverlayToggle("Collision Legend", state_.show_collision_legend);
81 ImGui::Spacing();
82
83 // Debug section
84 ImGui::TextDisabled(ICON_MD_BUG_REPORT " Debug");
86 OverlayToggle("Texture Debug", state_.show_texture_debug);
88
89 ImGui::End();
90 }
91
92 private:
94
95 void OverlayToggle(const char* label, bool* value) {
96 if (!value) {
97 ImGui::BeginDisabled();
98 bool dummy = false;
99 ImGui::Checkbox(label, &dummy);
100 ImGui::EndDisabled();
101 } else {
102 ImGui::Checkbox(label, value);
103 }
104 }
105
126
128};
129
130} // namespace yaze::editor
131
132#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.
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.