GTK :
- Autofire is now configurable using the Joypad config dialog. - This allowed simplifying the Joypad menu to a single item.
This commit is contained in:
parent
be21f833ec
commit
6bac5170fc
|
@ -27,18 +27,20 @@ namespace VBA
|
|||
|
||||
const JoypadConfigDialog::SJoypadKey JoypadConfigDialog::m_astKeys[] =
|
||||
{
|
||||
{ KEY_UP, "Up :" },
|
||||
{ KEY_DOWN, "Down :" },
|
||||
{ KEY_LEFT, "Left :" },
|
||||
{ KEY_RIGHT, "Right :" },
|
||||
{ KEY_BUTTON_A, "Button A :" },
|
||||
{ KEY_BUTTON_B, "Button B :" },
|
||||
{ KEY_BUTTON_L, "Button L :" },
|
||||
{ KEY_BUTTON_R, "Button R :" },
|
||||
{ KEY_BUTTON_SELECT, "Select :" },
|
||||
{ KEY_BUTTON_START, "Start :" },
|
||||
{ KEY_BUTTON_SPEED, "Speed :" },
|
||||
{ KEY_BUTTON_CAPTURE, "Capture :" }
|
||||
{ KEY_UP, "Up :" },
|
||||
{ KEY_DOWN, "Down :" },
|
||||
{ KEY_LEFT, "Left :" },
|
||||
{ KEY_RIGHT, "Right :" },
|
||||
{ KEY_BUTTON_A, "Button A :" },
|
||||
{ KEY_BUTTON_B, "Button B :" },
|
||||
{ KEY_BUTTON_L, "Button L :" },
|
||||
{ KEY_BUTTON_R, "Button R :" },
|
||||
{ KEY_BUTTON_SELECT, "Select :" },
|
||||
{ KEY_BUTTON_START, "Start :" },
|
||||
{ KEY_BUTTON_SPEED, "Speed :" },
|
||||
{ KEY_BUTTON_CAPTURE, "Capture :" },
|
||||
{ KEY_BUTTON_AUTO_A, "Autofire A :" },
|
||||
{ KEY_BUTTON_AUTO_B, "Autofire B :" }
|
||||
};
|
||||
|
||||
JoypadConfigDialog::JoypadConfigDialog() :
|
||||
|
@ -93,6 +95,7 @@ JoypadConfigDialog::JoypadConfigDialog() :
|
|||
&JoypadConfigDialog::vOnDefaultJoypadSelect) );
|
||||
m_oTitleCombo.signal_changed().connect(sigc::mem_fun(*this,
|
||||
&JoypadConfigDialog::vOnJoypadSelect) );
|
||||
|
||||
m_oTitleCombo.set_active_text("1");
|
||||
|
||||
show_all_children();
|
||||
|
@ -218,26 +221,26 @@ bool JoypadConfigDialog::bOnConfigIdle()
|
|||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_JOYAXISMOTION:
|
||||
if (abs(event.jaxis.value) < 16384) continue;
|
||||
if (event.jaxis.which != m_oPreviousEvent.jaxis.which ||
|
||||
event.jaxis.axis != m_oPreviousEvent.jaxis.axis ||
|
||||
(event.jaxis.value > 0 && m_oPreviousEvent.jaxis.value < 0) ||
|
||||
(event.jaxis.value < 0 && m_oPreviousEvent.jaxis.value > 0))
|
||||
{
|
||||
vOnInputEvent(event);
|
||||
m_oPreviousEvent = event;
|
||||
}
|
||||
vEmptyEventQueue();
|
||||
break;
|
||||
case SDL_JOYHATMOTION:
|
||||
case SDL_JOYBUTTONUP:
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_JOYAXISMOTION:
|
||||
if (abs(event.jaxis.value) < 16384) continue;
|
||||
if (event.jaxis.which != m_oPreviousEvent.jaxis.which
|
||||
|| event.jaxis.axis != m_oPreviousEvent.jaxis.axis
|
||||
|| (event.jaxis.value > 0 && m_oPreviousEvent.jaxis.value < 0)
|
||||
|| (event.jaxis.value < 0 && m_oPreviousEvent.jaxis.value > 0))
|
||||
{
|
||||
vOnInputEvent(event);
|
||||
vEmptyEventQueue();
|
||||
break;
|
||||
}
|
||||
m_oPreviousEvent = event;
|
||||
}
|
||||
vEmptyEventQueue();
|
||||
break;
|
||||
case SDL_JOYHATMOTION:
|
||||
case SDL_JOYBUTTONUP:
|
||||
vOnInputEvent(event);
|
||||
vEmptyEventQueue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1031,64 +1031,10 @@
|
|||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="JoypadMenu">
|
||||
<widget class="GtkMenuItem" id="JoypadConfigure">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Joypad</property>
|
||||
<property name="label" translatable="yes">_Joypads ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="JoypadMenu_menu">
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="JoypadConfigure">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Configure ...</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="AutofireMenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Autofire</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="AutofireMenu_menu">
|
||||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="AutofireA">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_A</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="1" modifiers="GDK_MOD1_MASK" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="AutofireB">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_B</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="2" modifiers="GDK_MOD1_MASK" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="AutofireL">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_L</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="3" modifiers="GDK_MOD1_MASK" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckMenuItem" id="AutofireR">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_R</property>
|
||||
<property name="use_underline">True</property>
|
||||
<accelerator key="4" modifiers="GDK_MOD1_MASK" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -70,7 +70,9 @@ const Window::SJoypadKey Window::m_astJoypad[] =
|
|||
{ "speed", KEY_BUTTON_SPEED },
|
||||
{ "capture", KEY_BUTTON_CAPTURE },
|
||||
{ "speed", KEY_BUTTON_SPEED },
|
||||
{ "capture", KEY_BUTTON_CAPTURE }
|
||||
{ "capture", KEY_BUTTON_CAPTURE },
|
||||
{ "autoA", KEY_BUTTON_AUTO_A },
|
||||
{ "autoB", KEY_BUTTON_AUTO_B }
|
||||
};
|
||||
|
||||
Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
||||
|
@ -618,31 +620,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
EPad eDefaultJoypad = (EPad)m_poInputConfig->oGetKey<int>("active_joypad");
|
||||
inputSetDefaultJoypad(eDefaultJoypad);
|
||||
|
||||
// Autofire menu
|
||||
//
|
||||
struct
|
||||
{
|
||||
const char * m_csName;
|
||||
const char * m_csKey;
|
||||
const EKey m_eKey;
|
||||
}
|
||||
astAutofire[] =
|
||||
{
|
||||
{ "AutofireA", "autofire_A", KEY_BUTTON_A },
|
||||
{ "AutofireB", "autofire_B", KEY_BUTTON_B },
|
||||
{ "AutofireL", "autofire_L", KEY_BUTTON_L },
|
||||
{ "AutofireR", "autofire_R", KEY_BUTTON_R }
|
||||
};
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astAutofire); i++)
|
||||
{
|
||||
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astAutofire[i].m_csName));
|
||||
poCMI->set_active(m_poInputConfig->oGetKey<bool>(astAutofire[i].m_csKey));
|
||||
vOnAutofireToggled(poCMI, astAutofire[i].m_eKey);
|
||||
poCMI->signal_toggled().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnAutofireToggled),
|
||||
poCMI, astAutofire[i].m_eKey));
|
||||
}
|
||||
|
||||
// Fullscreen menu
|
||||
//
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("VideoFullscreen"));
|
||||
|
@ -767,7 +744,7 @@ void Window::vInitScreenArea(EVideoOutput _eVideoOutput)
|
|||
}
|
||||
catch (std::exception e)
|
||||
{
|
||||
fprintf(stderr, "Unable to initialise output, falling back to Cairo\n");
|
||||
fprintf(stderr, "Unable to initialize output, falling back to Cairo\n");
|
||||
m_poScreenArea = Gtk::manage(new ScreenAreaCairo(m_iScreenWidth, m_iScreenHeight));
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,6 @@ protected:
|
|||
virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x);
|
||||
virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB);
|
||||
virtual void vOnJoypadConfigure();
|
||||
virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey);
|
||||
virtual void vOnHelpAbout();
|
||||
virtual bool bOnEmuIdle();
|
||||
|
||||
|
|
|
@ -645,33 +645,6 @@ void Window::vOnJoypadConfigure()
|
|||
m_poInputConfig->vSetKey("active_joypad", inputGetDefaultJoypad());
|
||||
}
|
||||
|
||||
void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey)
|
||||
{
|
||||
if (_poCMI->get_active() == inputGetAutoFire(_eKey))
|
||||
{
|
||||
inputToggleAutoFire(_eKey);
|
||||
}
|
||||
|
||||
std::string sKey;
|
||||
if (_eKey == KEY_BUTTON_A)
|
||||
{
|
||||
sKey = "autofire_A";
|
||||
}
|
||||
else if (_eKey == KEY_BUTTON_B)
|
||||
{
|
||||
sKey = "autofire_B";
|
||||
}
|
||||
else if (_eKey == KEY_BUTTON_L)
|
||||
{
|
||||
sKey = "autofire_L";
|
||||
}
|
||||
else if (_eKey == KEY_BUTTON_R)
|
||||
{
|
||||
sKey = "autofire_R";
|
||||
}
|
||||
m_poInputConfig->vSetKey(sKey, _poCMI->get_active());
|
||||
}
|
||||
|
||||
void Window::vOnHelpAbout()
|
||||
{
|
||||
Gtk::AboutDialog oAboutDialog;
|
||||
|
|
Loading…
Reference in New Issue