]> git.localhorst.tv Git - blobs.git/blob - src/ui/Widget.hpp
a69defbcfc45a4cb1b2dcd510b9fb4a2cb540eb5
[blobs.git] / src / ui / Widget.hpp
1 #ifndef BLOBS_UI_WIDGET_HPP_
2 #define BLOBS_UI_WIDGET_HPP_
3
4 #include "../math/glm.hpp"
5
6
7 namespace blobs {
8 namespace app {
9         struct Assets;
10 }
11 namespace graphics {
12         class Viewport;
13 }
14 namespace ui {
15
16 class Widget {
17
18 public:
19         Widget();
20         virtual ~Widget();
21
22         Widget(const Widget &) = delete;
23         Widget &operator =(const Widget &) = delete;
24
25         Widget(Widget &&) = delete;
26         Widget &operator =(Widget &&) = delete;
27
28 public:
29         Widget *Position(const glm::vec2 &p) noexcept { pos = p; return this; }
30         const glm::vec2 &Position() const noexcept { return pos; }
31
32         Widget *ZIndex(float z) noexcept { z_index = z; return this; }
33         float ZIndex() const noexcept { return z_index; }
34
35         virtual glm::vec2 Size() = 0;
36         virtual void Draw(app::Assets &, graphics::Viewport &) noexcept = 0;
37
38 private:
39         glm::vec2 pos;
40         float z_index;
41
42 };
43
44 }
45 }
46
47 #endif