From 8765ee0f90be145ad73a6a912c8df6ebb16dd963 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 18 Nov 2021 06:20:56 +0100 Subject: Fix corrupt reactions in matrix (use of deleted vertex buffer) --- src/Text.cpp | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text.cpp b/src/Text.cpp index 18a87f4..39e5bc4 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -21,6 +21,26 @@ namespace QuickMedia static const size_t FONT_INDEX_SYMBOLS = 2; static const size_t FONT_INDEX_EMOJI = 3; static const size_t FONT_ARRAY_SIZE = 4; + + Text::Text() : + bold_font(false), + characterSize(12), + maxWidth(0.0f), + color(get_theme().text_color), + dirty(true), + dirtyText(true), + dirtyCaret(true), + editable(false), + highlight_urls(false), + caretMoveDirection(CaretMoveDirection::NONE), + num_lines(1), + lineSpacing(0.0f), + characterSpacing(0.0f), + caretIndex(0), + caret_offset_x(0.0f) + { + + } Text::Text(std::string _str, bool bold_font, unsigned int characterSize, float maxWidth, bool highlight_urls) : bold_font(bold_font), @@ -28,8 +48,8 @@ namespace QuickMedia maxWidth(maxWidth), color(get_theme().text_color), dirty(true), - dirtyText(false), - dirtyCaret(false), + dirtyText(true), + dirtyCaret(true), editable(false), highlight_urls(highlight_urls), caretMoveDirection(CaretMoveDirection::NONE), @@ -41,6 +61,21 @@ namespace QuickMedia { setString(std::move(_str)); } + + Text::Text(const Text &other) : Text(other.str, other.bold_font, other.characterSize, other.maxWidth, other.highlight_urls) { + + } + + Text& Text::operator=(const Text &other) { + str = other.str; + bold_font = other.bold_font; + characterSize = other.characterSize; + maxWidth = other.maxWidth; + highlight_urls = other.highlight_urls; + caretIndex = other.caretIndex; + position = other.position; + return *this; + } void Text::setString(std::string str) { -- cgit v1.2.3