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"
17#include "zelda3/dungeon/room.h"
22#include "imgui/imgui.h"
23
24namespace yaze {
25namespace editor {
26
41class DungeonEditorV2 : public Editor {
42 public:
52
53 // Editor interface
54 void Initialize(gfx::IRenderer* renderer, Rom* rom);
55 void Initialize() override;
56 absl::Status Load();
57 absl::Status Update() override;
58 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
59 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
60 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
61 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
62 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
63 absl::Status Find() override { return absl::UnimplementedError("Find"); }
64 absl::Status Save() override;
65
66 // ROM management
75 Rom* rom() const { return rom_; }
76
77 // Room management
78 void add_room(int room_id);
79 void FocusRoom(int room_id);
80
81 // ROM state
82 bool IsRomLoaded() const override { return rom_ && rom_->is_loaded(); }
83 std::string GetRomStatus() const override {
84 if (!rom_) return "No ROM loaded";
85 if (!rom_->is_loaded()) return "ROM failed to load";
86 return absl::StrFormat("ROM loaded: %s", rom_->title());
87 }
88
89 // Card visibility flags - Public for command-line flag access
90 bool show_room_selector_ = false; // Room selector/list card
91 bool show_room_matrix_ = false; // Dungeon matrix layout
92 bool show_entrances_list_ = false; // Entrance list card (renamed from entrances_matrix_)
93 bool show_room_graphics_ = false; // Room graphics card
94 bool show_object_editor_ = false; // Object editor card
95 bool show_palette_editor_ = false; // Palette editor card
96 bool show_debug_controls_ = false; // Debug controls card
97 bool show_control_panel_ = true; // Control panel (visible by default)
98
99 private:
101 // Simple UI layout
102 void DrawLayout();
103 void DrawRoomTab(int room_id);
104 void DrawRoomMatrixCard();
105 void DrawRoomsListCard();
109
110 // Texture processing (critical for rendering)
112
113 // Room selection callback
114 void OnRoomSelected(int room_id);
115 void OnEntranceSelected(int entrance_id);
116
117 // Data
119 std::array<zelda3::Room, 0x128> rooms_;
120 std::array<zelda3::RoomEntrance, 0x8C> entrances_;
121
122 // Current selection state
124
125 // Active room tabs and card tracking for jump-to
126 ImVector<int> active_rooms_;
127 std::unordered_map<int, std::shared_ptr<gui::EditorCard>> room_cards_;
129
131
132 // Palette management
137
138 // Components - these do all the work
145 std::unique_ptr<ObjectEditorCard> object_editor_card_; // Unified object editor
146
147 bool is_loaded_ = false;
148
149 // Docking class for room windows to dock together
150 ImGuiWindowClass room_window_class_;
151};
152
153} // namespace editor
154} // namespace yaze
155
156#endif // YAZE_APP_EDITOR_DUNGEON_EDITOR_V2_H
157
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:74
bool is_loaded() const
Definition rom.h:200
auto title() const
Definition rom.h:204
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:122
EditorType type_
Definition editor.h:164
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)
Main namespace for the application.
Definition controller.cc:20
Represents a group of palettes.