[gnome-games] retro-gamepad: Support rumble
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] retro-gamepad: Support rumble
- Date: Sun, 19 Nov 2017 14:59:35 +0000 (UTC)
commit 96efe9d47aecad6e8760e6a326da4bf523860db3
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Nov 19 15:50:24 2017 +0100
retro-gamepad: Support rumble
Forward the rumble requests from the Libretro core to the gamepad.
src/retro/retro-gamepad.vala | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/retro/retro-gamepad.vala b/src/retro/retro-gamepad.vala
index 8791707..90fa2b6 100644
--- a/src/retro/retro-gamepad.vala
+++ b/src/retro/retro-gamepad.vala
@@ -6,6 +6,7 @@ private class Games.RetroGamepad: Object, Retro.Controller {
private bool[] buttons;
private int16[] axes;
+ private uint16 rumble_effect[2];
public RetroGamepad (Manette.Device device, bool present_analog_sticks) {
Object (device: device, present_analog_sticks: present_analog_sticks);
@@ -54,7 +55,16 @@ private class Games.RetroGamepad: Object, Retro.Controller {
}
public bool set_rumble_state (Retro.RumbleEffect effect, uint16 strength) {
- return false;
+ rumble_effect[effect] = strength;
+
+ if (!device.has_rumble ())
+ return false;
+
+ device.rumble (rumble_effect[Retro.RumbleEffect.STRONG],
+ rumble_effect[Retro.RumbleEffect.WEAK],
+ uint16.MAX);
+
+ return true;
}
private bool get_button_pressed (Retro.JoypadId button) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]