]> git.localhorst.tv Git - blank.git/blob - src/ui/Text.hpp
glm backwards compatibility
[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/glm.hpp"
6 #include "../graphics/Texture.hpp"
7 #include "../graphics/SpriteMesh.hpp"
8
9 #include <string>
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         Gravity Pivot() const noexcept { return pivot; }
28         void Pivot(Gravity p) noexcept {
29                 pivot = p;
30                 dirty = true;
31         }
32
33         const glm::vec2 &Size() const noexcept { return size; }
34
35         void Render(Viewport &) noexcept;
36
37 private:
38         void Update();
39
40 private:
41         Texture tex;
42         SpriteMesh sprite;
43         glm::vec2 size;
44         Gravity pivot;
45         bool dirty;
46
47 };
48
49 }
50
51 #endif