From 68dcd3c4e17355e1c2b640fe1382743d7cb61ea2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 28 Apr 2018 17:15:24 +0200 Subject: Use font pointer instead of copy to reduce memory usage, sfml ffs --- include/ResourceCache.hpp | 2 +- include/Text.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/ResourceCache.hpp b/include/ResourceCache.hpp index 7361862..de35500 100644 --- a/include/ResourceCache.hpp +++ b/include/ResourceCache.hpp @@ -17,7 +17,7 @@ namespace dchat { public: // Throws FailedToLoadResourceException on failure - static const sf::Font& getFont(const std::string &filepath); + static const sf::Font* getFont(const std::string &filepath); // Throws FailedToLoadResourceException on failure static sf::Texture* getTexture(const std::string &filepath); diff --git a/include/Text.hpp b/include/Text.hpp index 93ec0c1..4bb5ec0 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -13,8 +13,8 @@ namespace dchat class Text { public: - Text(const sf::Font &font); - Text(const sf::String &str, const sf::Font &font, unsigned int characterSize, float maxWidth, bool plainText = true); + Text(const sf::Font *font); + 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); @@ -52,7 +52,7 @@ namespace dchat }; sf::String str; - sf::Font font; + const sf::Font *font; unsigned int characterSize; sf::VertexArray vertices; float maxWidth; -- cgit v1.2.3