aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-02 20:24:16 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-02 20:24:16 +0200
commit7c4af06d953ad439906f85ec996ad00dd38d2302 (patch)
tree3f516be003e189ac807080aaa4af891771aedd19 /src/gui
parent93da082d32ce3a4892fcd88f460ceab9186fa1ef (diff)
Add settings page labels
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Label.cpp21
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