add rumble conffirmation on selection

This commit is contained in:
e7d 2020-11-26 14:26:19 +01:00
parent d4dabd9fee
commit 681d2985d6
No known key found for this signature in database
GPG Key ID: F320BE007C0B8881

View File

@ -399,6 +399,20 @@ class Gamepad {
// if one of its button is pressed, activate this gamepad // if one of its button is pressed, activate this gamepad
if (button.pressed) { if (button.pressed) {
this.map(gamepad.index); this.map(gamepad.index);
// confirm mapping with a vibration when available
if (gamepad.vibrationActuator) {
gamepad.vibrationActuator.playEffect(
gamepad.vibrationActuator.type,
{
duration: 100,
strongMagnitude: 0.2,
weakMagnitude: 1,
startDelay: 0,
}
);
}
return; return;
} }
} }