From 486ca3846b46dc229e5807968578809766ec1991 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 23 Mar 2022 19:41:31 +0100 Subject: feat: implement generations & multithreading --- src/engine/engine.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/engine/engine.cpp') 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 #include 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( -- cgit v1.2.3-18-g5258