diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Label.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/Label.cpp b/src/gui/Label.cpp new file mode 100644 index 0000000..08f720b --- /dev/null +++ b/src/gui/Label.cpp @@ -0,0 +1,21 @@ +#include "../../include/gui/Label.hpp" +#include <mglpp/window/Window.hpp> + +namespace gsr { + Label::Label(mgl::Font *font, const char *text, mgl::Color color) : text(text, *font) { + this->text.set_color(color); + } + + bool Label::on_event(mgl::Event&, mgl::Window&, mgl::vec2f) { + return true; + } + + void Label::draw(mgl::Window &window, mgl::vec2f offset) { + text.set_position((position + offset).floor()); + window.draw(text); + } + + mgl::vec2f Label::get_size() { + return text.get_bounds().size; + } +}
\ No newline at end of file |