diff options
Diffstat (limited to 'include/Text.hpp')
-rw-r--r-- | include/Text.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/include/Text.hpp b/include/Text.hpp index 24ea02a..86814a3 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -1,17 +1,18 @@ #pragma once -#include "StringView.hpp" -#include "Cache.hpp" #include <SFML/Graphics/VertexArray.hpp> #include <SFML/Graphics/Font.hpp> #include <SFML/Graphics/RenderTarget.hpp> #include <SFML/Window/Event.hpp> #include <SFML/System/String.hpp> #include <SFML/System/Clock.hpp> +#include <dchat/StringView.hpp> #include <vector> namespace dchat { + class Cache; + struct TextElement { enum class Type @@ -59,13 +60,13 @@ namespace dchat // Warning: won't update until @draw is called float getHeight() const; - void processEvent(const sf::Event &event, Cache &cache); + void processEvent(const sf::Event &event, Cache *cache); // 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. // Returns true if text was drawn on screen (if text is within window borders) - bool draw(sf::RenderTarget &target, Cache &cache); + bool draw(sf::RenderTarget &target, Cache *cache); private: - void onMouseClick(const sf::Event::MouseButtonEvent &event, Cache &cache); + void onMouseClick(const sf::Event::MouseButtonEvent &event, Cache *cache); private: enum class CaretMoveDirection : u8 { @@ -110,5 +111,6 @@ namespace dchat int caretIndex; sf::Vector2f caretPosition; sf::Clock lastSeenTimer; + sf::Vector2u renderTargetSize; }; } |