From 01e3403abf86050e4096ecf60466de4139ac78e2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 7 Nov 2021 08:25:36 +0100 Subject: Fix text rendering getting corrupt at copy/move constructor --- include/mglpp/graphics/Text.hpp | 3 +++ include/mglpp/window/Event.hpp | 2 ++ 2 files changed, 5 insertions(+) (limited to 'include') diff --git a/include/mglpp/graphics/Text.hpp b/include/mglpp/graphics/Text.hpp index 6166087..648ecac 100644 --- a/include/mglpp/graphics/Text.hpp +++ b/include/mglpp/graphics/Text.hpp @@ -17,6 +17,8 @@ namespace mgl { Text(std::string str, Font &font); Text(std::string str, vec2f position, Font &font); Text(const Text &other); + Text& operator=(const Text &other); + Text(Text &&other); ~Text(); void set_position(vec2f position) override; @@ -26,6 +28,7 @@ namespace mgl { FloatRect get_bounds() const; void set_string(std::string str); const std::string& get_string() const; + void append_string(const std::string &str); // Returns the visual position of a character from its index. // If the index is out of range, then the position of the end of the string is returned. diff --git a/include/mglpp/window/Event.hpp b/include/mglpp/window/Event.hpp index 5b7da45..5b9e357 100644 --- a/include/mglpp/window/Event.hpp +++ b/include/mglpp/window/Event.hpp @@ -17,6 +17,8 @@ namespace mgl { struct TextEvent { uint32_t codepoint; + int size; + char str[5]; /* utf8, null terminated */ }; struct KeyEvent { -- cgit v1.2.3