#pragma once #include #include #include #include #include class ControllerManager { public: ControllerManager(int32_t screenWidth, int32_t screenHeight) : screenWidth(screenWidth), screenHeight(screenHeight){ } void attachController(GuiTrigger::eChannels channels, SDLController *controller); void prepare(); bool attachJoystick(int32_t deviceId); void detachJoystick(int32_t deviceId); void processEvent(SDL_JoystickID joystickId, int32_t channel, SDL_Event *event); void finish(); void callPerController(std::function func); private: GuiTrigger::eChannels increaseChannel(GuiTrigger::eChannels channel); std::map controllerList; std::map joystickToChannel; int32_t screenWidth; int32_t screenHeight; };