openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
761 stars 375 forks source link

Add vibration support to Gamepad and Joystick APIs #869

Open jgranick opened 7 years ago

jgranick commented 7 years ago

From @alexandervrs on November 29, 2016 15:53

There should be a function to provide gamepad vibration capability to the platforms that is supported.

It should use any gamepad device based on its ID you provide, both left and right motors with normalized values from 0.0 (no vibration) to 1.0 (full vibration)

Windows & Xbox could be done via XInput (and DInput if you wish to also support legacy gamepads) WiiU, Playstation 3/4 controllers also have vibration capabilities.

Gamepad vibration adds so much feedback to a game that it'd be a shame to overlook it.

Copied from original issue: openfl/openfl#1360

jgranick commented 7 years ago

From @MSGhero on November 29, 2016 17:6

I think AIR can too, idr if it's through an ANE or if it's native functionality.

jgranick commented 7 years ago

From @alexandervrs on December 1, 2016 9:12

Yeah, I think it's an ANE that works on Windows, Android & iOS judging from here (http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html)

As a note, I am not sure about the device vibration that ANE maps the vibration to iOS/Android though. I'd categorize that in another API function since it affects the actual device and not a gamepad device (plus you could plug in USB gamepads on Android/iOS, which would complicate that more since the function would vibrate the device instead of the gamepad, unless you could redirect that somehow).

jgranick commented 7 years ago

SDL supports it, we would just need a Lime API for it

https://wiki.libsdl.org/CategoryForceFeedback