diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-04-20 04:25:14 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-04-20 04:25:41 +0200 |
commit | de059e317e43fa1b94d77fd981be68b86bf6de6e (patch) | |
tree | aade82ecfb2dab7441de122d72485a4c71b29be0 /include/Chatbar.hpp | |
parent | 391f7fd6d832cb40f74fb37f9e0af7ff33db202f (diff) |
Add chatbar. No mouse editing but keyboard editing is supported
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; + }; +} |