aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/Text.cpp10
1 files changed, 6 insertions, 4 deletions
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 {