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