diff options
Diffstat (limited to 'frontend/GameController.h')
-rw-r--r-- | frontend/GameController.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/frontend/GameController.h b/frontend/GameController.h new file mode 100644 index 0000000..afcb5b8 --- /dev/null +++ b/frontend/GameController.h @@ -0,0 +1,53 @@ +#pragma once + +#include <unordered_map> +#include <string> + +#include "backend/Player.h" + +class Dungeon; +class Location; + +enum FollowupAction { + NONE, + UPDATE, + EXIT, + RESTART, +}; + +class GameController { + typedef FollowupAction Cmd(std::string &); + +public: + GameController(Dungeon & dungeon); + virtual ~GameController() = default; + +public: + FollowupAction cmd(std::string &); + +private: + void cmdset_default(); + void cmdset_death(); + +private: + std::unordered_map<std::string, FollowupAction(GameController::*)(std::string &)> cmds; + Cmd cmd_query; + Cmd cmd_search; + Cmd cmd_go; + Cmd cmd_get; + Cmd cmd_put; + Cmd cmd_view; + Cmd cmd_hit; + Cmd cmd_equip; + Cmd cmd_wait; + Cmd cmd_use; + Cmd cmd_help; + Cmd cmd_cheat; + Cmd cmd_quit; + Cmd cmd_restart; + +private: + Player & player; + Dungeon & dungeon; +}; + |