add to gui
This commit is contained in:
+26
-2
@@ -136,17 +136,41 @@ void Gui::render(const EngineStats& stats) {
|
||||
|
||||
ImGui::Columns(2, "main_columns");
|
||||
|
||||
// --- Left column: primary live readouts ---
|
||||
// --- (0,0): primary live readouts — tach + throttle lever side by side ---
|
||||
DrawTachGauge(static_cast<float>(stats.rpm), static_cast<float>(stats.max_rpm),
|
||||
static_cast<float>(stats.redline_rpm), 220.0f);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::VSliderFloat("##throttle_lever", ImVec2(40, 160), &m_throttle_lever, 0.0f, 1.0f, "");
|
||||
// VSliderFloat is only "active" while the mouse is down on it, so
|
||||
// this is the spring-back: anything other than an active drag
|
||||
// resets the lever to closed, including on release.
|
||||
if (!ImGui::IsItemActive()) {
|
||||
m_throttle_lever = 0.0f;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Throttle\n%.0f%%", m_throttle_lever * 100.0f);
|
||||
|
||||
// Row 1 starts here in both columns, so column 1's content below
|
||||
// lines up with column 0's regardless of which column is taller.
|
||||
float row1_y = ImGui::GetCursorPosY();
|
||||
|
||||
// --- (1,0): fuel/power readouts + accessory toggles ---
|
||||
ImGui::Text("Fuel Consumption: %.2f L/h", stats.fuel_consumption_lph);
|
||||
ImGui::Text("Crank Power: %.2f kW", stats.crank_power_kw);
|
||||
ImGui::Text("Output Heat: %.1f J", stats.output_heat_j);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Accessories");
|
||||
ImGui::Checkbox("Alternator", &m_accessories.alternator);
|
||||
ImGui::Checkbox("A/C", &m_accessories.ac);
|
||||
ImGui::Checkbox("Power Steering", &m_accessories.power_steering);
|
||||
|
||||
ImGui::NextColumn();
|
||||
|
||||
// --- Right column: extensible stats list (oil temp, coolant temp, ...) ---
|
||||
// --- (1,1): extensible stats list (oil temp, coolant temp, ...) ---
|
||||
ImGui::SetCursorPosY(row1_y);
|
||||
ImGui::Text("Stats");
|
||||
ImGui::Separator();
|
||||
for (const StatEntry& s : stats.extra_stats) {
|
||||
|
||||
Reference in New Issue
Block a user