yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_object_selector.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_SELECTOR_H
2#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_OBJECT_SELECTOR_H
3
4#include "app/gui/canvas.h"
5#include "app/rom.h"
6// object_renderer.h removed - using ObjectDrawer for production rendering
10#include "imgui/imgui.h"
11
12namespace yaze {
13namespace editor {
14
19 public:
20 explicit DungeonObjectSelector(Rom* rom = nullptr) : rom_(rom) {}
21
22 void DrawTileSelector();
23 void DrawObjectRenderer();
25 void Draw();
26
27 void set_rom(Rom* rom) {
28 rom_ = rom;
29 }
30 void SetRom(Rom* rom) {
31 rom_ = rom;
32 }
33 Rom* rom() const { return rom_; }
34
35 // Editor system access
36 void set_dungeon_editor_system(std::unique_ptr<zelda3::DungeonEditorSystem>* system) {
37 dungeon_editor_system_ = system;
38 }
39 void set_object_editor(std::unique_ptr<zelda3::DungeonObjectEditor>* editor) {
40 object_editor_ = editor ? editor->get() : nullptr;
41 }
42
43 // Room data access
44 void set_rooms(std::array<zelda3::Room, 0x128>* rooms) { rooms_ = rooms; }
45 void set_current_room_id(int room_id) { current_room_id_ = room_id; }
46
47 // Palette access
49 void SetCurrentPaletteGroup(const gfx::PaletteGroup& palette_group) { current_palette_group_ = palette_group; }
50 void SetCurrentPaletteId(uint64_t palette_id) { current_palette_id_ = palette_id; }
51
52 // Object selection callbacks
53 void SetObjectSelectedCallback(std::function<void(const zelda3::RoomObject&)> callback) {
55 }
56
57 void SetObjectPlacementCallback(std::function<void(const zelda3::RoomObject&)> callback) {
59 }
60
61 // Get current preview object for placement
63 bool IsObjectLoaded() const { return object_loaded_; }
64
65 private:
66 void DrawRoomGraphics();
67 void DrawObjectBrowser();
70
71 // Helper methods for primitive object rendering
72 ImU32 GetObjectTypeColor(int object_id);
73 std::string GetObjectTypeSymbol(int object_id);
74 void RenderObjectPrimitive(const zelda3::RoomObject& object, int x, int y);
75
76 // AssetBrowser-style object selection
78 bool MatchesObjectFilter(int obj_id, int filter_type);
79 void CalculateObjectDimensions(const zelda3::RoomObject& object, int& width, int& height);
80 void PlaceObjectAtPosition(int x, int y);
86
87 Rom* rom_ = nullptr;
88 gui::Canvas room_gfx_canvas_{"##RoomGfxCanvas", ImVec2(0x100 + 1, 0x10 * 0x40 + 1)};
90 // ObjectRenderer removed - using ObjectDrawer in Room::RenderObjectsToBackground()
91
92 // Editor systems
93 std::unique_ptr<zelda3::DungeonEditorSystem>* dungeon_editor_system_ = nullptr;
95
96 // Room data
97 std::array<zelda3::Room, 0x128>* rooms_ = nullptr;
99
100 // Palette data
104
105 // Object preview system
108 bool object_loaded_ = false;
109
110 // Callback for object selection
113
114 // Object selection state
116};
117
118} // namespace editor
119} // namespace yaze
120
121#endif
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
Handles object selection, preview, and editing UI.
zelda3::DungeonObjectEditor * object_editor_
std::array< zelda3::Room, 0x128 > * rooms_
void CalculateObjectDimensions(const zelda3::RoomObject &object, int &width, int &height)
void set_rooms(std::array< zelda3::Room, 0x128 > *rooms)
void RenderObjectPrimitive(const zelda3::RoomObject &object, int x, int y)
std::function< void(const zelda3::RoomObject &)> object_selected_callback_
void set_object_editor(std::unique_ptr< zelda3::DungeonObjectEditor > *editor)
void SetCurrentPaletteGroup(const gfx::PaletteGroup &palette_group)
std::unique_ptr< zelda3::DungeonEditorSystem > * dungeon_editor_system_
std::function< void(const zelda3::RoomObject &)> object_placement_callback_
void set_dungeon_editor_system(std::unique_ptr< zelda3::DungeonEditorSystem > *system)
void SetCurrentPaletteId(uint64_t palette_id)
const zelda3::RoomObject & GetPreviewObject() const
bool MatchesObjectFilter(int obj_id, int filter_type)
void SetObjectPlacementCallback(std::function< void(const zelda3::RoomObject &)> callback)
void SetObjectSelectedCallback(std::function< void(const zelda3::RoomObject &)> callback)
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:54
Interactive dungeon object editor with scroll wheel support.
Main namespace for the application.
Represents a group of palettes.