From 8452b199d28bea53bf2c5e3b3d604064000fc73d Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 18 Jan 2017 06:46:36 -0500 Subject: inventory bar --- main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 49199a0..7e06d7d 100644 --- a/main.cpp +++ b/main.cpp @@ -20,29 +20,29 @@ using namespace std::literals::chrono_literals; #include #include #include +#include class GameThread : public entityx::Receiver { private: std::atomic_bool die; - bool running; std::thread thread; public: template GameThread(F&& func) { die.store(false); - running = true; thread = std::thread([this](F&& f) { while (!die.load()) f(); - running = false; }, std::forward(func)); } + ~GameThread(void) { + thread.join(); + } + void stop(void) { die.store(true); - while (running) - std::this_thread::sleep_for(2ms); } }; @@ -133,6 +133,10 @@ int main(int argc, char *argv[]) // // ///////////////////////////// + + game::engine.getSystem()->add("Debug", 3); + + std::list eventQueue; if (!worldDontReallyRun) { -- cgit v1.2.3