nJoy: Enabled keyboard input (only for buttons so far) through wxWidgets in the main application. It only works when you render to the main window.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1706 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-12-28 18:50:24 +00:00
parent de7abc6bd0
commit 5e5e507121
20 changed files with 460 additions and 153 deletions

View File

@ -31,6 +31,7 @@
#include "Config.h" // Core
#include "Core.h"
#include "HW/DVDInterface.h"
#include "Plugins/Plugin_PAD.h"
#include "State.h"
#include "VolumeHandler.h"
@ -172,6 +173,10 @@ CFrame::CFrame(wxFrame* parent,
wxKeyEventHandler(CFrame::OnKeyDown),
(wxObject*)0, this);
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP,
wxKeyEventHandler(CFrame::OnKeyUp),
(wxObject*)0, this);
UpdateGUI();
}
@ -506,7 +511,7 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
{
// Ask for confirmation in case the user accidently clicked Stop
int answer;
bool answer;
if(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{
answer = AskYesNo("Are you sure you want to stop the current emulation?",
@ -514,10 +519,10 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
}
else
{
answer = wxYES;
answer = true;
}
if (answer == wxYES && Core::GetState() != Core::CORE_UNINITIALIZED)
if (answer && Core::GetState() != Core::CORE_UNINITIALIZED)
{
Core::Stop();
UpdateGUI();
@ -690,8 +695,18 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
#endif
else
{
if(Core::GetState() != Core::CORE_UNINITIALIZED)
PluginPAD::PAD_Input(event.GetKeyCode(), 1); // 1 = Down
event.Skip();
}
//if(event.GetKeyCode() == 80) PanicAlert("Core 80");
}
void CFrame::OnKeyUp(wxKeyEvent& event)
{
if(Core::GetState() != Core::CORE_UNINITIALIZED)
PluginPAD::PAD_Input(event.GetKeyCode(), 0); // 0 = Up
event.Skip();
}