Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Rumble on SDL2 based gamepads #3

Open
wants to merge 1 commit into
base: duality/master
Choose a base branch
from

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants