mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
feat: project scripts
This commit is contained in:
parent
1e4a7c8ea8
commit
7749da4a85
2 changed files with 19 additions and 0 deletions
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
#include "Engine.hpp"
|
||||
#include "debug/Logger.hpp"
|
||||
#include "devtools/Project.hpp"
|
||||
#include "frontend/screens/MenuScreen.hpp"
|
||||
#include "frontend/screens/LevelScreen.hpp"
|
||||
#include "interfaces/Process.hpp"
|
||||
#include "logic/scripting/scripting.hpp"
|
||||
#include "window/Window.hpp"
|
||||
#include "world/Level.hpp"
|
||||
|
||||
|
|
@ -28,12 +31,24 @@ void Mainloop::run() {
|
|||
));
|
||||
}
|
||||
});
|
||||
|
||||
io::path projectScript = "project:project_script.lua";
|
||||
std::unique_ptr<Process> process;
|
||||
if (io::exists(projectScript)) {
|
||||
logger.info() << "starting project script";
|
||||
process = scripting::start_coroutine(projectScript);
|
||||
} else {
|
||||
logger.warning() << "project script does not exists";
|
||||
}
|
||||
|
||||
logger.info() << "starting menu screen";
|
||||
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
||||
|
||||
logger.info() << "main loop started";
|
||||
while (!window.isShouldClose()){
|
||||
if (process) {
|
||||
process->update();
|
||||
}
|
||||
time.update(window.time());
|
||||
engine.updateFrontend();
|
||||
if (!window.isIconified()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue