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 <string>
6
10#include "app/gfx/core/bitmap.h"
14#include "app/gui/core/icons.h"
15#include "imgui/imgui.h"
16#include "zelda3/dungeon/room.h"
17
18namespace yaze {
19namespace editor {
20
21class DungeonEditorV2;
22
33 public:
34 // Default constructor for ContentRegistry self-registration
36 : room_gfx_canvas_("##RoomGfxCanvasPanel", ImVec2(256 + 1, 256 + 1)) {}
37
38 // Legacy constructor for direct instantiation
39 RoomGraphicsContent(int* current_room_id, DungeonRoomStore* rooms,
40 gfx::IRenderer* renderer = nullptr)
41 : current_room_id_(current_room_id),
42 rooms_(rooms),
43 renderer_(renderer),
44 room_gfx_canvas_("##RoomGfxCanvasPanel", ImVec2(256 + 1, 256 + 1)) {}
45
52 palette_dirty_ = true;
53 }
54
55 // ==========================================================================
56 // WindowContent Identity
57 // ==========================================================================
58
59 std::string GetId() const override { return "dungeon.room_graphics"; }
60 std::string GetDisplayName() const override { return "Room Graphics"; }
61 std::string GetIcon() const override { return ICON_MD_IMAGE; }
62 std::string GetEditorCategory() const override { return "Dungeon"; }
63 int GetPriority() const override { return 50; }
64 float GetPreferredWidth() const override { return 440.0f; }
65
66 // ==========================================================================
67 // WindowContent Drawing
68 // ==========================================================================
69
70 void Draw(bool* p_open) override;
71
72 private:
74 uint8_t block_id = 0;
75 size_t source_offset = 0;
76 int width = 0;
77 int height = 0;
80 bool bitmap_active = false;
81 bool has_surface = false;
82 bool has_texture = false;
83 };
84
85 void RefreshSheetPreviews(const zelda3::Room& room);
86
87 int* current_room_id_ = nullptr;
91 std::array<gfx::Bitmap, 16> sheet_previews_;
92 std::array<SheetPreviewMetadata, 16> sheet_preview_metadata_{};
93 std::array<uint8_t, 16> preview_block_ids_{};
96 bool show_source_trace_ = false;
97
98 // Palette tracking for proper sheet coloring
100 bool palette_dirty_ = true;
101};
102
103} // namespace editor
104} // namespace yaze
105
106#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::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:150
#define ICON_MD_IMAGE
Definition icons.h:982
Represents a group of palettes.