[retro-gtk/wip/aplazas/gamepad: 6/6] truc
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/gamepad: 6/6] truc
- Date: Tue, 5 Sep 2017 06:13:13 +0000 (UTC)
commit dd4f84a3946db58a76596e24adf9861c90ca1c1b
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Aug 4 08:19:00 2017 +0200
truc
retro-gtk/input/gamepad-configuration.vala | 5 +----
retro-gtk/input/retro-gamepad-configuration.c | 22 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/retro-gtk/input/gamepad-configuration.vala b/retro-gtk/input/gamepad-configuration.vala
index 8e0190a..2c4b60e 100644
--- a/retro-gtk/input/gamepad-configuration.vala
+++ b/retro-gtk/input/gamepad-configuration.vala
@@ -9,8 +9,5 @@ public class Retro.GamepadConfiguration : Object {
public extern void set_to_default ();
public extern void set_button_key (uint16 button, uint16 key);
-
- internal uint16 get_button_key (JoypadId button) {
- return gamepad_keys[button];
- }
+ public extern uint16 get_button_key (uint16 button);
}
diff --git a/retro-gtk/input/retro-gamepad-configuration.c b/retro-gtk/input/retro-gamepad-configuration.c
index 145b532..2da021e 100644
--- a/retro-gtk/input/retro-gamepad-configuration.c
+++ b/retro-gtk/input/retro-gamepad-configuration.c
@@ -36,9 +36,29 @@ retro_gamepad_configuration_set_button_key (RetroGamepadConfiguration *self,
retro_button = retro_gamepad_button_converter (button);
- if (retro_button == RETRO_JOYPAD_ID_COUNT)
+ if (retro_button == RETRO_JOYPAD_ID_COUNT) {
+ self->gamepad_keys[retro_button] = 0;
+
return;
+ }
// GDK adds 8 to the Linux input event codes to create the hardware keycode.
self->gamepad_keys[retro_button] = key + 8;
}
+
+guint16
+retro_gamepad_configuration_get_button_key (RetroGamepadConfiguration *self,
+ guint16 button)
+{
+ RetroJoypadId retro_button;
+
+ g_return_val_if_fail (self != NULL, 0);
+
+ retro_button = retro_gamepad_button_converter (button);
+
+ if (retro_button == RETRO_JOYPAD_ID_COUNT)
+ return 0;
+
+ return self->gamepad_keys[retro_button];
+
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]