/** * @author: Thomas Brandého */ #ifndef INPUT_H #define INPUT_H #include "keybindings.h" #include #include #include #include "textbuffer.h" class Input{ public: /* Constructors */ Input(sf::Window *w); /* general action-mapping functions */ void setKeysMap(IKeysMap km); void updateEvents(); int getAction(); /* context-related functions */ void addContext(Context context); void setCurrentContext(std::string context_name); void updateKeyBindings(); /* window-related function */ bool isCloseRequested() const; /* keyboard-related functions */ bool isKeyPressed(int key) const; /* mouse-related function */ sf::Vector2i getPosition() const; sf::Vector2i getDeltaPosition() const; float getDeltaVerticalScroll() const; /* text-related function */ std::string getText(); void test(); private: /* window-related variables */ sf::Window* window; bool closeRequested; /* general action-mapping variables */ IKeysMap keysmap; std::queue action_file; int nb_actions; /* context-related variables */ std::string current_context; //std::unordered_map> contexts; std::vector contexts; std::unordered_map keybindings; /* keyboard-related variables */ std::vector heldkeys; void releaseHeldKeys(sf::Keyboard::Key keycode); /* mouse-related variables */ sf::Vector2i mouse_position; sf::Vector2i last_mouse_position; float delta_vertical_scroll; /* text-related variable */ std::string buffer; }; #endif //INPUT_H