#ifndef HOLESOME_INPUT_MAPPER_H #define HOLESOME_INPUT_MAPPER_H #include "../game.h" #include #include "../../config.h" #include "direction.h" #include "input_identity.h" class Game; /** * Maps the inputs to actions. */ class InputMapper { public: static void setGame(Game *game); static void processEvents(); static std::shared_ptr getInputIdentity(InputDeviceType deviceType, unsigned int gamepadId = 0); private: static inline Game *game = nullptr; static std::shared_ptr allIdentity; static std::shared_ptr keyboardIdentity; static std::map> gamepadIdentities; static inline std::vector inputDirectionBuffer = std::vector(); static void handleKeyPress(sf::Event::KeyEvent event); static void handleKeyRelease(sf::Event::KeyEvent event); static void handleJoystickMovement(sf::Event::JoystickMoveEvent event); }; #endif //HOLESOME_INPUT_MAPPER_H