#pragma once #ifndef ES_CORE_INPUT_MANAGER_H #define ES_CORE_INPUT_MANAGER_H #include #include class InputConfig; class Window; union SDL_Event; //you should only ever instantiate one of these, by the way class InputManager { private: InputManager(); static InputManager* mInstance; static const int DEADZONE = 23000; void loadDefaultKBConfig(); std::map mJoysticks; std::map mInputConfigs; InputConfig* mKeyboardInputConfig; InputConfig* mCECInputConfig; std::map mPrevAxisValues; bool initialized() const; void addJoystickByDeviceIndex(int id); void removeJoystickByJoystickID(SDL_JoystickID id); bool loadInputConfig(InputConfig* config); // returns true if successfully loaded, false if not (or didn't exist) public: virtual ~InputManager(); static InputManager* getInstance(); void writeDeviceConfig(InputConfig* config); void doOnFinish(); static std::string getConfigPath(); static std::string getTemporaryConfigPath(); void init(); void deinit(); int getNumJoysticks(); int getButtonCountByDevice(int deviceId); int getNumConfiguredDevices(); std::string getDeviceGUIDString(int deviceId); InputConfig* getInputConfigByDevice(int deviceId); bool parseEvent(const SDL_Event& ev, Window* window); }; #endif // ES_CORE_INPUT_MANAGER_H