This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/src/views/vehicle/spawn/view_xml_vehicles.cpp

32 lines
788 B
C++
Raw Normal View History

2023-07-07 11:11:54 +02:00
#include "pointers.hpp"
#include "pugixml.hpp"
#include "services/vehicle/xml_vehicles_service.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
namespace big
{
void view::xml_vehicles()
{
ImGui::BeginGroup();
components::button("Reload", [] {
g_xml_vehicles_service->fetch_xml_files();
});
if (ImGui::BeginListBox("##xmllist", {300, static_cast<float>(*g_pointers->m_gta.m_resolution_y - 188 - 38 * 4)}))
{
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);
});
}
ImGui::EndListBox();
}
ImGui::EndGroup();
}
}