17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust
MIT License
909 stars 63 forks source link

Switch to SDL_GameControllerRumble for gamepad rumble #287

Closed 17cupsofcoffee closed 2 years ago

17cupsofcoffee commented 2 years ago

Summary

The gamepad API currently uses the SDL2 haptics API for controller rumble effects.

Since SDL 2.0.9, there's been a simpler SDL_GameControllerRumble API that is less buggy and works with a wider array of controllers. However, I originally ran into linking issues when I tried to migrate to this, so I rolled it back.

However, further investigation has shown that the linking issues are Windows-specific and only apply to old versions of SDL2, so I'm more confident in making this change now.

Motivation/Examples

My only controller is a DualShock 4, and last time I checked I had to use DS4Windows (a third-party XInput driver) to make rumble work with it. I believe when I tested out SDL_GameControllerRumble, I was able to get rumble working 'out of the box'.

Alternatives Considered

We could leave things as they are.