parent
14e58ee2bb
commit
24ed04f8f1
|
@ -194,7 +194,6 @@ SET(SRC_HQ_ASM
|
|||
|
||||
SET(SRC_GTK
|
||||
src/gtk/configfile.cpp
|
||||
src/gtk/input.cpp
|
||||
src/gtk/main.cpp
|
||||
src/gtk/system.cpp
|
||||
src/gtk/windowcallbacks.cpp
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "input.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
Keymap::Keymap()
|
||||
{
|
||||
}
|
||||
|
||||
Keymap::~Keymap()
|
||||
{
|
||||
}
|
||||
|
||||
void Keymap::vRegister(int _iVal, EKey _eKey)
|
||||
{
|
||||
m_oTable[_iVal] = _eKey;
|
||||
}
|
||||
|
||||
void Keymap::vClear()
|
||||
{
|
||||
m_oTable.clear();
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -62,28 +62,7 @@ enum EKeyFlag
|
|||
KeyFlagCapture = 1 << 11,
|
||||
};
|
||||
|
||||
class Keymap
|
||||
{
|
||||
public:
|
||||
Keymap();
|
||||
~Keymap();
|
||||
|
||||
void vRegister(int _iVal, EKey _eKey);
|
||||
void vClear();
|
||||
inline EKey eGetKey(int _iVal);
|
||||
|
||||
private:
|
||||
std::map<int, EKey> m_oTable;
|
||||
|
||||
// noncopyable
|
||||
Keymap(const Keymap &);
|
||||
Keymap & operator=(const Keymap &);
|
||||
};
|
||||
|
||||
inline EKey Keymap::eGetKey(int _iVal)
|
||||
{
|
||||
return m_oTable[_iVal];
|
||||
}
|
||||
typedef std::map<int, EKey> Keymap;
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
|
|
@ -117,24 +117,24 @@ void JoypadConfig::vSetDefault()
|
|||
}
|
||||
}
|
||||
|
||||
Keymap * JoypadConfig::poCreateKeymap() const
|
||||
Keymap JoypadConfig::oCreateKeymap() const
|
||||
{
|
||||
Keymap * poKeymap = new Keymap();
|
||||
Keymap oKeymap;
|
||||
|
||||
poKeymap->vRegister(m_uiUp, KeyUp );
|
||||
poKeymap->vRegister(m_uiDown, KeyDown );
|
||||
poKeymap->vRegister(m_uiLeft, KeyLeft );
|
||||
poKeymap->vRegister(m_uiRight, KeyRight );
|
||||
poKeymap->vRegister(m_uiA, KeyA );
|
||||
poKeymap->vRegister(m_uiB, KeyB );
|
||||
poKeymap->vRegister(m_uiL, KeyL );
|
||||
poKeymap->vRegister(m_uiR, KeyR );
|
||||
poKeymap->vRegister(m_uiSelect, KeySelect );
|
||||
poKeymap->vRegister(m_uiStart, KeyStart );
|
||||
poKeymap->vRegister(m_uiSpeed, KeySpeed );
|
||||
poKeymap->vRegister(m_uiCapture, KeyCapture );
|
||||
oKeymap[m_uiUp] = KeyUp;
|
||||
oKeymap[m_uiDown] = KeyDown;
|
||||
oKeymap[m_uiLeft] = KeyLeft;
|
||||
oKeymap[m_uiRight] = KeyRight;
|
||||
oKeymap[m_uiA] = KeyA;
|
||||
oKeymap[m_uiB] = KeyB;
|
||||
oKeymap[m_uiL] = KeyL;
|
||||
oKeymap[m_uiR] = KeyR;
|
||||
oKeymap[m_uiSelect] = KeySelect;
|
||||
oKeymap[m_uiStart] = KeyStart;
|
||||
oKeymap[m_uiSpeed] = KeySpeed;
|
||||
oKeymap[m_uiCapture] = KeyCapture;
|
||||
|
||||
return poKeymap;
|
||||
return oKeymap;
|
||||
}
|
||||
|
||||
JoypadConfigDialog::JoypadConfigDialog(GtkDialog * _pstDialog,
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
guint * puiAt(int _iIndex);
|
||||
int iFind(guint _uiKeycode);
|
||||
void vSetDefault();
|
||||
Keymap * poCreateKeymap() const;
|
||||
Keymap oCreateKeymap() const;
|
||||
};
|
||||
|
||||
class JoypadConfigDialog : public Gtk::Dialog
|
||||
|
|
|
@ -101,7 +101,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
m_eCartridge = CartridgeNone;
|
||||
m_uiJoypadState = 0;
|
||||
m_uiAutofireState = 0;
|
||||
m_poKeymap = NULL;
|
||||
|
||||
vInitSDL();
|
||||
vInitSystem();
|
||||
|
@ -799,11 +798,6 @@ Window::~Window()
|
|||
delete m_poFileOpenDialog;
|
||||
}
|
||||
|
||||
if (m_poKeymap != NULL)
|
||||
{
|
||||
delete m_poKeymap;
|
||||
}
|
||||
|
||||
m_poInstance = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ private:
|
|||
sigc::connection m_oEmuSig;
|
||||
|
||||
std::vector<JoypadConfig> m_oJoypads;
|
||||
Keymap * m_poKeymap;
|
||||
Keymap m_oKeymap;
|
||||
|
||||
int m_bFullscreen;
|
||||
int m_iScreenWidth;
|
||||
|
|
|
@ -871,11 +871,7 @@ void Window::vOnJoypadConfigure(int _iJoypad)
|
|||
m_oJoypads[_iJoypad - 1] = poDialog->stGetConfig();
|
||||
if (_iJoypad == m_poInputConfig->oGetKey<int>("active_joypad"))
|
||||
{
|
||||
if (m_poKeymap != NULL)
|
||||
{
|
||||
delete m_poKeymap;
|
||||
}
|
||||
m_poKeymap = m_oJoypads[_iJoypad - 1].poCreateKeymap();
|
||||
m_oKeymap = m_oJoypads[_iJoypad - 1].oCreateKeymap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -889,11 +885,7 @@ void Window::vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_poKeymap != NULL)
|
||||
{
|
||||
delete m_poKeymap;
|
||||
}
|
||||
m_poKeymap = m_oJoypads[_iJoypad - 1].poCreateKeymap();
|
||||
m_oKeymap = m_oJoypads[_iJoypad - 1].oCreateKeymap();
|
||||
|
||||
m_poInputConfig->vSetKey("active_joypad", _iJoypad);
|
||||
}
|
||||
|
@ -1181,7 +1173,7 @@ bool Window::on_key_press_event(GdkEventKey * _pstEvent)
|
|||
}
|
||||
|
||||
if ((_pstEvent->state & Gtk::AccelGroup::get_default_mod_mask())
|
||||
|| (eKey = m_poKeymap->eGetKey(_pstEvent->hardware_keycode)) == KeyNone)
|
||||
|| (eKey = m_oKeymap[_pstEvent->hardware_keycode]) == KeyNone)
|
||||
{
|
||||
return Gtk::Window::on_key_press_event(_pstEvent);
|
||||
}
|
||||
|
@ -1239,7 +1231,7 @@ bool Window::on_key_release_event(GdkEventKey * _pstEvent)
|
|||
EKey eKey;
|
||||
|
||||
if ((_pstEvent->state & Gtk::AccelGroup::get_default_mod_mask())
|
||||
|| (eKey = m_poKeymap->eGetKey(_pstEvent->hardware_keycode)) == KeyNone)
|
||||
|| (eKey = m_oKeymap[_pstEvent->hardware_keycode]) == KeyNone)
|
||||
{
|
||||
return Gtk::Window::on_key_release_event(_pstEvent);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue