100 static constexpr std::array<zelda3::DoorType, 20> kDoorTypes = {{
124 ImGui::TextColored(theme.text_secondary_gray,
125 "Select a door style, then click a wall in the room "
126 "canvas to place it.");
129 ImGui::TextColored(theme.status_warning,
ICON_MD_PLACE " Active: %s",
138 constexpr float kDoorCardHeight = 48.0f;
139 constexpr float kDoorCardSpacing = 6.0f;
140 constexpr float kMinDoorCardWidth = 92.0f;
141 const float panel_width = ImGui::GetContentRegionAvail().x;
142 const int items_per_row = std::max(
143 2,
static_cast<int>((panel_width + kDoorCardSpacing) /
144 (kMinDoorCardWidth + kDoorCardSpacing)));
145 const float card_width =
146 std::max(kMinDoorCardWidth,
147 (panel_width - (items_per_row - 1) * kDoorCardSpacing) /
150 ImGui::BeginChild(
"##DoorTypeGrid", ImVec2(0, 150),
true,
151 ImGuiWindowFlags_AlwaysVerticalScrollbar);
154 for (
size_t i = 0; i < kDoorTypes.size(); ++i) {
155 const auto door_type = kDoorTypes[i];
157 const int type_val =
static_cast<int>(door_type);
158 ImGui::PushID(
static_cast<int>(i));
160 ImVec4 button_color = DoorTypeAccent(theme, door_type);
162 button_color.x = std::min(1.0f, button_color.x + 0.2f);
163 button_color.y = std::min(1.0f, button_color.y + 0.2f);
164 button_color.z = std::min(1.0f, button_color.z + 0.2f);
168 {ImGuiCol_Button, button_color},
169 {ImGuiCol_ButtonHovered,
170 ImVec4(button_color.x + 0.1f, button_color.y + 0.1f,
171 button_color.z + 0.1f, 1.0f)},
172 {ImGuiCol_ButtonActive,
173 ImVec4(button_color.x + 0.2f, button_color.y + 0.2f,
174 button_color.z + 0.2f, 1.0f)},
177 const std::string label =
178 absl::StrFormat(
"%02X\n%s", type_val,
179 ShortDoorTypeLabel(door_type).c_str());
180 if (ImGui::Button(label.c_str(), ImVec2(card_width, kDoorCardHeight))) {
189 if (ImGui::IsItemHovered()) {
190 ImGui::SetTooltip(
"%s (0x%02X)\nClick to select for placement",
196 ImVec2 min = ImGui::GetItemRectMin();
197 ImVec2 max = ImGui::GetItemRectMax();
198 ImGui::GetWindowDrawList()->AddRect(min, max, IM_COL32(255, 255, 0, 255),
204 if (col < items_per_row && i < kDoorTypes.size() - 1) {
213 if (!
rooms_ || current_room_id_ < 0 || current_room_id_ >= 296) {
218 const auto& doors = room.GetDoors();
223 ImGui::TextColored(theme.text_secondary_gray,
228 ImGui::BeginChild(
"##DoorList", ImVec2(0, 0),
true);
229 for (
size_t i = 0; i < doors.size(); ++i) {
230 const auto& door = doors[i];
231 const auto [tile_x, tile_y] = door.GetTileCoords();
235 ImGui::PushID(
static_cast<int>(i));
236 ImGui::Text(
"[%zu] %s", i, type_name.c_str());
238 ImGui::TextColored(theme.text_secondary_gray,
"(%s @ %d,%d)",
239 dir_name.c_str(), tile_x, tile_y);
243 mutable_room.RemoveDoor(i);
DungeonCanvasViewer * canvas_viewer_
zelda3::DoorType selected_door_type_
DungeonRoomStore * rooms_
DungeonCanvasViewer * ResolveCanvasViewer()
std::function< DungeonCanvasViewer *()> canvas_viewer_provider_
void OnClose() override
Called when panel is hidden.
void Draw(bool *p_open) override
Draw the panel content.
std::string ShortDoorTypeLabel(zelda3::DoorType type)
ImVec4 DoorTypeAccent(const AgentUITheme &theme, zelda3::DoorType type)