diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2021-03-13 09:51:24 -0500 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2021-03-13 15:34:50 -0500 |
| commit | f9dd0fbabe5348fcd9841978cdd9d3a5824a5dec (patch) | |
| tree | 2d27fd932135254f8cc7f73146f78a283f4038a4 /src/menu.h | |
| parent | 7b0ac7fc096b2dadb47780e9afd141395b6a111b (diff) | |
| download | tanetane-f9dd0fbabe5348fcd9841978cdd9d3a5824a5dec.tar.gz tanetane-f9dd0fbabe5348fcd9841978cdd9d3a5824a5dec.tar.bz2 tanetane-f9dd0fbabe5348fcd9841978cdd9d3a5824a5dec.zip | |
Pause menu commands can do something
#7
Diffstat (limited to 'src/menu.h')
| -rw-r--r-- | src/menu.h | 9 |
1 files changed, 9 insertions, 0 deletions
| diff --git a/src/menu.h b/src/menu.h index 1b91b88..967b384 100644 --- a/src/menu.h +++ b/src/menu.h | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | #ifndef MENU_H_3F6E62B3 | 1 | #ifndef MENU_H_3F6E62B3 |
| 2 | #define MENU_H_3F6E62B3 | 2 | #define MENU_H_3F6E62B3 |
| 3 | 3 | ||
| 4 | #include <functional> | ||
| 4 | #include <memory> | 5 | #include <memory> |
| 5 | #include <string> | 6 | #include <string> |
| 6 | #include <vector> | 7 | #include <vector> |
| 7 | 8 | ||
| 9 | class Game; | ||
| 10 | |||
| 8 | enum class MenuType { | 11 | enum class MenuType { |
| 9 | Command | 12 | Command |
| 10 | }; | 13 | }; |
| @@ -12,6 +15,7 @@ enum class MenuType { | |||
| 12 | struct MenuItem { | 15 | struct MenuItem { |
| 13 | MenuType type = MenuType::Command; | 16 | MenuType type = MenuType::Command; |
| 14 | std::string text; | 17 | std::string text; |
| 18 | std::function<void(Game&)> activationFunction; | ||
| 15 | }; | 19 | }; |
| 16 | 20 | ||
| 17 | class MenuBuilder { | 21 | class MenuBuilder { |
| @@ -23,6 +27,11 @@ public: | |||
| 23 | return *this; | 27 | return *this; |
| 24 | } | 28 | } |
| 25 | 29 | ||
| 30 | MenuBuilder& ActivationFunction(std::function<void(Game&)> val) { | ||
| 31 | result_.activationFunction = std::move(val); | ||
| 32 | return *this; | ||
| 33 | } | ||
| 34 | |||
| 26 | MenuItem Build() const { | 35 | MenuItem Build() const { |
| 27 | return result_; | 36 | return result_; |
| 28 | } | 37 | } |
