mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
refactor
This commit is contained in:
parent
5fe5c6b27a
commit
5ffc054d75
16 changed files with 212 additions and 126 deletions
31
src/TestMainloop.cpp
Normal file
31
src/TestMainloop.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "TestMainloop.hpp"
|
||||
|
||||
#include "logic/scripting/scripting.hpp"
|
||||
#include "interfaces/Process.hpp"
|
||||
#include "debug/Logger.hpp"
|
||||
#include "engine.hpp"
|
||||
|
||||
static debug::Logger logger("mainloop");
|
||||
|
||||
inline constexpr int TPS = 20;
|
||||
|
||||
TestMainloop::TestMainloop(Engine& engine) : engine(engine) {
|
||||
}
|
||||
|
||||
void TestMainloop::run() {
|
||||
const auto& coreParams = engine.getCoreParameters();
|
||||
auto& time = engine.getTime();
|
||||
|
||||
if (coreParams.testFile.empty()) {
|
||||
logger.info() << "nothing to do";
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info() << "starting test " << coreParams.testFile;
|
||||
auto process = scripting::start_coroutine(coreParams.testFile);
|
||||
while (process->isActive()) {
|
||||
time.step(1.0f / static_cast<float>(TPS));
|
||||
process->update();
|
||||
}
|
||||
logger.info() << "test finished";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue