diff options
Diffstat (limited to 'include/Text.hpp')
-rw-r--r-- | include/Text.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/Text.hpp b/include/Text.hpp index 53db93b..93ec0c1 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -17,6 +17,8 @@ namespace dchat Text(const sf::String &str, const sf::Font &font, unsigned int characterSize, float maxWidth, bool plainText = true); void setString(const sf::String &str); + void appendStringNewLine(const sf::String &str); + void setPosition(float x, float y); void setPosition(const sf::Vector2f &position); void setMaxWidth(float maxWidth); @@ -26,9 +28,10 @@ namespace dchat // Warning: won't update until @draw is called float getHeight() const; + // Performs culling. @updateGeometry is called even if text is not visible if text is dirty, because updateGeometry might change the dimension of the text and make is visible void draw(sf::RenderTarget &target, Cache &cache); private: - void stringSplitElements(); + void stringSplitElements(sf::String &stringToSplit, usize startIndex); void updateGeometry(); private: struct TextElement @@ -40,11 +43,12 @@ namespace dchat }; TextElement() {} - TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type) {} + 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 }; sf::String str; |