#pragma once #include #include #include #include #include namespace dchat { class Channel; class Chatbar { public: Chatbar(); void addChar(sf::Uint32 codePoint); const sf::String& getString() const; void removePreviousChar(); void removeNextChar(); void clear(); void moveCaretLeft(); void moveCaretRight(); bool isFocused() const; void processEvent(const sf::Event &event, Channel *channel); void draw(sf::RenderWindow &window, const sf::Vector2f &position); private: sf::Text text; sf::RectangleShape background; int caretIndex; sf::Vector2f caretOffset; sf::Clock blinkTimer; bool focused; }; }