[gnome-games] retro: Add 'present_analog_sticks' to RetroInputManager



commit 5d62afff9000a8539ca3c8b27ba32ee9d33a0264
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Aug 30 15:04:38 2016 +0200

    retro: Add 'present_analog_sticks' to RetroInputManager
    
    This will be used in the next commits to present gamepads as classic
    gamepads or as gamepads with analog sticks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770192

 src/retro/retro-input-manager.vala |    9 ++++++---
 src/retro/retro-runner.vala        |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/retro/retro-input-manager.vala b/src/retro/retro-input-manager.vala
index c1d9215..ecba4ac 100644
--- a/src/retro/retro-input-manager.vala
+++ b/src/retro/retro-input-manager.vala
@@ -6,8 +6,11 @@ private class Games.RetroInputManager : RetroGtk.InputDeviceManager, Retro.Rumbl
        private bool[] is_port_plugged;
        private Gamepad?[] gamepads;
        private int keyboard_port;
+       private bool present_analog_sticks;
+
+       public RetroInputManager (Gtk.Widget widget, bool present_analog_sticks) {
+               this.present_analog_sticks = present_analog_sticks;
 
-       public RetroInputManager (Gtk.Widget widget) {
                keyboard = new RetroGtk.VirtualGamepad (widget);
                gamepad_monitor = GamepadMonitor.get_instance ();
 
@@ -17,7 +20,7 @@ private class Games.RetroInputManager : RetroGtk.InputDeviceManager, Retro.Rumbl
                        var port = is_port_plugged.length;
                        is_port_plugged += true;
                        gamepads += gamepad;
-                       set_controller_device (port, new RetroGamepad (gamepad, true));
+                       set_controller_device (port, new RetroGamepad (gamepad, present_analog_sticks));
                        gamepad.unplugged.connect (() => handle_gamepad_unplugged (port));
                });
 
@@ -32,7 +35,7 @@ private class Games.RetroInputManager : RetroGtk.InputDeviceManager, Retro.Rumbl
                // Plug this gamepad to the port where the keyboard was plugged as a last resort
                var port = keyboard_port;
                gamepad.unplugged.connect (() => handle_gamepad_unplugged (port));
-               set_controller_device (keyboard_port, new RetroGamepad (gamepad, true));
+               set_controller_device (keyboard_port, new RetroGamepad (gamepad, present_analog_sticks));
                gamepads[port] = gamepad;
 
                // Assign keyboard to another unplugged port if exists and return
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 8d2319d..b7434bf 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -165,7 +165,7 @@ public class Games.RetroRunner : Object, Runner {
                widget = new Gtk.EventBox ();
                widget.add (video);
                video.visible = true;
-               input_manager = new RetroInputManager (widget);
+               input_manager = new RetroInputManager (widget, true);
 
                var media_number = media_set.selected_media_number;
                var media = media_set.get_selected_media (media_number);


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