GTK : Reenabled the autofire menu.

This commit is contained in:
bgk 2008-09-03 21:06:11 +00:00
parent 992d7f735a
commit ecc0ec3f43
5 changed files with 52 additions and 24 deletions

View File

@ -731,28 +731,28 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
// Autofire menu
//
/*struct
struct
{
const char * m_csName;
const char * m_csKey;
const EKeyFlag m_eKeyFlag;
const char * m_csName;
const char * m_csKey;
const EKey m_eKey;
}
astAutofire[] =
{
{ "AutofireA", "autofire_A", KeyFlagA },
{ "AutofireB", "autofire_B", KeyFlagB },
{ "AutofireL", "autofire_L", KeyFlagL },
{ "AutofireR", "autofire_R", KeyFlagR }
{ "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_eKeyFlag);
vOnAutofireToggled(poCMI, astAutofire[i].m_eKey);
poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnAutofireToggled),
poCMI, astAutofire[i].m_eKeyFlag));
}*/
poCMI, astAutofire[i].m_eKey));
}
// Fullscreen menu
//

View File

@ -166,7 +166,7 @@ protected:
virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB);
virtual void vOnJoypadConfigure(EPad _eJoypad);
virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, EPad _eJoypad);
virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag);
virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey);
#ifndef NO_DEBUGGER
virtual void vOnGDBWait();
virtual void vOnGDBLoadAndWait();

View File

@ -887,35 +887,31 @@ void Window::vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, EPad _eJoypad)
m_poInputConfig->vSetKey("active_joypad", _eJoypad);
}
void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag)
void Window::vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, EKey _eKey)
{
/* if (_poCMI->get_active())
if (_poCMI->get_active() != inputGetAutoFire(_eKey))
{
m_uiAutofireState |= _uiKeyFlag;
}
else
{
m_uiAutofireState &= ~_uiKeyFlag;
inputToggleAutoFire(_eKey);
}
std::string sKey;
if (_uiKeyFlag == KeyFlagA)
if (_eKey == KEY_BUTTON_A)
{
sKey = "autofire_A";
}
else if (_uiKeyFlag == KeyFlagB)
else if (_eKey == KEY_BUTTON_B)
{
sKey = "autofire_B";
}
else if (_uiKeyFlag == KeyFlagL)
else if (_eKey == KEY_BUTTON_L)
{
sKey = "autofire_L";
}
else if (_uiKeyFlag == KeyFlagR)
else if (_eKey == KEY_BUTTON_R)
{
sKey = "autofire_R";
}
m_poInputConfig->vSetKey(sKey, _poCMI->get_active());*/
m_poInputConfig->vSetKey(sKey, _poCMI->get_active());
}
#ifndef NO_DEBUGGER

View File

@ -151,6 +151,31 @@ void inputSetMotionKeymap(EKey key, uint32_t code)
motion[key] = code;
}
bool inputGetAutoFire(EKey key)
{
int mask = 0;
switch (key)
{
case KEY_BUTTON_A:
mask = 1 << 0;
break;
case KEY_BUTTON_B:
mask = 1 << 1;
break;
case KEY_BUTTON_R:
mask = 1 << 8;
break;
case KEY_BUTTON_L:
mask = 1 << 9;
break;
default:
break;
}
return !(autoFire & mask);
}
bool inputToggleAutoFire(EKey key)
{
int mask = 0;

View File

@ -84,6 +84,13 @@ void inputSetMotionKeymap(EKey key, uint32_t code);
*/
bool inputToggleAutoFire(EKey key);
/**
* Get Auto fire status for the specified button. Only A, B, R, L are supported.
* @param key Emulated joypad button
* @return Auto fire enabled
*/
bool inputGetAutoFire(EKey key);
/**
* Update the emulated pads state with a SDL event
* @param SDL_Event An event that has just occured