[retro-gtk/c-port: 9/39] Port JoypadId to C



commit 8f8d213392d26c4fdcdbfade210639f9bfd792ef
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Sep 5 13:28:53 2017 +0200

    Port JoypadId to C

 retro-gtk/Makefile.am              |    1 +
 retro-gtk/input/device.vala        |   23 --------------
 retro-gtk/retro-core-view-extern.c |    1 +
 retro-gtk/retro-gtk.h              |    1 +
 retro-gtk/retro-joypad-id.h        |   59 ++++++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 23 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index ca24d2c..f778ad8 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -109,6 +109,7 @@ retro_gtkinclude_HEADERS = \
        retro-device-type.h \
        retro-gtk.h \
        retro-gtk-vala.h \
+       retro-joypad-id.h \
        retro-option.h \
        retro-options.h \
        retro-variable.h \
diff --git a/retro-gtk/input/device.vala b/retro-gtk/input/device.vala
index a6e618e..180630b 100644
--- a/retro-gtk/input/device.vala
+++ b/retro-gtk/input/device.vala
@@ -3,29 +3,6 @@
 namespace Retro {
 
 /**
- * The input types of a joypad.
- */
-public enum JoypadId {
-       B,
-       Y,
-       SELECT,
-       START,
-       UP,
-       DOWN,
-       LEFT,
-       RIGHT,
-       A,
-       X,
-       L,
-       R,
-       L2,
-       R2,
-       L3,
-       R3,
-       COUNT,
-}
-
-/**
  * The analog sticks of an analog joypad.
  */
 public enum AnalogIndex {
diff --git a/retro-gtk/retro-core-view-extern.c b/retro-gtk/retro-core-view-extern.c
index 089eaaf..8377168 100644
--- a/retro-gtk/retro-core-view-extern.c
+++ b/retro-gtk/retro-core-view-extern.c
@@ -3,6 +3,7 @@
 #include <linux/input-event-codes.h>
 #include "retro-gtk-internal.h"
 #include "retro-core-view-input-device.h"
+#include "retro-joypad-id.h"
 
 static guint16 DEFAULT_KEY_JOYPAD_BUTTON_MAPPING[RETRO_JOYPAD_ID_COUNT] = {
   KEY_S,
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index 9c628b1..40dce8f 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -9,5 +9,6 @@
 
 #include "retro-device-type.h"
 #include "retro-gtk-vala.h"
+#include "retro-joypad-id.h"
 
 #endif
diff --git a/retro-gtk/retro-joypad-id.h b/retro-gtk/retro-joypad-id.h
new file mode 100644
index 0000000..a3bbfb9
--- /dev/null
+++ b/retro-gtk/retro-joypad-id.h
@@ -0,0 +1,59 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_JOYPAD_ID_H
+#define RETRO_JOYPAD_ID_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * RetroJoypadId:
+ * @RETRO_JOYPAD_ID_B: The bottom action button.
+ * @RETRO_JOYPAD_ID_Y: The left action button.
+ * @RETRO_JOYPAD_ID_SELECT: The Select button.
+ * @RETRO_JOYPAD_ID_START: The Start button.
+ * @RETRO_JOYPAD_ID_UP: The up directional button.
+ * @RETRO_JOYPAD_ID_DOWN: The down directional button.
+ * @RETRO_JOYPAD_ID_LEFT: The left directional button.
+ * @RETRO_JOYPAD_ID_RIGHT: The right directional button.
+ * @RETRO_JOYPAD_ID_A: The right action button.
+ * @RETRO_JOYPAD_ID_X: The top action button.
+ * @RETRO_JOYPAD_ID_L: The first left shoulder button.
+ * @RETRO_JOYPAD_ID_R: The first right shoulder button.
+ * @RETRO_JOYPAD_ID_L2: The second left shoulder button.
+ * @RETRO_JOYPAD_ID_R2: The second right shoulder button.
+ * @RETRO_JOYPAD_ID_L3: The left thumb button.
+ * @RETRO_JOYPAD_ID_R3: The right thumb button.
+ * @RETRO_JOYPAD_ID_COUNT: The number of buttons.
+ *
+ * Represents the buttons for the Libretro gamepad. The available buttons are
+ * the same as the W3C Standard Gamepad and many other modern standard gamepads,
+ * but the name of the buttons may differ. See the <ulink
+ * url="https://w3c.github.io/gamepad/";>W3C Gamepad Specification</ulink> for
+ * more information.
+ */
+typedef enum
+{
+  RETRO_JOYPAD_ID_B,
+  RETRO_JOYPAD_ID_Y,
+  RETRO_JOYPAD_ID_SELECT,
+  RETRO_JOYPAD_ID_START,
+  RETRO_JOYPAD_ID_UP,
+  RETRO_JOYPAD_ID_DOWN,
+  RETRO_JOYPAD_ID_LEFT,
+  RETRO_JOYPAD_ID_RIGHT,
+  RETRO_JOYPAD_ID_A,
+  RETRO_JOYPAD_ID_X,
+  RETRO_JOYPAD_ID_L,
+  RETRO_JOYPAD_ID_R,
+  RETRO_JOYPAD_ID_L2,
+  RETRO_JOYPAD_ID_R2,
+  RETRO_JOYPAD_ID_L3,
+  RETRO_JOYPAD_ID_R3,
+  RETRO_JOYPAD_ID_COUNT,
+} RetroJoypadId;
+
+G_END_DECLS
+
+#endif /* RETRO_JOYPAD_ID_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]