add to gui

This commit is contained in:
Avery Haas
2026-08-31 23:57:40 -04:00
parent 120e4f505f
commit 1175b498b0
11 changed files with 90 additions and 5 deletions
+23
View File
@@ -28,6 +28,15 @@ struct EngineStats {
std::vector<StatEntry> extra_stats;
};
// Which parasitic-load accessories are toggled on, via checkboxes drawn
// in the left column by render(). Placeholders (Alternator, A/C, Power
// Steering) until there's an actual load model behind them.
struct AccessoryState {
bool alternator = false;
bool ac = false;
bool power_steering = false;
};
class Gui {
public:
bool init(); // create window + ImGui context
@@ -36,6 +45,20 @@ public:
void end_frame(); // swap buffers
void shutdown();
// Reflects the throttle lever as of the most recent render() call.
// Spring-loaded: holds whatever value the drag left it at only
// while the mouse is down, and snaps back to 0 the instant it's
// released. Read it any time after render() this frame, or before
// render() next frame, to feed it into the engine.
double throttle() const { return static_cast<double>(m_throttle_lever); }
// Reflects the checkbox state as of the most recent render() call —
// read it any time after render() this frame, or before render()
// next frame, to feed accessory load into the engine.
const AccessoryState& accessories() const { return m_accessories; }
private:
GLFWwindow* m_window = nullptr;
float m_throttle_lever = 0.0f;
AccessoryState m_accessories;
};