Commit 30104a2f authored by Adrien Plazas's avatar Adrien Plazas
Browse files

gamepad: Drop usage of StandardGamepadAxis in Vala

https://bugzilla.gnome.org/show_bug.cgi?id=782611
parent 03b5f73d
......@@ -28,7 +28,6 @@ EXTRA_DIST = \
gamepad/gamepad.vapi \
gamepad/gamepad-monitor.vapi \
gamepad/raw-gamepad.vapi \
gamepad/standard-gamepad-axis.vapi \
$(NULL)
header_file = libgnome-games.h
......@@ -196,7 +195,6 @@ gnome_games_VALAFLAGS = \
--pkg gamepad \
--pkg gamepad-monitor \
--pkg raw-gamepad \
--pkg standard-gamepad-axis \
--gresources $(gresource_file) \
--vapi $(vapi_file) \
--vapidir=event/ \
......
......@@ -295,7 +295,7 @@ static void games_gamepad_class_init (GamesGamepadClass *klass) {
0, NULL, NULL,
NULL,
G_TYPE_NONE, 2,
GAMES_TYPE_STANDARD_GAMEPAD_BUTTON,
G_TYPE_UINT,
G_TYPE_BOOLEAN);
/**
......@@ -312,7 +312,7 @@ static void games_gamepad_class_init (GamesGamepadClass *klass) {
0, NULL, NULL,
NULL,
G_TYPE_NONE, 2,
GAMES_TYPE_STANDARD_GAMEPAD_AXIS,
G_TYPE_UINT,
G_TYPE_DOUBLE);
/**
......
......@@ -3,8 +3,8 @@
[CCode (cheader_filename = "gamepad.h")]
private class Games.Gamepad : GLib.Object {
public signal void event (Event event);
public signal void button_event (uint16 button, bool value);
public signal void axis_event (StandardGamepadAxis axis, double value);
public signal void button_event (uint button, bool value);
public signal void axis_event (uint 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-axis.h")]
private enum Games.StandardGamepadAxis {
UNKNOWN,
LEFT_X,
LEFT_Y,
RIGHT_X,
RIGHT_Y,
}
......@@ -87,18 +87,18 @@ private class Games.RetroGamepad: Object, Retro.InputDevice {
case Retro.AnalogIndex.LEFT:
switch (id) {
case Retro.AnalogId.X:
return axes[StandardGamepadAxis.LEFT_X];
return axes[EventCode.ABS_X];
case Retro.AnalogId.Y:
return axes[StandardGamepadAxis.LEFT_Y];
return axes[EventCode.ABS_Y];
default:
return 0;
}
case Retro.AnalogIndex.RIGHT:
switch (id) {
case Retro.AnalogId.X:
return axes[StandardGamepadAxis.RIGHT_X];
return axes[EventCode.ABS_RX];
case Retro.AnalogId.Y:
return axes[StandardGamepadAxis.RIGHT_Y];
return axes[EventCode.ABS_RY];
default:
return 0;
}
......
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