18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-14 12:22:24 +01:00

driveruipanels: Allow to toggle AI driver from the driving aid

Possibly the single greatest UX improvement for newcomers that could
there ever be.
This commit is contained in:
Sebastian Krzyszkowiak
2026-10-27 01:19:10 +01:00
parent 68fdf1efdf
commit b8ea91bd44
2 changed files with 19 additions and 0 deletions

View File

@@ -206,6 +206,24 @@ drivingaid_panel::update() {
}
}
void
drivingaid_panel::render_contents() {
ImGui::Checkbox(STR_C("expand"), &is_expanded);
ImGui::SameLine();
auto const *driver = (simulation::Train && simulation::Train->Dynamic()) ? simulation::Train->Dynamic()->Mechanik : nullptr;
if (driver && (false == Global.RealisticControlMode || DebugModeFlag)) {
bool autopilot = driver->AIControllFlag;
if (ImGui::Checkbox(STR_C("autopilot"), &autopilot)) {
command_relay commandrelay;
commandrelay.post(autopilot ? user_command::aidriverenable : user_command::aidriverdisable, 0.0, 0.0, GLFW_PRESS, 0);
}
}
ui_panel::render_contents();
}
void
scenario_panel::update() {

View File

@@ -20,6 +20,7 @@ public:
{}
void update() override;
void render_contents() override;
private:
// members