From 70213ada5da057ff94d9c9c218b50d7e154f468a Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Thu, 21 Aug 2008 05:07:56 +0000 Subject: [PATCH] preliminary gamepad config --- ChangeLog | 3 +++ gfceux | 34 ++++++++++++++++++++++++++++++++-- gfceux.glade | 28 ++++++++++++++++++---------- gfceux.xml | 28 ++++++++++++++++++---------- 4 files changed, 71 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef6d6aa0..9275fc6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +* Working on new config system for input. you can try by configuring + the third gamepad. It's not functional yet, but it's a start on more + intuitive gamepad configuration for sdl ================== version 2.0.2 ================================ * Now stores config file in .fceultra * If the .fceultra config directory doesn't exist yet, gfceux will diff --git a/gfceux b/gfceux index 8c7003e5..d79d3a8a 100755 --- a/gfceux +++ b/gfceux @@ -40,7 +40,7 @@ except ImportError: Ensure that PyGTK (>=2.12) is installed on this system.\n\ On Debian based systems (like Ubuntu), try this command:\n\ sudo apt-get install python-gtk2 libgtk2.0-0" - + class GameOptions: # sound @@ -532,7 +532,37 @@ class GfceuApp: widgets.get_object("movie_entry").set_text("") widgets.get_object("lua_entry").set_text("") options.romfile = x - + # fix this global its ugly + gamepad_config = "0" + + def gamepad_clicked_new(self, widget, data=None): + widgets.get_object("gamepad_config_window").show_all() + d = {'gp1_button' : "0", + 'gp2_button' : "1", + 'gp3_button' : "2", + 'gp4_button' : "3"} + self.gamepad_config = d[widget.name] + + def right_button_clicked(self, widget, data=None): + print "right!" + def left_button_clicked(self, widget, data=None): + print "left!" + def down_button_clicked(self, widget, data=None): + print "down!" + def up_button_clicked(self, widget, data=None): + print "up!" + def button_clicked(self, widget, data=None): + d = {'right_button' : "SDL.Input.GamePad." + self.gamepad_config + "Right", + 'left_button' : "SDL.Input.GamePad." + self.gamepad_config + "Left", + 'up_button' : "SDL.Input.GamePad." + self.gamepad_config + "Up", + 'down_button' : "SDL.Input.GamePad." + self.gamepad_config + "Down", + 'select_button' : "SDL.Input.GamePad." + self.gamepad_config + "Select", + 'start_button' : "SDL.Input.GamePad." + self.gamepad_config + "Start", + 'a_button' : "SDL.Input.GamePad." + self.gamepad_config + "A", + 'b_button' : "SDL.Input.GamePad." + self.gamepad_config + "B"} + print d[widget.name] + + def gamepad_clicked(self, widget, data=None): d = {'gp1_button' : '1', diff --git a/gfceux.glade b/gfceux.glade index cea91a3b..28a59107 100644 --- a/gfceux.glade +++ b/gfceux.glade @@ -1,6 +1,6 @@ - + @@ -36,12 +36,13 @@ - + True True True Up 0 + 1 @@ -49,12 +50,13 @@ - + True True True Left 0 + 1 @@ -62,12 +64,13 @@ - + True True True Down 0 + 1 @@ -77,12 +80,13 @@ - + True True True Right 0 + 2 @@ -120,21 +124,23 @@ True - + True True True Select 0 + - + True True True Start 0 + 1 @@ -172,21 +178,23 @@ True - + True True True B 0 + - + True True True A 0 + 1 @@ -434,7 +442,7 @@ Gamepad _3 True 0 - + 1 diff --git a/gfceux.xml b/gfceux.xml index 505ce305..0e0dc0f7 100644 --- a/gfceux.xml +++ b/gfceux.xml @@ -1,5 +1,5 @@ - + 5 @@ -67,11 +67,12 @@ - + True True True Up + 1 @@ -79,11 +80,12 @@ - + True True True Left + 1 @@ -91,11 +93,12 @@ - + True True True Down + 1 @@ -105,11 +108,12 @@ - + True True True Right + 2 @@ -144,19 +148,21 @@ True - + True True True Select + - + True True True Start + 1 @@ -191,19 +197,21 @@ True - + True True True B + - + True True True A + 1 @@ -487,7 +495,7 @@ True Gamepad _1 True - +