#include "../../include/mglpp/graphics/Text.hpp" #include "../../include/mglpp/graphics/Font.hpp" extern "C" { #include } namespace mgl { Text::Text(std::string str, Font &font) : Text(std::move(str), mgl::vec2f(0.0f, 0.0f), font){} Text::Text(std::string str, vec2f position, Font &font) : font(font), str(std::move(str)) { mgl_text_init(&text, font.internal_font(), this->str.c_str(), position.x, position.y); } Text::~Text() { mgl_text_deinit(&text); } void Text::set_position(vec2f position) { mgl_text_set_position(&text, {position.x, position.y}); } void Text::set_color(Color color) { mgl_text_set_color(&text, {color.r, color.g, color.b, color.a}); } vec2f Text::get_position() const { return { text.position.x, text.position.y }; } void Text::draw(Window&) { mgl_text_draw(mgl_get_context(), &text); } }