diff options
Diffstat (limited to 'src/menu.h')
-rw-r--r-- | src/menu.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/menu.h b/src/menu.h new file mode 100644 index 0000000..ac72999 --- /dev/null +++ b/src/menu.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef MENU_H_61DBBF6A | ||
2 | #define MENU_H_61DBBF6A | ||
3 | |||
4 | #include <string> | ||
5 | #include <functional> | ||
6 | #include <vector> | ||
7 | #include "interpolation.h" | ||
8 | |||
9 | class Game; | ||
10 | |||
11 | enum class MenuState { | ||
12 | Closed, | ||
13 | Opening, | ||
14 | Open, | ||
15 | Closing | ||
16 | }; | ||
17 | |||
18 | struct MenuItem { | ||
19 | std::string text; | ||
20 | std::function<void(Game&)> activationFunction; | ||
21 | }; | ||
22 | |||
23 | class Menu { | ||
24 | public: | ||
25 | |||
26 | Menu(); | ||
27 | |||
28 | void update(size_t dt, Game& game); | ||
29 | |||
30 | void open(Game& game); | ||
31 | |||
32 | MenuState menuState = MenuState::Closed; | ||
33 | Interpolation menuDisplayProgress; | ||
34 | std::vector<MenuItem> items; | ||
35 | int cursor = 0; | ||
36 | |||
37 | private: | ||
38 | |||
39 | void close(); | ||
40 | }; | ||
41 | |||
42 | #endif /* end of include guard: MENU_H_61DBBF6A */ | ||