[gnome-games/wip/aplazas/gamepad-event: 10/11] gamepad: Drop usage of StandardGamepadButton in Vala
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/gamepad-event: 10/11] gamepad: Drop usage of StandardGamepadButton in Vala
- Date: Sat, 13 May 2017 10:20:58 +0000 (UTC)
commit a62c5b080dac1478f169759475e5e64e8d7db733
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat May 13 11:59:02 2017 +0200
gamepad: Drop usage of StandardGamepadButton in Vala
src/Makefile.am | 2 -
src/gamepad/gamepad.vapi | 2 +-
src/gamepad/standard-gamepad-button.vapi | 23 ---------------------
src/retro/retro-gamepad.vala | 32 +++++++++++++++---------------
4 files changed, 17 insertions(+), 42 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 25d0d49..e7d53d2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,6 @@ EXTRA_DIST = \
gamepad/gamepad-monitor.vapi \
gamepad/raw-gamepad.vapi \
gamepad/standard-gamepad-axis.vapi \
- gamepad/standard-gamepad-button.vapi \
$(NULL)
header_file = libgnome-games.h
@@ -198,7 +197,6 @@ gnome_games_VALAFLAGS = \
--pkg gamepad-monitor \
--pkg raw-gamepad \
--pkg standard-gamepad-axis \
- --pkg standard-gamepad-button \
--gresources $(gresource_file) \
--vapi $(vapi_file) \
--vapidir=event/ \
diff --git a/src/gamepad/gamepad.vapi b/src/gamepad/gamepad.vapi
index 21bcc0d..d2f6ff8 100644
--- a/src/gamepad/gamepad.vapi
+++ b/src/gamepad/gamepad.vapi
@@ -3,7 +3,7 @@
[CCode (cheader_filename = "gamepad.h")]
private class Games.Gamepad : GLib.Object {
public signal void event (Event event);
- public signal void button_event (StandardGamepadButton button, bool value);
+ public signal void button_event (uint16 button, bool value);
public signal void axis_event (StandardGamepadAxis axis, double value);
public signal void unplugged ();
public Gamepad (RawGamepad raw_gamepad) throws GLib.Error;
diff --git a/src/retro/retro-gamepad.vala b/src/retro/retro-gamepad.vala
index 97f87d3..647cca9 100644
--- a/src/retro/retro-gamepad.vala
+++ b/src/retro/retro-gamepad.vala
@@ -46,37 +46,37 @@ private class Games.RetroGamepad: Object, Retro.InputDevice {
public bool get_button_pressed (Retro.JoypadId button) {
switch (button) {
case Retro.JoypadId.B:
- return buttons[StandardGamepadButton.A];
+ return buttons[EventCode.BTN_A];
case Retro.JoypadId.Y:
- return buttons[StandardGamepadButton.X];
+ return buttons[EventCode.BTN_Y];
case Retro.JoypadId.SELECT:
- return buttons[StandardGamepadButton.SELECT];
+ return buttons[EventCode.BTN_SELECT];
case Retro.JoypadId.START:
- return buttons[StandardGamepadButton.START];
+ return buttons[EventCode.BTN_START];
case Retro.JoypadId.UP:
- return buttons[StandardGamepadButton.DPAD_UP];
+ return buttons[EventCode.BTN_DPAD_UP];
case Retro.JoypadId.DOWN:
- return buttons[StandardGamepadButton.DPAD_DOWN];
+ return buttons[EventCode.BTN_DPAD_DOWN];
case Retro.JoypadId.LEFT:
- return buttons[StandardGamepadButton.DPAD_LEFT];
+ return buttons[EventCode.BTN_DPAD_LEFT];
case Retro.JoypadId.RIGHT:
- return buttons[StandardGamepadButton.DPAD_RIGHT];
+ return buttons[EventCode.BTN_DPAD_RIGHT];
case Retro.JoypadId.A:
- return buttons[StandardGamepadButton.B];
+ return buttons[EventCode.BTN_B];
case Retro.JoypadId.X:
- return buttons[StandardGamepadButton.Y];
+ return buttons[EventCode.BTN_X];
case Retro.JoypadId.L:
- return buttons[StandardGamepadButton.SHOULDER_L];
+ return buttons[EventCode.BTN_TL];
case Retro.JoypadId.R:
- return buttons[StandardGamepadButton.SHOULDER_R];
+ return buttons[EventCode.BTN_TR];
case Retro.JoypadId.L2:
- return buttons[StandardGamepadButton.TRIGGER_L];
+ return buttons[EventCode.BTN_TL2];
case Retro.JoypadId.R2:
- return buttons[StandardGamepadButton.TRIGGER_R];
+ return buttons[EventCode.BTN_TR2];
case Retro.JoypadId.L3:
- return buttons[StandardGamepadButton.STICK_L];
+ return buttons[EventCode.BTN_THUMBL];
case Retro.JoypadId.R3:
- return buttons[StandardGamepadButton.STICK_R];
+ return buttons[EventCode.BTN_THUMBR];
default:
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]