aboutsummaryrefslogtreecommitdiff
path: root/src/engine/engine.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-23 19:41:31 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:57 +0200
commit486ca3846b46dc229e5807968578809766ec1991 (patch)
tree65a4b7a746d6305666af06f8a1975c76244085a7 /src/engine/engine.cpp
parentb8e86ce397dc07320c02f6a5f592c7c6a4421c86 (diff)
feat: implement generations & multithreading
Diffstat (limited to 'src/engine/engine.cpp')
-rw-r--r--src/engine/engine.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp
index e463f28..c988c33 100644
--- a/src/engine/engine.cpp
+++ b/src/engine/engine.cpp
@@ -2,6 +2,7 @@
#include "util/function.hpp"
+#include <thread>
#include <utility>
CLIGameEngine::CLIGameEngine(IGameFactory game_factory, ISceneFactory scene_factory,
@@ -38,7 +39,16 @@ void CLIGameEngine::start() noexcept
_configure_input(game->get_input_config());
- _input_handler->listen();
+ std::thread listen_input_thread(normalize_lambda(
+ [this]()
+ {
+ _input_handler->listen();
+ }));
+
+ while (true)
+ {
+ game->on_update();
+ }
}
void CLIGameEngine::_configure_input(