aboutsummaryrefslogtreecommitdiff
path: root/src/gui/Label.cpp
blob: 08f720bb36f803698f32745427f651a788d7e73c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
    }
}