Refactor editor classes to accept a ROM pointer in constructors, enhancing dependency management and initialization across all editor types.

This commit is contained in:
scawful
2025-04-11 16:54:47 -04:00
parent e0b95d8071
commit d8826739bf
10 changed files with 119 additions and 37 deletions

View File

@@ -28,12 +28,10 @@ namespace editor {
*
* The screens that can be edited include the title screen, naming screen,
* overworld map, inventory menu, and more.
*
* The class inherits from the SharedRom class.
*/
class ScreenEditor : public SharedRom, public Editor {
class ScreenEditor : public Editor {
public:
ScreenEditor() {
explicit ScreenEditor(Rom* rom = nullptr) : rom_(rom) {
screen_canvas_.SetCanvasSize(ImVec2(512, 512));
type_ = EditorType::kScreen;
}
@@ -48,10 +46,17 @@ class ScreenEditor : public SharedRom, public Editor {
absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
absl::Status Find() override { return absl::UnimplementedError("Find"); }
absl::Status Save() override { return absl::UnimplementedError("Save"); }
// Set the ROM pointer
void set_rom(Rom* rom) { rom_ = rom; }
// Get the ROM pointer
Rom* rom() const { return rom_; }
absl::Status SaveDungeonMaps();
private:
Rom* rom_;
void DrawTitleScreenEditor();
void DrawNamingScreenEditor();
void DrawOverworldMapEditor();