X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FMessageBox.hpp;h=2cfdec9c4da0be7722e5372aeed9da70c675c2ea;hb=refs%2Fheads%2Fmaster;hp=2191627b039aab23f9a8410521476991ca631d01;hpb=376fc1fca87fcdd22dabadf6d01d245ef8c3cedd;p=blank.git diff --git a/src/ui/MessageBox.hpp b/src/ui/MessageBox.hpp index 2191627..2cfdec9 100644 --- a/src/ui/MessageBox.hpp +++ b/src/ui/MessageBox.hpp @@ -3,10 +3,11 @@ #include "Text.hpp" #include "../graphics/align.hpp" +#include "../graphics/glm.hpp" +#include "../graphics/PrimitiveMesh.hpp" #include #include -#include 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 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; };