aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphics/Text.cpp10
-rw-r--r--src/window/Window.cpp5
2 files changed, 7 insertions, 8 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 {
diff --git a/src/window/Window.cpp b/src/window/Window.cpp
index 9e1fb75..580737d 100644
--- a/src/window/Window.cpp
+++ b/src/window/Window.cpp
@@ -33,10 +33,7 @@ namespace mgl {
bool Window::poll_event(Event &event) {
if(!window.window)
return false;
-
- /* TODO: Convert c_event to |event| */
- mgl_event c_event;
- return mgl_window_poll_event(&window, &c_event);
+ return mgl_window_poll_event(&window, (mgl_event*)&event);
}
void Window::clear(Color color) {