]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/FixedText.hpp
simple (text) progress display for preloader
[blank.git] / src / ui / FixedText.hpp
diff --git a/src/ui/FixedText.hpp b/src/ui/FixedText.hpp
new file mode 100644 (file)
index 0000000..dbe1217
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef BLANK_UI_FIXEDTEXT_HPP_
+#define BLANK_UI_FIXEDTEXT_HPP_
+
+#include "Text.hpp"
+
+
+namespace blank {
+
+class FixedText
+: public Text {
+
+public:
+       FixedText() noexcept;
+
+       void Position(const glm::vec3 &p) noexcept {
+               pos = p;
+       }
+       void Position(
+               const glm::vec3 &p,
+               Gravity g
+       ) noexcept {
+               pos = p;
+               grav = g;
+               Pivot(g);
+       }
+       void Position(
+               const glm::vec3 &p,
+               Gravity g,
+               Gravity pv
+       ) noexcept {
+               pos = p;
+               grav = g;
+               Pivot(pv);
+       }
+
+       void Foreground(const glm::vec4 &col) noexcept { fg = col; }
+       void Background(const glm::vec4 &col) noexcept { bg = col; }
+
+       void Show() noexcept { visible = true; }
+       void Hide() noexcept { visible = false; }
+       void Toggle() noexcept { visible = !visible; }
+       bool Visible() const noexcept { return visible; }
+
+       void Render(Viewport &) noexcept;
+
+private:
+       glm::vec4 bg;
+       glm::vec4 fg;
+       glm::vec3 pos;
+       Gravity grav;
+       bool visible;
+
+};
+
+}
+
+#endif