From b20f46c15dce8b196dbb8890890978947745e094 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 1 Nov 2024 17:32:53 +0100 Subject: change flow architecture --- frontend/GameController.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'frontend/GameController.h') diff --git a/frontend/GameController.h b/frontend/GameController.h index afcb5b8..9f0d6ee 100644 --- a/frontend/GameController.h +++ b/frontend/GameController.h @@ -2,35 +2,37 @@ #include #include +#include +#include "backend/Dungeon.h" #include "backend/Player.h" -class Dungeon; class Location; -enum FollowupAction { - NONE, - UPDATE, - EXIT, - RESTART, -}; - class GameController { - typedef FollowupAction Cmd(std::string &); + typedef void Cmd(std::string &); public: - GameController(Dungeon & dungeon); + GameController(); virtual ~GameController() = default; +private: + void gameloop(); public: - FollowupAction cmd(std::string &); + int main(); + +private: + void cmd(std::string &); + +private: + std::unique_ptr make_dungeon() noexcept; private: void cmdset_default(); void cmdset_death(); private: - std::unordered_map cmds; + std::unordered_map cmds; Cmd cmd_query; Cmd cmd_search; Cmd cmd_go; @@ -47,7 +49,8 @@ private: Cmd cmd_restart; private: - Player & player; - Dungeon & dungeon; + std::unique_ptr dungeon = nullptr; + bool playing = true; + bool quit = false; }; -- cgit v1.2.3