SDLControllerInterface: Use SDL_GameControllerRumble where supported

Allows vibration on DualShock 4 without using DS4Windows.
This commit is contained in:
Connor McLaughlin
2020-12-31 19:38:28 +10:00
parent bea6f0beb4
commit 3ffbbe82e8
3 changed files with 58 additions and 30 deletions

View File

@ -46,10 +46,11 @@ private:
struct ControllerData
{
void* haptic;
void* game_controller;
int haptic_left_right_effect;
int joystick_id;
int player_id;
bool is_game_controller;
bool use_game_controller_rumble;
float deadzone = 0.25f;
@ -60,6 +61,8 @@ private:
std::array<std::array<ButtonCallback, 2>, MAX_NUM_AXISES> axis_button_mapping;
std::array<AxisCallback, MAX_NUM_BUTTONS> button_axis_mapping;
std::vector<std::array<ButtonCallback, 4>> hat_button_mapping;
ALWAYS_INLINE bool IsGameController() const { return (game_controller != nullptr); }
};
using ControllerDataVector = std::vector<ControllerData>;