]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/MessageBox.hpp
simple (text) progress display for preloader
[blank.git] / src / ui / MessageBox.hpp
diff --git a/src/ui/MessageBox.hpp b/src/ui/MessageBox.hpp
new file mode 100644 (file)
index 0000000..2191627
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef BLANK_UI_MESSAGEBOX_HPP_
+#define BLANK_UI_MESSAGEBOX_HPP_
+
+#include "Text.hpp"
+#include "../graphics/align.hpp"
+
+#include <deque>
+#include <string>
+#include <glm/glm.hpp>
+
+
+namespace blank {
+
+class Font;
+class Viewport;
+
+class MessageBox {
+
+public:
+       explicit MessageBox(const Font &);
+
+       void Position(const glm::vec3 &, Gravity) noexcept;
+
+       void Foreground(const glm::vec4 &col) noexcept { fg = col; }
+       void Background(const glm::vec4 &col) noexcept { bg = col; }
+
+       void PushLine(const char *);
+       void PushLine(const std::string &l) {
+               PushLine(l.c_str());
+       }
+
+       void Render(Viewport &) noexcept;
+
+private:
+       const Font &font;
+       std::deque<Text> lines;
+       std::size_t max_lines;
+
+       glm::vec3 pos;
+       glm::vec3 adv;
+
+       glm::vec4 bg;
+       glm::vec4 fg;
+
+       Gravity grav;
+
+};
+
+}
+
+#endif