32 ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(120, 13, 13, 255));
33 ImGui::Text(
"[WARNING]");
34 ImGui::TextWrapped(
"This object was created at runtime. Anything you edit here will be not be saved. To edit this object you need to find where in code it was created.");
35 ImGui::PopStyleColor();
38 char buffer[256] =
"";
41 if (ImGui::InputText(
"Name", buffer,
sizeof(buffer))) {
45 ImGui::TextDisabled(
"No NameComponent");
49 vex::ComponentRegistry::getInstance().drawInspectorForObject(*
object);
55 float width = ImGui::GetContentRegionAvail().x;
56 ImGui::SetCursorPosX((width - 150) * 0.5f);
58 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 0.23f, 0.01f, 1.0f));
59 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.47f, 0.05f, 0.05f, 1.0f));
60 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.30f, 0.03f, 0.03f, 1.0f));
61 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.94f, 0.85f, 0.85f, 1.0f));
63 if (ImGui::Button(
"Add Component", ImVec2(150, 0))) {
64 ImGui::OpenPopup(
"AddComponentPopup");
67 ImGui::PopStyleColor(4);
69 if (ImGui::BeginPopup(
"AddComponentPopup")) {
70 auto availableComponents = vex::ComponentRegistry::getInstance().getMissingComponents(*
object);
72 if (availableComponents.empty()) {
73 ImGui::TextDisabled(
"No more components available");
75 static char searchBuffer[256] =
"";
76 ImGui::InputTextWithHint(
"##SearchComponent",
"Search...", searchBuffer,
sizeof(searchBuffer));
79 ImGui::TextDisabled(
"Available Components");
82 for (
const auto& compName : availableComponents) {
83 if (searchBuffer[0] !=
'\0') {
84 std::string lowerName = compName;
85 std::string lowerSearch = searchBuffer;
86 std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](
unsigned char c){ return std::tolower(c); });
87 std::transform(lowerSearch.begin(), lowerSearch.end(), lowerSearch.begin(), [](
unsigned char c){ return std::tolower(c); });
88 if (lowerName.find(lowerSearch) == std::string::npos) {
93 if (ImGui::Selectable(compName.c_str())) {
94 vex::ComponentRegistry::getInstance().createComponent(*
object, compName);
95 ImGui::CloseCurrentPopup();
96 searchBuffer[0] =
'\0';