1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_DUNGEON_ROOM_GRAPHICS_PANEL_H_
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_DUNGEON_ROOM_GRAPHICS_PANEL_H_
12#include "imgui/imgui.h"
30 std::array<zelda3::Room, 0x128>* rooms,
50 std::string
GetId()
const override {
return "dungeon.room_graphics"; }
60 void Draw(
bool* p_open)
override {
62 ImGui::TextDisabled(
"No room data available");
68 ImGui::TextDisabled(
"No room selected");
75 ImGui::Text(
"Blockset: %02X", room.blockset);
85 auto blocks = room.blocks();
89 room.LoadRoomGraphics(room.blockset);
90 blocks = room.blocks();
93 int current_block = 0;
94 constexpr int max_blocks_per_row = 2;
95 constexpr int block_width = 128;
96 constexpr int block_height = 32;
98 for (
int block : blocks) {
99 if (current_block >= 16)
break;
108 int palette_index = 0;
110 gfx_sheet.SetPaletteWithTransparent(
112 gfx_sheet.set_modified(
true);
117 if (!gfx_sheet.texture() && gfx_sheet.is_active() &&
118 gfx_sheet.width() > 0) {
122 }
else if (gfx_sheet.modified() && gfx_sheet.texture()) {
126 gfx_sheet.set_modified(
false);
129 int row = current_block / max_blocks_per_row;
130 int col = current_block % max_blocks_per_row;
132 ImVec2 local_pos(2 + (col * block_width), 2 + (row * block_height));
134 if (gfx_sheet.texture() != 0) {
136 (ImTextureID)(intptr_t)gfx_sheet.texture(), local_pos,
137 ImVec2(block_width, block_height));
140 local_pos, ImVec2(block_width, block_height),
141 IM_COL32(40, 40, 40, 255));
144 IM_COL32(255, 255, 255, 255));
156 std::array<zelda3::Room, 0x128>*
rooms_ =
nullptr;
EditorPanel for displaying room graphics blocks.
int GetPriority() const override
Get display priority for menu ordering.
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
std::string GetId() const override
Unique identifier for this panel.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
DungeonRoomGraphicsPanel(int *current_room_id, std::array< zelda3::Room, 0x128 > *rooms, gfx::IRenderer *renderer=nullptr)
gfx::IRenderer * renderer_
gfx::PaletteGroup current_palette_group_
void SetCurrentPaletteGroup(const gfx::PaletteGroup &group)
Set the current palette group for graphics rendering.
std::array< zelda3::Room, 0x128 > * rooms_
std::string GetIcon() const override
Material Design icon for this panel.
void Draw(bool *p_open) override
Draw the panel content.
gui::Canvas room_gfx_canvas_
Base interface for all logical panel components.
void QueueTextureCommand(TextureCommandType type, Bitmap *bitmap)
void ProcessTextureQueue(IRenderer *renderer)
std::array< gfx::Bitmap, 223 > & gfx_sheets()
Get reference to all graphics sheets.
Defines an abstract interface for all rendering operations.
Lightweight RAII guard for existing Canvas instances.
Modern, robust canvas for drawing and manipulating graphics.
void AddTextAt(ImVec2 local_pos, const std::string &text, uint32_t color)
void AddRectFilledAt(ImVec2 local_top_left, ImVec2 size, uint32_t color)
bool DrawTileSelector(int size, int size_y=0)
void AddImageAt(ImTextureID texture, ImVec2 local_top_left, ImVec2 size)
Represents a group of palettes.
std::optional< float > grid_step