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