diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-04-28 17:15:24 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-04-28 17:15:30 +0200 |
commit | 68dcd3c4e17355e1c2b640fe1382743d7cb61ea2 (patch) | |
tree | fdf108e1d9f8478e34c4336dbaf21715c3b6f61f /include | |
parent | 9d84d5d8e7f61a02c01eef021ea5e8b2f49dcf8f (diff) |
Use font pointer instead of copy to reduce memory usage, sfml ffs
Diffstat (limited to 'include')
-rw-r--r-- | include/ResourceCache.hpp | 2 | ||||
-rw-r--r-- | include/Text.hpp | 6 |
2 files changed, 4 insertions, 4 deletions
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; |