From c2d177ad974a7dd7fda89f70e2c30077deb68a96 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 3 Nov 2021 10:54:32 +0100 Subject: Use event structure in poll_event --- src/graphics/Text.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/graphics/Text.cpp') diff --git a/src/graphics/Text.cpp b/src/graphics/Text.cpp index dbaa7c1..b3a32da 100644 --- a/src/graphics/Text.cpp +++ b/src/graphics/Text.cpp @@ -7,18 +7,20 @@ extern "C" { namespace mgl { Text::Text() : font(nullptr) { - mgl_text_init(&text, nullptr, nullptr, 0.0f, 0.0f); + mgl_text_init(&text, nullptr, nullptr, 0, nullptr); } Text::Text(std::string str, Font &font) : Text(std::move(str), 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); + mgl_text_init(&text, font.internal_font(), this->str.c_str(), this->str.size(), nullptr); + mgl_text_set_position(&text, { position.x, position.y }); } Text::Text(const Text &other) { font = other.font; - mgl_text_init(&text, font ? font->internal_font() : nullptr, other.str.c_str(), other.text.position.x, other.text.position.y); + mgl_text_init(&text, font ? font->internal_font() : nullptr, other.str.c_str(), other.str.size(), nullptr); + mgl_text_set_position(&text, { other.text.position.x, other.text.position.y }); } Text::~Text() { @@ -44,7 +46,7 @@ namespace mgl { void Text::set_string(std::string str) { this->str = std::move(str); - mgl_text_set_string(&text, this->str.c_str()); + mgl_text_set_string(&text, this->str.c_str(), this->str.size()); } const std::string& Text::get_string() const { -- cgit v1.2.3