aboutsummaryrefslogtreecommitdiffstats
path: root/yage/engine/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yage/engine/engine.cpp')
-rw-r--r--yage/engine/engine.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/yage/engine/engine.cpp b/yage/engine/engine.cpp
index 3918e7e9..cf6f73b7 100644
--- a/yage/engine/engine.cpp
+++ b/yage/engine/engine.cpp
@@ -8,23 +8,26 @@
#include "engine.h"
-#include "../core/window.h"
-
namespace yage
{
-void Engine::mainLoop()
+void Engine::init()
{
- Window window;
+ window_.create("Game Engine", 800, 640);
- window.create("Game Engine", 800, 640);
+ for (auto &system : systems_) {
+ system->init();
+ }
+}
- while(!window.shouldClose()) {
- window.clearBuffer();
+void Engine::mainLoop()
+{
+ while (!window_.shouldClose()) {
+ window_.clearBuffer();
update();
- window.swapBuffer();
+ window_.swapBuffer();
}
}
@@ -32,7 +35,7 @@ void Engine::update()
{
const double dt = 1.0 / 60.0;
- for(auto &&system : systems_) {
+ for (auto &system : systems_) {
system->update(dt);
}
}