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
8namespace yaze::editor {
9
10class DungeonCanvasViewer;
11
12// Lightweight dockable panel that consolidates all overlay toggles.
13// Replaces the need to dig through context menus to toggle overlays.
15 public:
16 // Overlay state — mirrors the booleans in DungeonCanvasViewer.
17 struct OverlayState {
18 bool* show_grid = nullptr;
19 bool* show_object_bounds = nullptr;
20 bool* show_coordinate_overlay = nullptr;
21 bool* show_room_debug_info = nullptr;
22 bool* show_texture_debug = nullptr;
23 bool* show_layer_info = nullptr;
24 bool* show_minecart_tracks = nullptr;
25 bool* show_custom_collision = nullptr;
26 bool* show_track_collision = nullptr;
27 bool* show_camera_quadrants = nullptr;
28 bool* show_minecart_sprites = nullptr;
29 bool* show_collision_legend = nullptr;
30 };
31
33 explicit OverlayManagerPanel(OverlayState state) : state_(state) {}
34
35 void SetState(OverlayState state) { state_ = state; }
36
37 // EditorPanel identity
38 std::string GetId() const override { return "dungeon.overlay_manager"; }
39 std::string GetDisplayName() const override { return "Overlay Manager"; }
40 std::string GetIcon() const override { return ICON_MD_LAYERS; }
41 std::string GetEditorCategory() const override { return "Dungeon"; }
42 int GetPriority() const override { return 25; }
43
44 void Draw(bool* p_open) override {
45 if (!p_open || !*p_open)
46 return;
47
48 ImGui::SetNextWindowSize(ImVec2(260, 360), ImGuiCond_FirstUseEver);
49 if (!ImGui::Begin(ICON_MD_LAYERS " Overlays", p_open)) {
50 ImGui::End();
51 return;
52 }
53
54 // Quick actions
55 if (ImGui::SmallButton("All On")) {
56 SetAll(true);
57 }
58 ImGui::SameLine();
59 if (ImGui::SmallButton("All Off")) {
60 SetAll(false);
61 }
62 ImGui::Separator();
63
64 // Display section
65 ImGui::TextDisabled(ICON_MD_VISIBILITY " Display");
67 OverlayToggle("Object Bounds", state_.show_object_bounds);
69 OverlayToggle("Camera Quadrants", state_.show_camera_quadrants);
70 ImGui::Spacing();
71
72 // Game Data section
73 ImGui::TextDisabled(ICON_MD_TRAIN " Game Data");
74 OverlayToggle("Minecart Tracks", state_.show_minecart_tracks);
75 OverlayToggle("Minecart Sprites", state_.show_minecart_sprites);
76 OverlayToggle("Custom Collision", state_.show_custom_collision);
77 OverlayToggle("Track Collision", state_.show_track_collision);
78 OverlayToggle("Collision Legend", state_.show_collision_legend);
79 ImGui::Spacing();
80
81 // Debug section
82 ImGui::TextDisabled(ICON_MD_BUG_REPORT " Debug");
84 OverlayToggle("Texture Debug", state_.show_texture_debug);
86
87 ImGui::End();
88 }
89
90 private:
91 void OverlayToggle(const char* label, bool* value) {
92 if (!value) {
93 ImGui::BeginDisabled();
94 bool dummy = false;
95 ImGui::Checkbox(label, &dummy);
96 ImGui::EndDisabled();
97 } else {
98 ImGui::Checkbox(label, value);
99 }
100 }
101
122
124};
125
126} // namespace yaze::editor
127
128#endif // YAZE_APP_EDITOR_DUNGEON_PANELS_OVERLAY_MANAGER_PANEL_H
Base interface for all logical panel components.
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.
#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.