aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/Text.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-03 10:54:32 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-03 10:54:32 +0100
commitc2d177ad974a7dd7fda89f70e2c30077deb68a96 (patch)
tree33ae548c9000ab98673cd342f1a7fa021a3b6288 /src/graphics/Text.cpp
parent8d525bc1c3506f15a5f68672245f845cebe18eef (diff)
Use event structure in poll_event
Diffstat (limited to 'src/graphics/Text.cpp')
-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 {