Add Dungeon Room and Object Selection Features
- Introduced new classes for DungeonRoomSelector and DungeonObjectSelector to enhance room and object management within the dungeon editor. - Implemented UI components for selecting rooms and entrances, allowing users to easily navigate and manage dungeon layouts. - Added functionality for rendering room graphics and object previews, improving the visual editing experience. - Updated the DungeonEditor class to integrate the new selectors, streamlining the overall editing workflow. - Enhanced error handling and validation in room and object management processes to ensure robust functionality.
This commit is contained in:
82
src/app/editor/dungeon/dungeon_object_selector.h
Normal file
82
src/app/editor/dungeon/dungeon_object_selector.h
Normal file
@@ -0,0 +1,82 @@
|
||||
#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_SELECTOR_H
|
||||
#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_SELECTOR_H
|
||||
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/dungeon/object_renderer.h"
|
||||
#include "app/zelda3/dungeon/dungeon_object_editor.h"
|
||||
#include "app/zelda3/dungeon/dungeon_editor_system.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
* @brief Handles object selection, preview, and editing UI
|
||||
*/
|
||||
class DungeonObjectSelector {
|
||||
public:
|
||||
explicit DungeonObjectSelector(Rom* rom = nullptr) : rom_(rom), object_renderer_(rom) {}
|
||||
|
||||
void DrawTileSelector();
|
||||
void DrawObjectRenderer();
|
||||
void DrawIntegratedEditingPanels();
|
||||
|
||||
void set_rom(Rom* rom) {
|
||||
rom_ = rom;
|
||||
object_renderer_.SetROM(rom);
|
||||
}
|
||||
Rom* rom() const { return rom_; }
|
||||
|
||||
// Editor system access
|
||||
void set_dungeon_editor_system(std::unique_ptr<zelda3::DungeonEditorSystem>* system) {
|
||||
dungeon_editor_system_ = system;
|
||||
}
|
||||
void set_object_editor(std::shared_ptr<zelda3::DungeonObjectEditor>* editor) {
|
||||
object_editor_ = editor;
|
||||
}
|
||||
|
||||
// Room data access
|
||||
void set_rooms(std::array<zelda3::Room, 0x128>* rooms) { rooms_ = rooms; }
|
||||
void set_current_room_id(int room_id) { current_room_id_ = room_id; }
|
||||
|
||||
// Palette access
|
||||
void set_current_palette_group_id(uint64_t id) { current_palette_group_id_ = id; }
|
||||
|
||||
private:
|
||||
void DrawRoomGraphics();
|
||||
void DrawCompactObjectEditor();
|
||||
void DrawCompactSpriteEditor();
|
||||
void DrawCompactItemEditor();
|
||||
void DrawCompactEntranceEditor();
|
||||
void DrawCompactDoorEditor();
|
||||
void DrawCompactChestEditor();
|
||||
void DrawCompactPropertiesEditor();
|
||||
|
||||
Rom* rom_ = nullptr;
|
||||
gui::Canvas room_gfx_canvas_{"##RoomGfxCanvas", ImVec2(0x100 + 1, 0x10 * 0x40 + 1)};
|
||||
gui::Canvas object_canvas_;
|
||||
zelda3::ObjectRenderer object_renderer_;
|
||||
|
||||
// Editor systems
|
||||
std::unique_ptr<zelda3::DungeonEditorSystem>* dungeon_editor_system_ = nullptr;
|
||||
std::shared_ptr<zelda3::DungeonObjectEditor>* object_editor_ = nullptr;
|
||||
|
||||
// Room data
|
||||
std::array<zelda3::Room, 0x128>* rooms_ = nullptr;
|
||||
int current_room_id_ = 0;
|
||||
|
||||
// Palette data
|
||||
uint64_t current_palette_group_id_ = 0;
|
||||
|
||||
// Object preview system
|
||||
zelda3::RoomObject preview_object_{0, 0, 0, 0, 0};
|
||||
gfx::SnesPalette preview_palette_;
|
||||
bool object_loaded_ = false;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user