X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=inline;f=src%2Fui%2FMessageBox.hpp;fp=src%2Fui%2FMessageBox.hpp;h=2191627b039aab23f9a8410521476991ca631d01;hb=376fc1fca87fcdd22dabadf6d01d245ef8c3cedd;hp=0000000000000000000000000000000000000000;hpb=22b25d4b9cc24e249bc8007757267cea00ab18d3;p=blank.git diff --git a/src/ui/MessageBox.hpp b/src/ui/MessageBox.hpp new file mode 100644 index 0000000..2191627 --- /dev/null +++ b/src/ui/MessageBox.hpp @@ -0,0 +1,51 @@ +#ifndef BLANK_UI_MESSAGEBOX_HPP_ +#define BLANK_UI_MESSAGEBOX_HPP_ + +#include "Text.hpp" +#include "../graphics/align.hpp" + +#include +#include +#include + + +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 lines; + std::size_t max_lines; + + glm::vec3 pos; + glm::vec3 adv; + + glm::vec4 bg; + glm::vec4 fg; + + Gravity grav; + +}; + +} + +#endif