16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 11:19:19 +02:00

move vehicle param window to vehicle list, add radiostop button

This commit is contained in:
milek7
2019-03-16 20:51:51 +01:00
parent 20652829b1
commit 16570f8d23
21 changed files with 130 additions and 81 deletions

View File

@@ -5,17 +5,14 @@
#include "Driver.h"
#include "Train.h"
ui::vehicleparams_panel::vehicleparams_panel()
: ui_panel(LOC_STR(vehicleparams_window), false)
ui::vehicleparams_panel::vehicleparams_panel(const std::string &vehicle)
: ui_panel(std::string(LOC_STR(vehicleparams_window)) + ": " + vehicle, false), m_vehicle_name(vehicle)
{
}
void ui::vehicleparams_panel::render_contents()
{
if (m_vehicle_name.empty())
m_vehicle_name = simulation::Vehicles.sequence()[0]->name();
TDynamicObject *vehicle_ptr = simulation::Vehicles.find(m_vehicle_name);
if (!vehicle_ptr) {
is_open = false;
@@ -186,4 +183,12 @@ void ui::vehicleparams_panel::render_contents()
vehicle.GetPosition().z );
ImGui::TextUnformatted(buffer.data());
if (ImGui::Button(LOC_STR(vehicleparams_radiostop)))
m_relay.post(user_command::radiostop, 0.0, 0.0, GLFW_PRESS, 0, vehicle_ptr->GetPosition());
ImGui::SameLine();
if (ImGui::Button(LOC_STR(vehicleparams_reset)))
m_relay.post(user_command::resettrainset, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &vehicle_ptr->name());
}