Files
engine-sim-cpp/gui/gui.h
T
Avery Haas 120e4f505f init commit
2026-08-28 22:38:58 -04:00

42 lines
1.1 KiB
C++

#pragma once
#include <string>
#include <vector>
struct GLFWwindow;
// One row for the extensible right-hand stats list (oil temp, coolant
// temp, etc.) — push more entries onto EngineStats::extra_stats as the
// sim grows, no Gui changes needed.
struct StatEntry {
std::string label;
double value;
std::string unit;
};
// Plain data the GUI reads each frame. The GUI knows nothing about
// Engine/Transmission/Vehicle — main.cpp fills this in from Simulation.
struct EngineStats {
double rpm = 0.0;
double redline_rpm = 6500.0; // tach gauge: start of red zone
double max_rpm = 8000.0; // tach gauge: full scale
double fuel_consumption_lph = 0.0;
double crank_power_kw = 0.0;
double output_heat_j = 0.0;
std::vector<StatEntry> extra_stats;
};
class Gui {
public:
bool init(); // create window + ImGui context
bool begin_frame(); // returns false when the window should close
void render(const EngineStats& stats);
void end_frame(); // swap buffers
void shutdown();
private:
GLFWwindow* m_window = nullptr;
};