/** * @author: Thomas Brandého */ #ifndef INPUT_H #define INPUT_H #include "keybindings.h" #include #include #include class Input{ public: /* Constructors */ Input(sf::Window* w, std::string keysmappings, int nb_actions); // enum SpecialAction {} /* general action-mapping functions */ void updateEvents(); int getAction(); int getKeyBinding(int action, int num); void setkeyBinding(int action, int num, sf::Keyboard::Key key); void setTypeAction(int action, int type); /* context-related functions */ void createContext(std::string context_name, std::vector action_list); void setCurrentContext(std::string context_name); void reloadKeyBindings(); /* window-related function */ bool isCloseRequested(); /* keyboard-related functions */ bool isKeyPressed(int key); /* mouse-related function */ sf::Vector2i getPosition(); sf::Vector2i getDeltaPosition(); int getDeltaVerticalScroll(); void test(); private: /* window-related variables */ sf::Window* window; bool closeRequested; /* general action-mapping variables */ KeysMap keysmap; std::queue action_file; int nb_actions; /* context-related variables */ std::string current_context; std::unordered_map> contexts; std::unordered_map keybindings; /* keyboard-related variables */ std::vector heldkeys; void releaseHeldKeys(sf::Keyboard::Key keycode); /* mouse-related variables */ sf::Vector2i mouse_position; int delta_vertical_scroll; }; #endif //INPUT_H