Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Conversation

@heraldofgargos
Copy link

Hey there 👋

This PR adds controller vibration support for XInput, DualShock and Nintendo Switch Pro controllers when using the SDL2 backend. It adds SetVibration to the IJoystickDriver2 Interface which is implemented in Sdl2JoystickDriver. Method stubs for other classes that derive from IJoystickDriver2 are also added but they just return false for now.

SDL version 2.0.9 or higher is required for it to work!

- Add SetVibration method to IJoystickDriver2 Interface
- Implement SetVibration in Sdl2JoystickDriver.cs
- Add method stubs for other sub classes that derive from
IJoystickDriver2
@heraldofgargos
Copy link
Author

Hey there. I noticed a small issue when there are two or more controllers connected at the same time. Also for some strange reason the trigger values default to 0.5 when starting an app. But they seem to return to their correct value after an axis change event is received. It's most likely an issue with the SDL2 implementation of OpenTK. I'll have a closer look later. Marking this as WIP for now.

@ilexp
Copy link
Member

ilexp commented Jul 21, 2019

Also for some strange reason the trigger values default to 0.5 when starting an app. But they seem to return to their correct value after an axis change event is received. It's most likely an issue with the SDL2 implementation of OpenTK.

This is a known issue in the SDL2 backend and probably unrelated to your addition - my suggestion would be to ignore this here and potentially submit a second PR later on, if you look into this.

I noticed a small issue when there are two or more controllers connected at the same time.

Got it - let me know when you're out of WiP state and ready for review 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants