X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FLabel.hpp;h=267cc639c6bc1b39470593f57db496a0d86aae68;hb=475f28f06c9e14912bab8119264e247ef466513d;hp=0b9e0ca8e4534c90bebd542a75fe8b56906deb6f;hpb=76b630bd0a147bf7c78d3380237c86b9bfc48530;p=blobs.git diff --git a/src/ui/Label.hpp b/src/ui/Label.hpp index 0b9e0ca..267cc63 100644 --- a/src/ui/Label.hpp +++ b/src/ui/Label.hpp @@ -1,48 +1,38 @@ #ifndef BLOBS_UI_LABEL_HPP_ #define BLOBS_UI_LABEL_HPP_ -#include "align.hpp" +#include "Widget.hpp" #include "../graphics/Texture.hpp" #include namespace blobs { -namespace app { - struct Assets; -} namespace graphics { class Font; - class Viewport; } namespace ui { -class Label { +class Label +: public Widget { public: explicit Label(const graphics::Font &); - ~Label(); - - Label(const Label &) = delete; - Label &operator =(const Label &) = delete; - - Label(Label &&) = delete; - Label &operator =(Label &&) = delete; + ~Label() override; public: - Label &Text(const std::string &); - Label &Font(const graphics::Font &); - Label &Foreground(const glm::vec4 &); - Label &Background(const glm::vec4 &); - - Label &Position(const glm::vec3 &p) noexcept { pos = p; return *this; } - const glm::vec3 &Position() const noexcept { return pos; } - - Label &Origin(Gravity o) noexcept { origin = o; return *this; } - Gravity Origin() const noexcept { return origin; } - - glm::vec2 Size(); - void Draw(app::Assets &, graphics::Viewport &) noexcept; + Label *Text(const std::string &); + Label *Decimal(double n, int prec = 2); + Label *Length(double m); + Label *Mass(double kg); + Label *Percentage(double n); + Label *Time(double s); + Label *Font(const graphics::Font &); + Label *Foreground(const glm::vec4 &); + Label *Background(const glm::vec4 &); + + glm::vec2 Size() override; + void Draw(app::Assets &, graphics::Viewport &) noexcept override; private: void Update(); @@ -53,8 +43,6 @@ private: graphics::Texture tex; glm::vec4 fg_color; glm::vec4 bg_color; - glm::vec3 pos; - Gravity origin; bool dirty; };