#pragma once #include "onepad.h" #include "controller.h" #ifdef SDL_BUILD #include #endif class GamePad { public: GamePad() : m_deadzone(1500) { } virtual ~GamePad() { return; } GamePad(const GamePad &); // copy constructor GamePad &operator=(const GamePad &); // assignment /* * Find every interesting devices and create right structure for them(depend on backend) */ static void EnumerateGamePads(std::vector> &vgamePad); /* * Update state of every attached devices */ virtual void UpdateGamePadState() = 0; /* * Causes devices to rumble * Rumble will differ according to type which is either 0(small motor) or 1(big motor) */ virtual void Rumble(unsigned type, unsigned pad) { return; } /* * Safely dispatch to the Rumble method above */ static void DoRumble(unsigned type, unsigned pad); /* * Used for GUI checkbox to give feedback to the user */ virtual bool TestForce(float strength = 0.6) { return false; } virtual const char *GetName() = 0; virtual int GetInput(gamePadValues input) = 0; virtual int GetDeadzone() { return m_deadzone; } protected: int m_deadzone; }; extern std::vector> s_vgamePad; extern bool GamePadIdWithinBounds(int joyid);