Vehicle tabs UI tweak (#1521)

This commit is contained in:
DayibBaba 2023-06-25 10:38:53 +02:00 committed by GitHub
parent 305f6e7e8d
commit 1e701326a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 18 deletions

View File

@ -22,8 +22,6 @@ namespace big
HANDLING_CURRENT_PROFILE,
LSC,
SPAWN_VEHICLE,
PV,
PERSIST_CAR,
FUN_VEHICLE,
WORLD,
@ -103,8 +101,6 @@ namespace big
},
{tabs::LSC, {"GUI_TAB_LSC", view::lsc}},
{tabs::SPAWN_VEHICLE, {"GUI_TAB_SPAWN_VEHICLE", view::spawn_vehicle}},
{tabs::PV, {"GUI_TAB_PERSONAL_VEHICLE", view::pv}},
{tabs::PERSIST_CAR, {"GUI_TAB_PERSIST_CAR", view::persist_car}},
{tabs::FUN_VEHICLE, {"GUI_TAB_VEHICLE_FUN_FEATURES", view::fun_vehicle}},
},
},

View File

@ -52,7 +52,9 @@ namespace big
for (const auto& pair : vehicle_files)
{
if (ImGui::Selectable(pair.c_str(), selected_vehicle_file == pair))
selected_vehicle_file = pair;
selected_vehicle_file = pair, g_fiber_pool->queue_job([] {
load_vehicle(selected_vehicle_file);
});
}
ImGui::EndListBox();
@ -63,10 +65,9 @@ namespace big
ImGui::BeginGroup();
static char vehicle_file_name_input[50]{};
components::small_text("VEHICLE_FILE_NAME"_T);
ImGui::PushItemWidth(250);
components::input_text_with_hint("VEHICLE_FILE_NAME"_T, "VEHICLE_FILE_NAME_EXAMPLE"_T, vehicle_file_name_input, IM_ARRAYSIZE(vehicle_file_name_input));
ImGui::SameLine();
components::input_text_with_hint("##vehiclefilename", "VEHICLE_FILE_NAME_EXAMPLE"_T, vehicle_file_name_input, IM_ARRAYSIZE(vehicle_file_name_input));
components::button("SAVE_VEHICLE"_T, [] {
if (!self::veh)
@ -75,13 +76,6 @@ namespace big
save_vehicle(vehicle_file_name_input);
});
components::button("LOAD_VEHICLE"_T, [] {
if (self::veh)
return g_notification_service->push_warning("PERSIST_CAR"_T.data(), "You must not be in a vehicle. Please exit your vehicle before using load.");
load_vehicle(selected_vehicle_file);
});
ImGui::EndGroup();
}
}

View File

@ -7,7 +7,7 @@
namespace big
{
void view::spawn_vehicle()
void render_spawn_new_vehicle()
{
ImGui::SetWindowSize({0.f, (float)*g_pointers->m_gta.m_resolution_y}, ImGuiCond_Always);
@ -196,4 +196,21 @@ namespace big
ImGui::EndListBox();
}
}
void view::spawn_vehicle()
{
static int spawn_type = 0;
ImGui::RadioButton("New", &spawn_type, 0);
ImGui::SameLine();
ImGui::RadioButton("Personal", &spawn_type, 1);
ImGui::SameLine();
ImGui::RadioButton("Persistent", &spawn_type, 2);
switch (spawn_type)
{
case 0: render_spawn_new_vehicle(); break;
case 1: view::pv(); break;
case 2: view::persist_car(); break;
}
}
}