]> git.localhorst.tv Git - blank.git/blob - src/ui/HUD.hpp
cab8f93e0bf13c26cccb69a6a3a4d48b6ac28fa9
[blank.git] / src / ui / HUD.hpp
1 #ifndef BLANK_UI_HUD_H_
2 #define BLANK_UI_HUD_H_
3
4 #include "FixedText.hpp"
5 #include "MessageBox.hpp"
6 #include "../graphics/EntityMesh.hpp"
7 #include "../graphics/PrimitiveMesh.hpp"
8
9 #include <glm/glm.hpp>
10
11
12 namespace blank {
13
14 class Block;
15 class BlockTypeRegistry;
16 class Config;
17 class Environment;
18 class Font;
19 class Player;
20 class Viewport;
21
22 class HUD {
23
24 public:
25         explicit HUD(Environment &, Config &, const Player &);
26
27         HUD(const HUD &) = delete;
28         HUD &operator =(const HUD &) = delete;
29
30         // focus
31         void FocusBlock(const Chunk &, int);
32         void FocusEntity(const Entity &);
33         void FocusNone();
34
35         // "inventory"
36         void DisplayNone();
37         void Display(const BlockType &);
38
39         // debug overlay
40         void UpdateDebug();
41         void UpdateCounter();
42         void UpdatePosition();
43         void UpdateOrientation();
44
45         // message box
46         void PostMessage(const char *);
47         void PostMessage(const std::string &msg) {
48                 PostMessage(msg.c_str());
49         }
50
51         void Update(int dt);
52         void Render(Viewport &) noexcept;
53
54 private:
55         Environment &env;
56         Config &config;
57         const Player &player;
58
59         // block focus
60         PrimitiveMesh outline;
61         glm::mat4 outline_transform;
62         bool outline_visible;
63
64         // "inventory"
65         EntityMesh block;
66         EntityMesh::Buffer block_buf;
67         glm::mat4 block_transform;
68         FixedText block_label;
69         bool block_visible;
70
71         // debug overlay
72         FixedText counter_text;
73         FixedText position_text;
74         FixedText orientation_text;
75         FixedText block_text;
76         FixedText entity_text;
77         bool show_block;
78         bool show_entity;
79
80         // message box
81         MessageBox messages;
82         IntervalTimer msg_timer;
83
84         // crosshair
85         PrimitiveMesh crosshair;
86
87 };
88
89 }
90
91 #endif