]> git.localhorst.tv Git - blank.git/blob - src/ui/Text.hpp
simple (text) progress display for preloader
[blank.git] / src / ui / Text.hpp
1 #ifndef BLANK_UI_TEXT_HPP_
2 #define BLANK_UI_TEXT_HPP_
3
4 #include "../graphics/align.hpp"
5 #include "../graphics/Texture.hpp"
6 #include "../model/SpriteModel.hpp"
7
8 #include <string>
9 #include <glm/glm.hpp>
10
11
12 namespace blank {
13
14 class Font;
15 class Viewport;
16
17 class Text {
18
19 public:
20         Text() noexcept;
21
22         void Set(const Font &, const char *);
23         void Set(const Font &f, const std::string &s) {
24                 Set(f, s.c_str());
25         }
26
27         void Pivot(Gravity p) {
28                 pivot = p;
29                 dirty = true;
30         }
31
32         void Render(Viewport &) noexcept;
33
34 private:
35         void Update();
36
37 private:
38         Texture tex;
39         SpriteModel sprite;
40         glm::vec2 size;
41         Gravity pivot;
42         bool dirty;
43
44 };
45
46 }
47
48 #endif