aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 4803c64..317e116 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -25,6 +25,9 @@
#include "window.hpp"
#include "script.hpp"
+#include "components/Script.hpp"
+#include "components/Position.hpp"
+
int Engine::init(void)
{
systems.add<GameRunSystem>();
@@ -44,8 +47,16 @@ void Engine::logicLoop(void)
while (shouldRun()) {
systems.update<InputSystem>(dt);
+
+ // All entities with an idle function should be run here
+ entities.each<Scripted>([](entityx::Entity, Scripted &f){
+ f.exec();
+ });
std::this_thread::sleep_for(100ms);
}
+
+ // Remove all Lua references from entities
+ entities.each<Scripted>([](entityx::Entity, Scripted &f){ f.cleanup(); });
}
void Engine::renderLoop(void)