35 lines
976 B
C++
35 lines
976 B
C++
#include "engine.hpp"
|
|
#include <stdexcept>
|
|
|
|
namespace basalt::shared::engine {
|
|
|
|
IEngine::IEngine() : config(), status(EngineStatus::Ready) {}
|
|
|
|
IEngine::~IEngine() {
|
|
if (this->status != EngineStatus::Stop) {
|
|
this->shutdown();
|
|
}
|
|
}
|
|
|
|
guid::Guid IEngine::get_guid() const {
|
|
throw std::logic_error("unimplemented function");
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
bool IEngine::tick() {
|
|
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
|
|
return false;
|
|
}
|
|
|
|
void IEngine::shutdown() {
|
|
if (this->status != EngineStatus::Running) throw std::runtime_error("unexpected engine status");
|
|
this->status = EngineStatus::Stop;
|
|
}
|
|
|
|
}
|