From 7c4af06d953ad439906f85ec996ad00dd38d2302 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Aug 2024 20:24:16 +0200 Subject: Add settings page labels --- src/gui/Label.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/gui/Label.cpp (limited to 'src/gui') 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 + +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 -- cgit v1.2.3