feat: project scripts
This commit is contained in:
parent
1e4a7c8ea8
commit
7749da4a85
@ -174,4 +174,8 @@ public:
|
||||
devtools::Editor& getEditor() {
|
||||
return *editor;
|
||||
}
|
||||
|
||||
const Project& getProject() {
|
||||
return *project;
|
||||
}
|
||||
};
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user