yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
room_graphics_content.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_WORKSPACE_ROOM_GRAPHICS_CONTENT_H_
2#define YAZE_APP_EDITOR_DUNGEON_WORKSPACE_ROOM_GRAPHICS_CONTENT_H_
3
4#include <array>
5#include <cstdint>
6#include <string>
7
11#include "app/gfx/core/bitmap.h"
15#include "app/gui/core/icons.h"
16#include "imgui/imgui.h"
17#include "zelda3/dungeon/room.h"
18
19namespace yaze {
20namespace editor {
21
22class DungeonEditorV2;
23
34 public:
35 // Default constructor for ContentRegistry self-registration
37 : room_gfx_canvas_("##RoomGfxCanvasPanel", ImVec2(256 + 1, 256 + 1)) {}
38
39 // Legacy constructor for direct instantiation
40 RoomGraphicsContent(int* current_room_id, DungeonRoomStore* rooms,
41 gfx::IRenderer* renderer = nullptr)
42 : current_room_id_(current_room_id),
43 rooms_(rooms),
44 renderer_(renderer),
45 room_gfx_canvas_("##RoomGfxCanvasPanel", ImVec2(256 + 1, 256 + 1)) {}
46
47 ~RoomGraphicsContent() override;
48
55 palette_dirty_ = true;
56 }
57
58 // ==========================================================================
59 // WindowContent Identity
60 // ==========================================================================
61
62 std::string GetId() const override { return "dungeon.room_graphics"; }
63 std::string GetDisplayName() const override { return "Room Graphics"; }
64 std::string GetIcon() const override { return ICON_MD_IMAGE; }
65 std::string GetEditorCategory() const override { return "Dungeon"; }
66 int GetPriority() const override { return 50; }
67 std::string GetWorkflowGroup() const override { return "Editors"; }
68 float GetPreferredWidth() const override { return 440.0f; }
69
70 // ==========================================================================
71 // WindowContent Drawing
72 // ==========================================================================
73
74 void Draw(bool* p_open) override;
75
76 private:
78
80 uint8_t block_id = 0;
81 size_t source_offset = 0;
82 int width = 0;
83 int height = 0;
86 bool bitmap_active = false;
87 bool has_surface = false;
88 bool has_texture = false;
89 };
90
91 void RefreshSheetPreviews(const zelda3::Room& room);
92
93 int* current_room_id_ = nullptr;
97 std::array<gfx::Bitmap, 16> sheet_previews_;
98 std::array<SheetPreviewMetadata, 16> sheet_preview_metadata_{};
99 std::array<uint8_t, 16> preview_block_ids_{};
103 bool show_source_trace_ = false;
104
105 // Palette tracking for proper sheet coloring
107 bool palette_dirty_ = true;
108};
109
110} // namespace editor
111} // namespace yaze
112
113#endif // YAZE_APP_EDITOR_DUNGEON_WORKSPACE_ROOM_GRAPHICS_CONTENT_H_
WindowContent for displaying room graphics blocks.
float GetPreferredWidth() const override
Get preferred width for this panel (optional)
std::array< uint8_t, 16 > preview_block_ids_
void RefreshSheetPreviews(const zelda3::Room &room)
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::string GetIcon() const override
Material Design icon for this panel.
std::string GetId() const override
Unique identifier for this panel.
void Draw(bool *p_open) override
Draw the panel content.
int GetPriority() const override
Get display priority for menu ordering.
RoomGraphicsContent(int *current_room_id, DungeonRoomStore *rooms, gfx::IRenderer *renderer=nullptr)
void SetCurrentPaletteGroup(const gfx::PaletteGroup &group)
Set the current palette group for graphics rendering.
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
std::array< gfx::Bitmap, 16 > sheet_previews_
std::string GetWorkflowGroup() const override
Optional workflow group for hack-centric actions.
std::array< SheetPreviewMetadata, 16 > sheet_preview_metadata_
Base interface for all logical window content components.
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:64
#define ICON_MD_IMAGE
Definition icons.h:982
Represents a group of palettes.