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

31 lines
904 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;
}
2026-01-05 16:51:58 +08:00
bool IEngine::Tick() {
2026-01-04 17:16:54 +08:00
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
2026-01-05 16:51:58 +08:00
return false;
2026-01-04 17:16:54 +08:00
}
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