feat: project scripts
This commit is contained in:
@@ -174,4 +174,8 @@ public:
|
|||||||
devtools::Editor& getEditor() {
|
devtools::Editor& getEditor() {
|
||||||
return *editor;
|
return *editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Project& getProject() {
|
||||||
|
return *project;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
#include "Engine.hpp"
|
#include "Engine.hpp"
|
||||||
#include "debug/Logger.hpp"
|
#include "debug/Logger.hpp"
|
||||||
|
#include "devtools/Project.hpp"
|
||||||
#include "frontend/screens/MenuScreen.hpp"
|
#include "frontend/screens/MenuScreen.hpp"
|
||||||
#include "frontend/screens/LevelScreen.hpp"
|
#include "frontend/screens/LevelScreen.hpp"
|
||||||
|
#include "interfaces/Process.hpp"
|
||||||
|
#include "logic/scripting/scripting.hpp"
|
||||||
#include "window/Window.hpp"
|
#include "window/Window.hpp"
|
||||||
#include "world/Level.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";
|
logger.info() << "starting menu screen";
|
||||||
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
||||||
|
|
||||||
logger.info() << "main loop started";
|
logger.info() << "main loop started";
|
||||||
while (!window.isShouldClose()){
|
while (!window.isShouldClose()){
|
||||||
|
if (process) {
|
||||||
|
process->update();
|
||||||
|
}
|
||||||
time.update(window.time());
|
time.update(window.time());
|
||||||
engine.updateFrontend();
|
engine.updateFrontend();
|
||||||
if (!window.isIconified()) {
|
if (!window.isIconified()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user