diff options
Diffstat (limited to 'include/Chatbar.hpp')
-rw-r--r-- | include/Chatbar.hpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/Chatbar.hpp b/include/Chatbar.hpp new file mode 100644 index 0000000..143ebba --- /dev/null +++ b/include/Chatbar.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include <SFML/Graphics/Text.hpp> +#include <SFML/Graphics/RenderWindow.hpp> +#include <SFML/Graphics/RectangleShape.hpp> + +namespace dchat +{ + class Chatbar + { + public: + Chatbar(); + + void addChar(sf::Uint32 codePoint); + const sf::String& getString() const; + void removePreviousChar(); + void removeNextChar(); + void clear(); + + void moveCaretLeft(); + void moveCaretRight(); + + void draw(sf::RenderWindow &window); + private: + sf::Text text; + sf::RectangleShape background; + int caretIndex; + sf::Vector2f caretOffset; + }; +} |