]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/MessageBox.hpp
test sdl event to string functions
[blank.git] / src / ui / MessageBox.hpp
index 2191627b039aab23f9a8410521476991ca631d01..2cfdec9c4da0be7722e5372aeed9da70c675c2ea 100644 (file)
@@ -3,10 +3,11 @@
 
 #include "Text.hpp"
 #include "../graphics/align.hpp"
+#include "../graphics/glm.hpp"
+#include "../graphics/PrimitiveMesh.hpp"
 
 #include <deque>
 #include <string>
-#include <glm/glm.hpp>
 
 
 namespace blank {
@@ -22,7 +23,7 @@ public:
        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 Background(const glm::vec4 &col) noexcept { bg = col; dirty = true; }
 
        void PushLine(const char *);
        void PushLine(const std::string &l) {
@@ -31,6 +32,9 @@ public:
 
        void Render(Viewport &) noexcept;
 
+private:
+       void Recalc();
+
 private:
        const Font &font;
        std::deque<Text> lines;
@@ -38,11 +42,15 @@ private:
 
        glm::vec3 pos;
        glm::vec3 adv;
+       glm::vec2 size;
+
+       PrimitiveMesh::Color bg;
+       PrimitiveMesh::Color fg;
 
-       glm::vec4 bg;
-       glm::vec4 fg;
+       PrimitiveMesh bg_mesh;
 
        Gravity grav;
+       bool dirty;
 
 };