82 ImGui::Text(
ICON_MD_INFO " Select an object to place on the canvas");
86 static char object_filter[256] =
"";
87 ImGui::SetNextItemWidth(-1);
88 if (ImGui::InputTextWithHint(
"##ObjectFilter",
90 object_filter,
sizeof(object_filter))) {
97 if (ImGui::BeginChild(
"##ObjectList", ImVec2(0, 0),
true)) {
100 ImGuiTreeNodeFlags_DefaultOpen)) {
101 for (
int i = 0; i < 0x100; i++) {
102 std::string filter_str = object_filter;
103 if (!filter_str.empty()) {
105 std::string object_name = absl::StrFormat(
"Object %02X", i);
106 std::transform(filter_str.begin(), filter_str.end(),
107 filter_str.begin(), ::tolower);
108 std::transform(object_name.begin(), object_name.end(),
109 object_name.begin(), ::tolower);
110 if (object_name.find(filter_str) == std::string::npos) {
124 std::string object_label = absl::StrFormat(
"%02X - Floor Object", i);
126 if (ImGui::Selectable(object_label.c_str(),
130 static_cast<int16_t
>(i), 0, 0, 0, 0};
139 if (ImGui::IsItemHovered()) {
140 ImGui::BeginTooltip();
141 ImGui::Text(
"Object ID: 0x%02X", i);
142 ImGui::Text(
"Type: Floor Object");
143 ImGui::Text(
"Click to select for placement");
151 for (
int i = 0; i < 0x50; i++) {
152 std::string object_label = absl::StrFormat(
155 if (ImGui::Selectable(object_label.c_str())) {
158 static_cast<int16_t
>(i), 0, 0, 0, 1};
168 if (ImGui::CollapsingHeader(
ICON_MD_STAR " Special Objects")) {
169 const char* special_objects[] = {
170 "Stairs Down",
"Stairs Up",
"Chest",
"Door",
"Pot",
"Block",
174 for (
int i = 0; i < IM_ARRAYSIZE(special_objects); i++) {
175 std::string object_label = absl::StrFormat(
178 if (ImGui::Selectable(object_label.c_str())) {
181 static_cast<int16_t
>(0xF8 + i), 0, 0, 0, 2};
194 if (ImGui::Button(
ICON_MD_CLEAR " Clear Selection", ImVec2(-1, 0))) {
234 ImDrawList* draw_list = ImGui::GetWindowDrawList();
235 ImVec2 cursor_pos = ImGui::GetCursorScreenPos();
236 ImVec2 box_min = cursor_pos;
237 ImVec2 box_max = ImVec2(cursor_pos.x + size.x, cursor_pos.y + size.y);
240 draw_list->AddRectFilled(box_min, box_max, IM_COL32(40, 40, 45, 255));
241 draw_list->AddRect(box_min, box_max, IM_COL32(100, 100, 100, 255));
248 float hue = (object_id % 16) / 16.0f;
249 ImU32 obj_color = ImGui::ColorConvertFloat4ToU32(
250 ImVec4(0.5f + hue * 0.3f, 0.4f, 0.6f - hue * 0.2f, 1.0f));
253 ImVec2 inner_min = ImVec2(cursor_pos.x + 8, cursor_pos.y + 8);
254 ImVec2 inner_max = ImVec2(cursor_pos.x + 24, cursor_pos.y + 24);
255 draw_list->AddRectFilled(inner_min, inner_max, obj_color);
256 draw_list->AddRect(inner_min, inner_max, IM_COL32(200, 200, 200, 255));
259 std::string id_text = absl::StrFormat(
"%02X", object_id);
260 ImVec2 text_size = ImGui::CalcTextSize(id_text.c_str());
261 ImVec2 text_pos = ImVec2(
262 cursor_pos.x + (size.x - text_size.x) * 0.5f,
263 cursor_pos.y + size.y - text_size.y - 2);
264 draw_list->AddText(text_pos, IM_COL32(180, 180, 180, 255), id_text.c_str());