]> git.localhorst.tv Git - blank.git/blob - src/ui/MessageBox.hpp
simple (text) progress display for preloader
[blank.git] / src / ui / MessageBox.hpp
1 #ifndef BLANK_UI_MESSAGEBOX_HPP_
2 #define BLANK_UI_MESSAGEBOX_HPP_
3
4 #include "Text.hpp"
5 #include "../graphics/align.hpp"
6
7 #include <deque>
8 #include <string>
9 #include <glm/glm.hpp>
10
11
12 namespace blank {
13
14 class Font;
15 class Viewport;
16
17 class MessageBox {
18
19 public:
20         explicit MessageBox(const Font &);
21
22         void Position(const glm::vec3 &, Gravity) noexcept;
23
24         void Foreground(const glm::vec4 &col) noexcept { fg = col; }
25         void Background(const glm::vec4 &col) noexcept { bg = col; }
26
27         void PushLine(const char *);
28         void PushLine(const std::string &l) {
29                 PushLine(l.c_str());
30         }
31
32         void Render(Viewport &) noexcept;
33
34 private:
35         const Font &font;
36         std::deque<Text> lines;
37         std::size_t max_lines;
38
39         glm::vec3 pos;
40         glm::vec3 adv;
41
42         glm::vec4 bg;
43         glm::vec4 fg;
44
45         Gravity grav;
46
47 };
48
49 }
50
51 #endif