]> git.localhorst.tv Git - blobs.git/blob - src/ui/Label.hpp
overhaul need system
[blobs.git] / src / ui / Label.hpp
1 #ifndef BLOBS_UI_LABEL_HPP_
2 #define BLOBS_UI_LABEL_HPP_
3
4 #include "Widget.hpp"
5 #include "../graphics/Texture.hpp"
6
7 #include <string>
8
9
10 namespace blobs {
11 namespace graphics {
12         class Font;
13 }
14 namespace ui {
15
16 class Label
17 : public Widget {
18
19 public:
20         explicit Label(const graphics::Font &);
21         ~Label() override;
22
23 public:
24         Label *Text(const std::string &);
25         Label *Decimal(double n, int prec = 2);
26         Label *Length(double m);
27         Label *Mass(double kg);
28         Label *Percentage(double n);
29         Label *Time(double s);
30         Label *Font(const graphics::Font &);
31         Label *Foreground(const glm::vec4 &);
32         Label *Background(const glm::vec4 &);
33
34         glm::vec2 Size() override;
35         void Draw(app::Assets &, graphics::Viewport &) noexcept override;
36
37 private:
38         void Update();
39
40 private:
41         const graphics::Font *font;
42         std::string text;
43         graphics::Texture tex;
44         glm::vec4 fg_color;
45         glm::vec4 bg_color;
46         bool dirty;
47
48 };
49
50 }
51 }
52
53 #endif