diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-10 12:02:04 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-10 12:02:04 +0000 |
commit | a62fbea8d40f623ffcd60eced63f295cd55db084 (patch) | |
tree | 2374234d4364eb389df98fff0c4c180118331b27 /yage/engine/engine.cpp | |
parent | cbd6bf4a695370dbfc088bbe0cd6f270e1c112a7 (diff) | |
download | YAGE-a62fbea8d40f623ffcd60eced63f295cd55db084.tar.gz YAGE-a62fbea8d40f623ffcd60eced63f295cd55db084.zip |
[Engine] Adding initial components for an ECS.
Diffstat (limited to 'yage/engine/engine.cpp')
-rw-r--r-- | yage/engine/engine.cpp | 21 |
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); } } |