preliminary gamepad config

This commit is contained in:
punkrockguy318 2008-08-21 05:07:56 +00:00
parent 3d7536ceb2
commit 70213ada5d
4 changed files with 71 additions and 22 deletions

View File

@ -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 ================================ ================== version 2.0.2 ================================
* Now stores config file in .fceultra * Now stores config file in .fceultra
* If the .fceultra config directory doesn't exist yet, gfceux will * If the .fceultra config directory doesn't exist yet, gfceux will

30
gfceux
View File

@ -532,6 +532,36 @@ class GfceuApp:
widgets.get_object("movie_entry").set_text("") widgets.get_object("movie_entry").set_text("")
widgets.get_object("lua_entry").set_text("") widgets.get_object("lua_entry").set_text("")
options.romfile = x 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): def gamepad_clicked(self, widget, data=None):

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Wed Aug 13 20:04:13 2008 --> <!--Generated with glade3 3.4.5 on Thu Aug 21 01:05:34 2008 -->
<glade-interface> <glade-interface>
<widget class="GtkWindow" id="gamepad_config_window"> <widget class="GtkWindow" id="gamepad_config_window">
<child> <child>
@ -36,12 +36,13 @@
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button1"> <widget class="GtkButton" id="up_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Up</property> <property name="label" translatable="yes">Up</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -49,12 +50,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button2"> <widget class="GtkButton" id="left_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Left</property> <property name="label" translatable="yes">Left</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -62,12 +64,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button3"> <widget class="GtkButton" id="down_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Down</property> <property name="label" translatable="yes">Down</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -77,12 +80,13 @@
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button4"> <widget class="GtkButton" id="right_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Right</property> <property name="label" translatable="yes">Right</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@ -120,21 +124,23 @@
<widget class="GtkHBox" id="hbox4"> <widget class="GtkHBox" id="hbox4">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<widget class="GtkButton" id="button5"> <widget class="GtkButton" id="select_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Select</property> <property name="label" translatable="yes">Select</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button6"> <widget class="GtkButton" id="start_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Start</property> <property name="label" translatable="yes">Start</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -172,21 +178,23 @@
<widget class="GtkHBox" id="hbox5"> <widget class="GtkHBox" id="hbox5">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<widget class="GtkButton" id="button7"> <widget class="GtkButton" id="b_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">B</property> <property name="label" translatable="yes">B</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button8"> <widget class="GtkButton" id="a_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">A</property> <property name="label" translatable="yes">A</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="button_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -434,7 +442,7 @@
<property name="label" translatable="yes">Gamepad _3</property> <property name="label" translatable="yes">Gamepad _3</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<signal name="clicked" handler="gamepad_clicked" after="yes"/> <signal name="clicked" handler="gamepad_clicked_new" after="yes"/>
</widget> </widget>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!--Generated with glade3 3.4.5 on Wed Aug 13 20:04:13 2008 --> <!--Generated with glade3 3.4.5 on Thu Aug 21 00:55:50 2008 -->
<interface> <interface>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
<property name="upper">5</property> <property name="upper">5</property>
@ -67,11 +67,12 @@
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<object class="GtkButton" id="button1"> <object class="GtkButton" id="up_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Up</property> <property name="label" translatable="yes">Up</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -79,11 +80,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="button2"> <object class="GtkButton" id="left_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Left</property> <property name="label" translatable="yes">Left</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">1</property>
@ -91,11 +93,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="button3"> <object class="GtkButton" id="down_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Down</property> <property name="label" translatable="yes">Down</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -105,11 +108,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="button4"> <object class="GtkButton" id="right_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Right</property> <property name="label" translatable="yes">Right</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@ -144,19 +148,21 @@
<object class="GtkHBox" id="hbox4"> <object class="GtkHBox" id="hbox4">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkButton" id="button5"> <object class="GtkButton" id="select_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Select</property> <property name="label" translatable="yes">Select</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton" id="button6"> <object class="GtkButton" id="start_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">Start</property> <property name="label" translatable="yes">Start</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -191,19 +197,21 @@
<object class="GtkHBox" id="hbox5"> <object class="GtkHBox" id="hbox5">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkButton" id="button7"> <object class="GtkButton" id="b_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">B</property> <property name="label" translatable="yes">B</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkButton" id="button8"> <object class="GtkButton" id="a_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="label" translatable="yes">A</property> <property name="label" translatable="yes">A</property>
<signal handler="button_clicked" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@ -487,7 +495,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Gamepad _1</property> <property name="label" translatable="yes">Gamepad _1</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<signal after="yes" handler="gamepad_clicked" name="clicked"/> <signal after="yes" handler="gamepad_clicked_new" name="clicked"/>
</object> </object>
<packing> <packing>
<property name="y_options"/> <property name="y_options"/>