aboutsummaryrefslogtreecommitdiff
path: root/frontend/GameController.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 17:32:53 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 17:32:53 +0100
commitb20f46c15dce8b196dbb8890890978947745e094 (patch)
treed9defa84717ffa843fd11b05d0e856473d6d8d59 /frontend/GameController.h
parenta7e84b60366c78b131d43157980fbe4c2df655e6 (diff)
change flow architecture
Diffstat (limited to 'frontend/GameController.h')
-rw-r--r--frontend/GameController.h31
1 files changed, 17 insertions, 14 deletions
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 <unordered_map>
#include <string>
+#include <memory>
+#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<Dungeon> make_dungeon() noexcept;
private:
void cmdset_default();
void cmdset_death();
private:
- std::unordered_map<std::string, FollowupAction(GameController::*)(std::string &)> cmds;
+ std::unordered_map<std::string, void(GameController::*)(std::string &)> 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> dungeon = nullptr;
+ bool playing = true;
+ bool quit = false;
};