wgois / OIS

Official OIS repository. Object oriented Input System
https://wgois.github.io/OIS/
zlib License
257 stars 86 forks source link

Gamepad Rumble? #79

Closed Socke81 closed 2 years ago

Socke81 commented 2 years ago

This framework supports force feedback but as it looks no rumble with XInput devices. In the code it looks like the FF part is skipped when an XInput device is detected. But there seems to be Rumble for the WII Mote? I think a gamepad lib must have rumble functions. Could this be implemented? I would like to replace SDL2 in my app with OIS.

Lwmte commented 2 years ago

I have made a pull request (#83) which adds XInput vibration support. Since XInput vibration interface is way more simple than DInput one (based on which OIS force feedback functionality was created), it only works with simple constant force effect.

When one makes an app which potentially targets both DInput and XInput controls, one must mind that only constant force effect will work for both types. Only thing which is customizable for XInput controllers is left/right motor speed, which I implemented via effect direction parameter in OIS Effect class.

In future, maybe OIS can implement built-in system which will "convert" XInput vibration to complex DInput-like FF effects, but for that we may need a separate thread which will run effect update code. This is a task for future and requires more serious planning.