141 static constexpr std::array<zelda3::DoorType, 20> kDoorTypes = {{
177 ImGui::TextColored(theme.text_secondary_gray,
178 tr(
"Select a door style, then click a wall in the room "
179 "canvas to place it."));
191 constexpr float kDoorCardHeight = 48.0f;
192 constexpr float kDoorCardSpacing = 6.0f;
193 constexpr float kMinDoorCardWidth = 92.0f;
194 const float panel_width = ImGui::GetContentRegionAvail().x;
195 const int items_per_row =
196 std::max(2,
static_cast<int>((panel_width + kDoorCardSpacing) /
197 (kMinDoorCardWidth + kDoorCardSpacing)));
198 const float card_width = std::max(
200 (panel_width - (items_per_row - 1) * kDoorCardSpacing) / items_per_row);
202 ImGui::BeginChild(
"##DoorTypeGrid", ImVec2(0, 150),
true,
203 ImGuiWindowFlags_AlwaysVerticalScrollbar);
206 for (
size_t i = 0; i < kDoorTypes.size(); ++i) {
207 const auto door_type = kDoorTypes[i];
209 const int type_val =
static_cast<int>(door_type);
210 ImGui::PushID(
static_cast<int>(i));
212 ImVec4 button_color = DoorTypeAccent(theme, door_type);
214 button_color.x = std::min(1.0f, button_color.x + 0.2f);
215 button_color.y = std::min(1.0f, button_color.y + 0.2f);
216 button_color.z = std::min(1.0f, button_color.z + 0.2f);
220 {ImGuiCol_Button, button_color},
221 {ImGuiCol_ButtonHovered,
222 ImVec4(button_color.x + 0.1f, button_color.y + 0.1f,
223 button_color.z + 0.1f, 1.0f)},
224 {ImGuiCol_ButtonActive,
225 ImVec4(button_color.x + 0.2f, button_color.y + 0.2f,
226 button_color.z + 0.2f, 1.0f)},
229 const std::string label =
230 absl::StrFormat(
"%s %02X\n%s", DoorTypeIcon(door_type), type_val,
231 ShortDoorTypeLabel(door_type).c_str());
232 if (ImGui::Button(label.c_str(), ImVec2(card_width, kDoorCardHeight))) {
241 if (ImGui::IsItemHovered()) {
242 ImGui::SetTooltip(tr(
"%s (0x%02X)\nClick to select for placement"),
248 ImVec2 min = ImGui::GetItemRectMin();
249 ImVec2 max = ImGui::GetItemRectMax();
250 ImGui::GetWindowDrawList()->AddRect(min, max, IM_COL32(255, 255, 0, 255),
256 if (col < items_per_row && i < kDoorTypes.size() - 1) {
265 if (!
rooms_ || current_room_id_ < 0 || current_room_id_ >= 296) {
270 const auto& doors = room.GetDoors();
275 ImGui::TextColored(theme.text_secondary_gray,
280 ImGui::BeginChild(
"##DoorList", ImVec2(0, 0),
true);
281 int selected_door_index = -1;
284 const auto selected_entity =
287 selected_door_index =
static_cast<int>(selected_entity.index);
290 for (
size_t i = 0; i < doors.size(); ++i) {
291 const auto& door = doors[i];
292 const auto [tile_x, tile_y] = door.GetTileCoords();
296 ImGui::PushID(
static_cast<int>(i));
297 const std::string row_label = absl::StrFormat(
"[%zu] %s", i, type_name);
298 if (ImGui::Selectable(row_label.c_str(),
299 selected_door_index ==
static_cast<int>(i))) {
305 ImGui::TextColored(theme.text_secondary_gray,
"(%s @ %d,%d)",
306 dir_name.c_str(), tile_x, tile_y);
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::function< void()> open_selection_inspector_callback_
bool door_placement_mode_
std::string ShortDoorTypeLabel(zelda3::DoorType type)
ImVec4 DoorTypeAccent(const AgentUITheme &theme, zelda3::DoorType type)
const char * DoorTypeIcon(zelda3::DoorType type)