[gnome-games] gamepad: Add RawGamepad interface
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gamepad: Add RawGamepad interface
- Date: Mon, 18 Jul 2016 18:52:30 +0000 (UTC)
commit c4b16f875d358dcc828810cee14249a60c0dd0e7
Author: Megh Parikh <meghprkh gmail com>
Date: Mon Jul 18 20:00:08 2016 +0530
gamepad: Add RawGamepad interface
This is the interface that is implemented by a driver and represents an
unmapped gamepad device.
This is the first in a series of commits to add gamepad support.
src/Makefile.am | 2 ++
src/gamepad/raw-gamepad.vala | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index f0c2b82..536e64e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,6 +53,8 @@ gnome_games_SOURCES = \
dummy/dummy-icon.vala \
dummy/dummy-runner.vala \
\
+ gamepad/raw-gamepad.vala \
+ \
grilo/grilo-cover.vala \
grilo/grilo-media.vala \
\
diff --git a/src/gamepad/raw-gamepad.vala b/src/gamepad/raw-gamepad.vala
new file mode 100644
index 0000000..4a1f24c
--- /dev/null
+++ b/src/gamepad/raw-gamepad.vala
@@ -0,0 +1,39 @@
+// This file is part of GNOME Games. License: GPLv3
+
+/**
+ * This is one of the interfaces that needs to be implemented by the driver.
+ *
+ * This interface represents a gamepad and deals with handling events that are
+ * emitted by a gamepad and also provide properties like name and guid along
+ * with number of buttons, axes and dpads.
+ */
+private interface Games.RawGamepad : Object {
+ /**
+ * Emitted when a button is pressed/released
+ * @param code The button code from 0 to buttons_number
+ * @param value True if pressed, False if released
+ */
+ public abstract signal void button_event (int code, bool value);
+
+ /**
+ * Emitted when an axis's value changes
+ * @param axis The axis number from 0 to axes_number
+ * @param value The value of the axis ranging from -1 to 1
+ */
+ public abstract signal void axis_event (int axis, double value);
+
+ /**
+ * Emitted when a dpad's axis's value changes
+ * @param dpad The dpad number from 0 to
+ * @param axis The axis: 0 for X, 1 for Y
+ * @param value The value of the axis ranging from -1 to 1
+ */
+ public abstract signal void dpad_event (int dpad, int axis, int value);
+
+ /**
+ * Emitted when the gamepad is unplugged
+ */
+ public abstract signal void unplugged ();
+
+ public abstract string guid { get; }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]