Commit 03b5f73d authored by Adrien Plazas's avatar Adrien Plazas
Browse files

gamepad: Drop usage of StandardGamepadButton in Vala

https://bugzilla.gnome.org/show_bug.cgi?id=782611
parent 8af72d70
......@@ -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/ \
......
......@@ -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;
......
// This file is part of GNOME Games. License: GPL-3.0+.
[CCode (cheader_filename = "standard-gamepad-button.h")]
private enum Games.StandardGamepadButton {
UNKNOWN,
A,
B,
X,
Y,
SHOULDER_L,
SHOULDER_R,
TRIGGER_L,
TRIGGER_R,
SELECT,
START,
STICK_L,
STICK_R,
DPAD_UP,
DPAD_DOWN,
DPAD_LEFT,
DPAD_RIGHT,
HOME,
}
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment