input for xml transport (#3207)
Some checks are pending
Nightly Build / Check Recent Commit (push) Successful in 37s
Nightly Build / Build Nightly (push) Waiting to run
Nightly Build / Recreate Release (push) Blocked by required conditions

This commit is contained in:
CringeArab 2024-06-01 00:55:44 +03:00 committed by GitHub
parent 9df32a3adf
commit 9a2e85b7f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,11 @@ namespace big
{
void view::xml_vehicles()
{
static char search[64];
components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, IM_ARRAYSIZE(search), ImGuiInputTextFlags_None);
std::string lower_search = search;
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
ImGui::BeginGroup();
components::button("Reload", [] {
@ -17,11 +22,16 @@ namespace big
{
for (auto& [name, doc] : g_xml_vehicles_service->m_all_xml_vehicles)
{
components::selectable(name, false, [&doc] {
auto handle = g_xml_vehicles_service->spawn_from_xml(doc, self::pos);
if (g.spawn_vehicle.spawn_inside)
vehicle::teleport_into_vehicle(handle);
});
std::string lower_name = name;
std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), tolower);
if (lower_name.find(lower_search) != std::string::npos)
{
components::selectable(name, false, [&doc] {
auto handle = g_xml_vehicles_service->spawn_from_xml(doc, self::pos);
if (g.spawn_vehicle.spawn_inside)
vehicle::teleport_into_vehicle(handle);
});
}
}
ImGui::EndListBox();