-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gui.hpp
75 lines (62 loc) · 1.53 KB
/
Gui.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef GUI_HPP
#define GUI_HPP
class Engine;
class TCODConsole;
class TCODColor;
class Menu
{
public:
enum class MenuItemCode
{
NONE,
NEW_GAME,
CONTINUE,
EXIT,
CONSTITUTION,
STRENGTH,
AGILITY
};
enum class DisplayMode
{
MAIN,
PAUSE
};
~Menu();
void clear();
void addItem(const MenuItemCode t_code, const char *t_label);
MenuItemCode pick(const DisplayMode t_mode = DisplayMode::MAIN);
protected:
struct MenuItem
{
MenuItemCode m_code;
std::string m_label;
MenuItem(const MenuItemCode t_code, const char *t_label) : m_code(t_code), m_label{t_label} {}
};
std::vector<std::unique_ptr<MenuItem>> m_items;
};
class Gui : public Persistent
{
public:
Menu m_menu;
Gui();
~Gui();
void render();
void clear();
void message(const TCODColor &t_color, const char *t_text, ...);
void save(TCODZip &t_zip);
void load(TCODZip &t_zip);
protected:
struct Message
{
std::unique_ptr<std::string> m_text;
const TCODColor m_color;
Message(const char *t_text, const TCODColor &t_color);
};
std::vector<std::unique_ptr<Message>> m_log;
std::unique_ptr<TCODConsole> m_con;
void renderBar(const int t_x, const int t_y, const int t_width,
const char *t_name, const float t_value, const float t_max_value,
const TCODColor &t_bar_color, const TCODColor &t_back_color);
void renderMouseLook();
};
#endif