#pragma once #include "Text.hpp" #include #include #include #include #include #include #include #include namespace dchat { class Cache; class Room; class MessageBoard; class Chatbar { public: Chatbar(); bool isFocused() const; void processEvent(const sf::Event &event, Cache *cache, std::shared_ptr room, MessageBoard *messageBoard); void draw(sf::RenderWindow &window, Cache *cache); static sf::Vector2f getInputPosition(sf::RenderWindow &window); static sf::Vector2f getInputSize(sf::RenderWindow &window); static float getHeight(); static bool addBind(const std::string &key, const std::string &value, bool updateFile = true); static bool removeBind(const std::string &key, bool updateFile = true); static void loadBindsFromFile(); static const std::unordered_map& getBinds(); private: void processChatCommand(const StringView &cmd); private: Text text; sf::RectangleShape background; sf::RectangleShape inputBackground; bool focused; }; }