[retro-gtk/wip/aplazas/master: 7/10] Port PointerId to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/master: 7/10] Port PointerId to C
- Date: Sat, 7 Oct 2017 08:51:15 +0000 (UTC)
commit f1902cea91b3a953c2212b6279ee12ceefe07be4
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Sep 5 14:59:50 2017 +0200
Port PointerId to C
retro-gtk/Makefile.am | 2 ++
retro-gtk/input/device.vala | 9 ---------
retro-gtk/retro-core-view-extern.c | 1 +
retro-gtk/retro-gtk.h | 1 +
retro-gtk/retro-pointer-id.c | 25 +++++++++++++++++++++++++
retro-gtk/retro-pointer-id.h | 35 +++++++++++++++++++++++++++++++++++
6 files changed, 64 insertions(+), 9 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index dbc8a58..cbdde48 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -38,6 +38,7 @@ retro_gtk_public_h_sources = \
retro-joypad-id.h \
retro-lightgun-id.h \
retro-mouse-id.h \
+ retro-pointer-id.h \
$(NULL)
retro_gtk_private_h_sources = \
@@ -90,6 +91,7 @@ libretro_gtk_la_SOURCES = \
retro-mouse-id.c \
retro-option.c \
retro-options.c \
+ retro-pointer-id.c \
rumble.vala \
video.vala \
retro-core.c \
diff --git a/retro-gtk/input/device.vala b/retro-gtk/input/device.vala
index 04f6f3a..9bcf1bf 100644
--- a/retro-gtk/input/device.vala
+++ b/retro-gtk/input/device.vala
@@ -3,15 +3,6 @@
namespace Retro {
/**
- * The input types of a pointer.
- */
-private enum PointerId {
- X,
- Y,
- PRESSED
-}
-
-/**
* Describes an input source.
*/
public struct InputDescriptor {
diff --git a/retro-gtk/retro-core-view-extern.c b/retro-gtk/retro-core-view-extern.c
index a7c6843..571f835 100644
--- a/retro-gtk/retro-core-view-extern.c
+++ b/retro-gtk/retro-core-view-extern.c
@@ -5,6 +5,7 @@
#include "retro-core-view-input-device.h"
#include "retro-joypad-id.h"
#include "retro-mouse-id.h"
+#include "retro-pointer-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 78b13d2..dfb51db 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -16,6 +16,7 @@
#include "retro-joypad-id.h"
#include "retro-lightgun-id.h"
#include "retro-mouse-id.h"
+#include "retro-pointer-id.h"
#undef __RETRO_GTK_INSIDE__
diff --git a/retro-gtk/retro-pointer-id.c b/retro-gtk/retro-pointer-id.c
new file mode 100644
index 0000000..0913e7d
--- /dev/null
+++ b/retro-gtk/retro-pointer-id.c
@@ -0,0 +1,25 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#include "retro-pointer-id.h"
+
+GType
+retro_pointer_id_get_type (void)
+{
+ static volatile gsize retro_pointer_id_type = 0;
+
+ if (g_once_init_enter (&retro_pointer_id_type)) {
+ static const GEnumValue values[] = {
+ { RETRO_POINTER_ID_X, "RETRO_POINTER_ID_X", "x" },
+ { RETRO_POINTER_ID_Y, "RETRO_POINTER_ID_Y", "y" },
+ { RETRO_POINTER_ID_PRESSED, "RETRO_POINTER_ID_PRESSED", "pressed" },
+ { 0, NULL, NULL },
+ };
+ GType type;
+
+ type = g_enum_register_static ("RetroPointerId", values);
+
+ g_once_init_leave (&retro_pointer_id_type, type);
+ }
+
+ return retro_pointer_id_type;
+}
diff --git a/retro-gtk/retro-pointer-id.h b/retro-gtk/retro-pointer-id.h
new file mode 100644
index 0000000..c2df152
--- /dev/null
+++ b/retro-gtk/retro-pointer-id.h
@@ -0,0 +1,35 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_POINTER_ID_H
+#define RETRO_POINTER_ID_H
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define RETRO_TYPE_POINTER_ID (retro_pointer_id_get_type ())
+
+GType retro_pointer_id_get_type (void) G_GNUC_CONST;
+
+/**
+ * RetroPointerId:
+ * @RETRO_POINTER_ID_X: the X axis of a pointer
+ * @RETRO_POINTER_ID_Y: the Y axis of a pointer
+ * @RETRO_POINTER_ID_PRESSED: the pression of a pointer
+ *
+ * Represents the inputs for the Libretro pointer.
+ */
+typedef enum
+{
+ RETRO_POINTER_ID_X,
+ RETRO_POINTER_ID_Y,
+ RETRO_POINTER_ID_PRESSED,
+} RetroPointerId;
+
+G_END_DECLS
+
+#endif /* RETRO_POINTER_ID_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]