yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_editor_v2.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_EDITOR_V2_H
2#define YAZE_APP_EDITOR_DUNGEON_EDITOR_V2_H
3
4#include <memory>
5#include <unordered_map>
6
7#include "absl/status/status.h"
8#include "absl/strings/str_format.h"
9#include "app/editor/editor.h"
11#include "app/rom.h"
15#include "dungeon_room_loader.h"
16#include "object_editor_card.h"
23#include "imgui/imgui.h"
24
25namespace yaze {
26namespace editor {
27
42class DungeonEditorV2 : public Editor {
43 public:
53
54 // Editor interface
55 void Initialize(gfx::IRenderer* renderer, Rom* rom);
56 void Initialize() override;
57 absl::Status Load();
58 absl::Status Update() override;
59 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
60 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
61 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
62 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
63 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
64 absl::Status Find() override { return absl::UnimplementedError("Find"); }
65 absl::Status Save() override;
66
67 // ROM management
76 Rom* rom() const { return rom_; }
77
78 // Room management
79 void add_room(int room_id);
80 void FocusRoom(int room_id);
81
82 // ROM state
83 bool IsRomLoaded() const override { return rom_ && rom_->is_loaded(); }
84 std::string GetRomStatus() const override {
85 if (!rom_) return "No ROM loaded";
86 if (!rom_->is_loaded()) return "ROM failed to load";
87 return absl::StrFormat("ROM loaded: %s", rom_->title());
88 }
89
90 // Card visibility flags - Public for command-line flag access
91 bool show_room_selector_ = false; // Room selector/list card
92 bool show_room_matrix_ = false; // Dungeon matrix layout
93 bool show_entrances_list_ = false; // Entrance list card (renamed from entrances_matrix_)
94 bool show_room_graphics_ = false; // Room graphics card
95 bool show_object_editor_ = false; // Object editor card
96 bool show_palette_editor_ = false; // Palette editor card
97 bool show_debug_controls_ = false; // Debug controls card
98 bool show_control_panel_ = true; // Control panel (visible by default)
99
100 private:
102 // Simple UI layout
103 void DrawLayout();
104 void DrawRoomTab(int room_id);
105 void DrawToolset();
106 void DrawRoomMatrixCard();
107 void DrawRoomsListCard();
111 void DrawControlPanel();
112
113 // Texture processing (critical for rendering)
115
116 // Room selection callback
117 void OnRoomSelected(int room_id);
118 void OnEntranceSelected(int entrance_id);
119
120 // Data
122 std::array<zelda3::Room, 0x128> rooms_;
123 std::array<zelda3::RoomEntrance, 0x8C> entrances_;
124
125 // Current selection state
127
128 // Active room tabs and card tracking for jump-to
129 ImVector<int> active_rooms_;
130 std::unordered_map<int, std::shared_ptr<gui::EditorCard>> room_cards_;
132
134
135 // Palette management
140
141 // Components - these do all the work
148 std::unique_ptr<ObjectEditorCard> object_editor_card_; // Unified object editor
149
150 bool is_loaded_ = false;
151
152 // Docking class for room windows to dock together
153 ImGuiWindowClass room_window_class_;
154};
155
156} // namespace editor
157} // namespace yaze
158
159#endif // YAZE_APP_EDITOR_DUNGEON_EDITOR_V2_H
160
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
bool is_loaded() const
Definition rom.h:197
auto title() const
Definition rom.h:201
Handles the main dungeon canvas rendering and interaction.
DungeonEditorV2 - Simplified dungeon editor using component delegation.
std::array< zelda3::Room, 0x128 > rooms_
std::unique_ptr< ObjectEditorCard > object_editor_card_
std::array< zelda3::RoomEntrance, 0x8C > entrances_
gfx::PaletteGroup current_palette_group_
void OnEntranceSelected(int entrance_id)
std::string GetRomStatus() const override
absl::Status Copy() override
gui::DungeonObjectEmulatorPreview object_emulator_preview_
absl::Status Cut() override
bool IsRomLoaded() const override
gui::PaletteEditorWidget palette_editor_
absl::Status Paste() override
absl::Status Update() override
absl::Status Undo() override
absl::Status Find() override
absl::Status Redo() override
DungeonObjectSelector object_selector_
std::unordered_map< int, std::shared_ptr< gui::EditorCard > > room_cards_
Handles object selection, preview, and editing UI.
Manages loading and saving of dungeon room data.
Handles room and entrance selection UI.
Interface for editor classes.
Definition editor.h:82
EditorType type_
Definition editor.h:123
Defines an abstract interface for all rendering operations.
Definition irenderer.h:35
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
void Initialize(gfx::IRenderer *renderer, Rom *rom)
Simple visual palette editor with color picker.
Main namespace for the application.
Represents a group of palettes.