mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
refactor & add test.new_world
This commit is contained in:
parent
8f37704530
commit
9b4dd8f65e
9 changed files with 57 additions and 8 deletions
|
|
@ -1,8 +1,10 @@
|
|||
#include "TestMainloop.hpp"
|
||||
|
||||
#include "logic/scripting/scripting.hpp"
|
||||
#include "logic/LevelController.hpp"
|
||||
#include "interfaces/Process.hpp"
|
||||
#include "debug/Logger.hpp"
|
||||
#include "world/Level.hpp"
|
||||
#include "engine.hpp"
|
||||
|
||||
static debug::Logger logger("mainloop");
|
||||
|
|
@ -12,6 +14,8 @@ inline constexpr int TPS = 20;
|
|||
TestMainloop::TestMainloop(Engine& engine) : engine(engine) {
|
||||
}
|
||||
|
||||
TestMainloop::~TestMainloop() = default;
|
||||
|
||||
void TestMainloop::run() {
|
||||
const auto& coreParams = engine.getCoreParameters();
|
||||
auto& time = engine.getTime();
|
||||
|
|
@ -20,6 +24,9 @@ void TestMainloop::run() {
|
|||
logger.info() << "nothing to do";
|
||||
return;
|
||||
}
|
||||
engine.setLevelConsumer([this](auto level) {
|
||||
setLevel(std::move(level));
|
||||
});
|
||||
|
||||
logger.info() << "starting test " << coreParams.testFile;
|
||||
auto process = scripting::start_coroutine(coreParams.testFile);
|
||||
|
|
@ -29,3 +36,7 @@ void TestMainloop::run() {
|
|||
}
|
||||
logger.info() << "test finished";
|
||||
}
|
||||
|
||||
void TestMainloop::setLevel(std::unique_ptr<Level> level) {
|
||||
this->controller = std::make_unique<LevelController>(&engine, std::move(level));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue