From 9cde35c64c9f569055b101a80419d900f58806a9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 3 May 2018 07:35:39 +0200 Subject: Adding theming, add new theme 'simple' --- include/MessageBoard.hpp | 6 ++++++ include/Text.hpp | 2 ++ include/Theme.hpp | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 include/Theme.hpp (limited to 'include') diff --git a/include/MessageBoard.hpp b/include/MessageBoard.hpp index e84396d..a4dc5a6 100644 --- a/include/MessageBoard.hpp +++ b/include/MessageBoard.hpp @@ -24,6 +24,9 @@ namespace dchat private: void updateStaticContentTexture(const sf::Vector2u &newSize); void addMessage(Message *message); + + void drawDefault(sf::RenderWindow &window, Cache &cache); + void drawSimple(sf::RenderWindow &window, Cache &cache); private: sf::RenderTexture staticContentTexture; bool dirty; @@ -37,5 +40,8 @@ namespace dchat sf::Clock frameTimer; double totalHeight; bool scrollToBottom; + sf::Vector2f backgroundSizeWithoutPadding; + sf::Vector2f backgroundSize; + sf::Vector2f backgroundPos; }; } diff --git a/include/Text.hpp b/include/Text.hpp index 4bb5ec0..016e852 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -24,6 +24,7 @@ namespace dchat void setMaxWidth(float maxWidth); void setCharacterSize(unsigned int characterSize); void setFillColor(sf::Color color); + void setLineSpacing(float lineSpacing); // Warning: won't update until @draw is called float getHeight() const; @@ -61,6 +62,7 @@ namespace dchat bool dirty; bool plainText; float totalHeight; + float lineSpacing; std::vector textElements; }; } diff --git a/include/Theme.hpp b/include/Theme.hpp new file mode 100644 index 0000000..19f3200 --- /dev/null +++ b/include/Theme.hpp @@ -0,0 +1,17 @@ +#pragma once + +namespace dchat +{ + class Theme + { + public: + enum class Type + { + DEFAULT, + SIMPLE + }; + + static Type getType(); + static void setType(Type type); + }; +} -- cgit v1.2.3