1
0

refactor shared

This commit is contained in:
2026-01-08 19:23:19 +08:00
parent 07cc58fb36
commit 64368b7837
23 changed files with 400 additions and 234 deletions

View File

@@ -0,0 +1,34 @@
#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::GetGuid() 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;
}
}