1
0
Files
BasaltMeter/BasaltPresenter/Shared/engine.cpp

30 lines
882 B
C++
Raw Normal View History

2026-01-04 16:12:36 +08:00
#include "engine.hpp"
2026-01-04 17:16:54 +08:00
#include <stdexcept>
2026-01-04 16:12:36 +08:00
namespace Basalt::Shared::Engine {
2026-01-04 17:16:54 +08:00
IEngine::IEngine() : config(), status(EngineStatus::Ready) {}
2026-01-04 16:12:36 +08:00
2026-01-04 17:16:54 +08:00
IEngine::~IEngine() {
if (this->status != EngineStatus::Stop) {
this->Shutdown();
}
}
void IEngine::Startup(EngineConfig &&config) {
if (this->status != EngineStatus::Ready) throw std::runtime_error("unexpected engine status");
this->config = std::move(config);
this->status = EngineStatus::Running;
}
void IEngine::Tick() {
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
}
void IEngine::Shutdown() {
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
this->status = EngineStatus::Stop;
}
2026-01-04 16:12:36 +08:00
} // namespace Basalt::Shared::Engine