]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/MessageBox.hpp
uniform background for message box
[blank.git] / src / ui / MessageBox.hpp
index 2191627b039aab23f9a8410521476991ca631d01..b5a82c8b0a7b21f65be52587ee42b0c81dbd30e3 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "Text.hpp"
 #include "../graphics/align.hpp"
+#include "../graphics/PrimitiveMesh.hpp"
 
 #include <deque>
 #include <string>
@@ -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;
 
        glm::vec4 bg;
        glm::vec4 fg;
 
+       PrimitiveMesh bg_mesh;
+
        Gravity grav;
+       bool dirty;
 
 };