Add settings page labels

This commit is contained in:
dec05eba
2024-08-02 20:24:16 +02:00
parent 93da082d32
commit 7c4af06d95
4 changed files with 171 additions and 14 deletions

21
src/gui/Label.cpp Normal file
View File

@@ -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;
}
}