diff options
Diffstat (limited to 'include/Text.hpp')
-rw-r--r-- | include/Text.hpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/include/Text.hpp b/include/Text.hpp index 016e852..daea7ca 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -10,6 +10,24 @@ namespace dchat { + struct TextElement + { + enum class Type + { + TEXT, + EMOJI, + URL + }; + + TextElement() {} + TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type), ownLine(false) {} + + StringViewUtf32 text; + sf::Vector2f position; + Type type; + bool ownLine; // Currently only used for emoji, to make emoji bigger when it's the only thing on a line + }; + class Text { public: @@ -34,24 +52,7 @@ namespace dchat private: void stringSplitElements(sf::String &stringToSplit, usize startIndex); void updateGeometry(); - private: - struct TextElement - { - enum class Type - { - TEXT, - EMOJI - }; - - TextElement() {} - TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type), ownLine(false) {} - - StringViewUtf32 text; - sf::Vector2f position; - Type type; - bool ownLine; // Currently only used for emoji, to make emoji bigger when it's the only thing on a line - }; - + private: sf::String str; const sf::Font *font; unsigned int characterSize; @@ -59,6 +60,7 @@ namespace dchat float maxWidth; sf::Vector2f position; sf::Color color; + sf::Color urlColor; bool dirty; bool plainText; float totalHeight; |