Somethin'
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1777 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b2e96e1ca5
commit
94fb0dc220
|
@ -4,54 +4,51 @@
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key)
|
EventHandler::EventHandler() {
|
||||||
{
|
memset(keys, sizeof(listenFuncPtr) * (sf::Key::Escape+1)*8, 0);
|
||||||
if (key.inputType == KeyboardInput)
|
memset(mouse, sizeof(listenFuncPtr) * (sf::Mouse::Count+1), 0);
|
||||||
{
|
memset(joys, sizeof(listenFuncPtr) * (sf::Joy::Count+1), 0);
|
||||||
if (keys[key.keyCode][key.mods])
|
}
|
||||||
return false;
|
|
||||||
keys[key.keyCode][key.mods] = func;
|
bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key) {
|
||||||
}
|
if (key.inputType == KeyboardInput) {
|
||||||
else if (key.inputType == MouseInput)
|
fprintf(stderr, "Registering %d\n", key.keyCode);
|
||||||
{
|
if (key.keyCode == sf::Key::Count ||
|
||||||
if (mouse[key.mouseButton])
|
key.keyCode >= sf::Key::Escape || keys[key.keyCode][key.mods])
|
||||||
return false;
|
return false;
|
||||||
mouse[key.mouseButton] = func;
|
keys[key.keyCode][key.mods] = func;
|
||||||
|
} else if (key.inputType == MouseInput) {
|
||||||
|
if (mouse[key.mouseButton])
|
||||||
|
return false;
|
||||||
|
mouse[key.mouseButton] = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventHandler::RemoveEventListener(Keys key)
|
bool EventHandler::RemoveEventListener(Keys key) {
|
||||||
{
|
if (key.inputType == KeyboardInput) {
|
||||||
if (key.inputType == KeyboardInput)
|
if ((key.keyCode == sf::Key::Count || key.keyCode >= sf::Key::Escape) && ! keys[key.keyCode][key.mods])
|
||||||
{
|
return false;
|
||||||
if (! keys[key.keyCode][key.mods])
|
keys[key.keyCode][key.mods] = NULL;
|
||||||
return false;
|
} else if (key.inputType == MouseInput) {
|
||||||
keys[key.keyCode][key.mods] = NULL;
|
if (! mouse[key.mouseButton])
|
||||||
}
|
return false;
|
||||||
else if (key.inputType == MouseInput)
|
mouse[key.mouseButton] = NULL;
|
||||||
{
|
|
||||||
if (! mouse[key.mouseButton])
|
|
||||||
return false;
|
|
||||||
mouse[key.mouseButton] = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventHandler::Update()
|
void EventHandler::Update() {
|
||||||
{
|
for (unsigned int i = 0; i < eventQueue.size();i++) {
|
||||||
for (unsigned int i = 0; i < eventQueue.size();i++)
|
sf::Event ev = eventQueue.front();
|
||||||
{
|
eventQueue.pop();
|
||||||
sf::Event ev = eventQueue.front();
|
keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control](ev);
|
||||||
eventQueue.pop();
|
|
||||||
keys[ev.Key.Code][ev.Key.Alt+2*ev.Key.Shift+4*ev.Key.Control](ev);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventHandler::addEvent(sf::Event *ev)
|
bool EventHandler::addEvent(sf::Event *ev) {
|
||||||
{
|
|
||||||
eventQueue.push(*ev);
|
eventQueue.push(*ev);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +159,7 @@ sf::Key::Code EventHandler::wxCharCodeToSF(int id)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr)
|
void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr) {
|
||||||
{
|
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
/* case sf::Key::A = 'a': sprintf(keyStr, "UP"); break;
|
/* case sf::Key::A = 'a': sprintf(keyStr, "UP"); break;
|
||||||
case sf::Key::B = 'b': sprintf(keyStr, "UP"); break;
|
case sf::Key::B = 'b': sprintf(keyStr, "UP"); break;
|
||||||
|
@ -266,6 +262,11 @@ void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr)
|
||||||
case sf::Key::F14: sprintf(keyStr, "F14"); break;
|
case sf::Key::F14: sprintf(keyStr, "F14"); break;
|
||||||
case sf::Key::F15: sprintf(keyStr, "F15"); break;
|
case sf::Key::F15: sprintf(keyStr, "F15"); break;
|
||||||
case sf::Key::Pause: sprintf(keyStr, "Paues"); break;
|
case sf::Key::Pause: sprintf(keyStr, "Paues"); break;
|
||||||
default: sprintf(keyStr, "%c", keycode);
|
default:
|
||||||
|
if (keycode > sf::Key::Escape)
|
||||||
|
sprintf(keyStr, "Invalid Key");
|
||||||
|
else
|
||||||
|
sprintf(keyStr, "%c", keycode);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@ enum InputType
|
||||||
JoystickInput
|
JoystickInput
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Modifiers
|
enum Modifiers {
|
||||||
{
|
|
||||||
UseAlt = 1,
|
UseAlt = 1,
|
||||||
UseShift = 2,
|
UseShift = 2,
|
||||||
UseCtrl = 4
|
UseCtrl = 4
|
||||||
|
@ -28,15 +27,15 @@ struct Keys
|
||||||
sf::Mouse::Button mouseButton;
|
sf::Mouse::Button mouseButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventHandler
|
class EventHandler {
|
||||||
{
|
|
||||||
private:
|
|
||||||
listenFuncPtr keys[sf::Key::Count][8];
|
|
||||||
listenFuncPtr mouse[sf::Mouse::Count];
|
|
||||||
listenFuncPtr joys[sf::Joy::Count];
|
|
||||||
std::queue<sf::Event> eventQueue;
|
|
||||||
|
|
||||||
public:
|
private:
|
||||||
|
listenFuncPtr keys[sf::Key::Escape+1][8];
|
||||||
|
listenFuncPtr mouse[sf::Mouse::Count+1];
|
||||||
|
listenFuncPtr joys[sf::Joy::Count+1];
|
||||||
|
std::queue<sf::Event> eventQueue;
|
||||||
|
public:
|
||||||
|
EventHandler();
|
||||||
bool RegisterEventListener(listenFuncPtr func, Keys key);
|
bool RegisterEventListener(listenFuncPtr func, Keys key);
|
||||||
bool RemoveEventListener(Keys key);
|
bool RemoveEventListener(Keys key);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
|
@ -4,17 +4,13 @@ EventHandler *eventHandler = NULL;
|
||||||
|
|
||||||
namespace InputCommon
|
namespace InputCommon
|
||||||
{
|
{
|
||||||
void Init()
|
void Init() {
|
||||||
{
|
// init the event handler
|
||||||
#if defined GLTEST && GLTEST
|
eventHandler = new EventHandler();
|
||||||
// init the event handler
|
}
|
||||||
eventHandler = new EventHandler();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown() {
|
||||||
{
|
if (eventHandler)
|
||||||
if (eventHandler)
|
delete eventHandler;
|
||||||
delete eventHandler;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,133 +65,128 @@ ConfigDialog::~ConfigDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
|
inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
|
||||||
const char *name, int ctl, int controller)
|
const char *name, int ctl, int controller) {
|
||||||
{
|
wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
|
||||||
wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
|
char keyStr[10] = {0};
|
||||||
char keyStr[10] = {0};
|
|
||||||
|
|
||||||
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
||||||
wxDefaultPosition, wxDefaultSize), 0,
|
wxDefaultPosition, wxDefaultSize), 0,
|
||||||
wxALIGN_CENTER_VERTICAL|wxALL);
|
wxALIGN_CENTER_VERTICAL|wxALL);
|
||||||
EventHandler::SFKeyToString(pad[controller].keyForControl[ctl], keyStr);
|
EventHandler::SFKeyToString(pad[controller].keyForControl[ctl], keyStr);
|
||||||
|
|
||||||
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
|
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
|
||||||
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
||||||
|
|
||||||
hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL);
|
hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL);
|
||||||
|
|
||||||
sizer->Add(hButton, 0, wxALIGN_RIGHT|wxALL);
|
sizer->Add(hButton, 0, wxALIGN_RIGHT|wxALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::CreateGUIControls()
|
void ConfigDialog::CreateGUIControls() {
|
||||||
{
|
// Notebook
|
||||||
// Notebook
|
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
||||||
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
|
||||||
|
|
||||||
// Controller pages
|
// Controller pages
|
||||||
m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
|
m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
|
||||||
m_Notebook->AddPage(m_Controller[0], wxT("Controller 1"));
|
m_Notebook->AddPage(m_Controller[0], wxT("Controller 1"));
|
||||||
m_Controller[1] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE2, wxDefaultPosition, wxDefaultSize);
|
m_Controller[1] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE2, wxDefaultPosition, wxDefaultSize);
|
||||||
m_Notebook->AddPage(m_Controller[1], wxT("Controller 2"));
|
m_Notebook->AddPage(m_Controller[1], wxT("Controller 2"));
|
||||||
m_Controller[2] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE3, wxDefaultPosition, wxDefaultSize);
|
m_Controller[2] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE3, wxDefaultPosition, wxDefaultSize);
|
||||||
m_Notebook->AddPage(m_Controller[2], wxT("Controller 3"));
|
m_Notebook->AddPage(m_Controller[2], wxT("Controller 3"));
|
||||||
m_Controller[3] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE4, wxDefaultPosition, wxDefaultSize);
|
m_Controller[3] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE4, wxDefaultPosition, wxDefaultSize);
|
||||||
m_Notebook->AddPage(m_Controller[3], wxT("Controller 4"));
|
m_Notebook->AddPage(m_Controller[3], wxT("Controller 4"));
|
||||||
|
|
||||||
// Standard buttons
|
// Standard buttons
|
||||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
m_About = new wxButton(this, ID_PAD_ABOUT, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_About = new wxButton(this, ID_PAD_ABOUT, wxT("About"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
|
||||||
// Put notebook and standard buttons in sizers
|
// Put notebook and standard buttons in sizers
|
||||||
wxBoxSizer* sSButtons;
|
wxBoxSizer* sSButtons;
|
||||||
sSButtons = new wxBoxSizer(wxHORIZONTAL);
|
sSButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sSButtons->Add(m_About,0,wxALL, 5);
|
sSButtons->Add(m_About,0,wxALL, 5);
|
||||||
sSButtons->Add(0, 0, 1, wxEXPAND, 5);
|
sSButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||||
sSButtons->Add(m_Close, 0, wxALL, 5);
|
sSButtons->Add(m_Close, 0, wxALL, 5);
|
||||||
|
|
||||||
wxBoxSizer* sMain;
|
wxBoxSizer* sMain;
|
||||||
sMain = new wxBoxSizer(wxVERTICAL);
|
sMain = new wxBoxSizer(wxVERTICAL);
|
||||||
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
|
sMain->Add(m_Notebook, 1, wxEXPAND|wxALL, 5);
|
||||||
sMain->Add(sSButtons, 0, wxEXPAND, 5);
|
sMain->Add(sSButtons, 0, wxEXPAND, 5);
|
||||||
|
|
||||||
this->SetSizer(sMain);
|
this->SetSizer(sMain);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++) {
|
||||||
{
|
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
|
||||||
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
|
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
|
m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
m_Attached[i] = new wxCheckBox(m_Controller[i], ID_ATTACHED, wxT("Controller attached"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_Attached[i]->SetValue(pad[i].bAttached);
|
||||||
m_Attached[i]->SetValue(pad[i].bAttached);
|
m_Disable[i]->SetValue(pad[i].bDisable);
|
||||||
m_Disable[i]->SetValue(pad[i].bDisable);
|
|
||||||
|
|
||||||
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
|
||||||
sDevice[i]->AddStretchSpacer();
|
sDevice[i]->AddStretchSpacer();
|
||||||
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
|
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
|
||||||
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
|
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
|
||||||
|
|
||||||
sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons"));
|
sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons"));
|
||||||
|
|
||||||
AddControl(m_Controller[i], &(m_ButtonA[i]), sButtons[i], "A: ", CTL_A, i);
|
AddControl(m_Controller[i], &(m_ButtonA[i]), sButtons[i], "A: ", CTL_A, i);
|
||||||
AddControl(m_Controller[i], &(m_ButtonB[i]), sButtons[i], "B: ", CTL_B, i);
|
AddControl(m_Controller[i], &(m_ButtonB[i]), sButtons[i], "B: ", CTL_B, i);
|
||||||
AddControl(m_Controller[i], &(m_ButtonX[i]), sButtons[i], "X: ", CTL_X, i);
|
AddControl(m_Controller[i], &(m_ButtonX[i]), sButtons[i], "X: ", CTL_X, i);
|
||||||
AddControl(m_Controller[i], &(m_ButtonY[i]), sButtons[i], "Y: ", CTL_Y, i);
|
AddControl(m_Controller[i], &(m_ButtonY[i]), sButtons[i], "Y: ", CTL_Y, i);
|
||||||
AddControl(m_Controller[i], &(m_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i);
|
AddControl(m_Controller[i], &(m_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i);
|
||||||
AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i);
|
AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i);
|
||||||
|
|
||||||
sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers"));
|
sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers"));
|
||||||
|
|
||||||
AddControl(m_Controller[i], &(m_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i);
|
AddControl(m_Controller[i], &(m_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i);
|
||||||
AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i);
|
AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i);
|
||||||
|
|
||||||
sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers"));
|
sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers"));
|
||||||
|
|
||||||
AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i);
|
AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i);
|
||||||
|
|
||||||
sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick"));
|
sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick"));
|
||||||
|
|
||||||
AddControl(m_Controller[i], &(m_StickUp[i]), sStick[i], "Up: ", CTL_MAINUP, i);
|
AddControl(m_Controller[i], &(m_StickUp[i]), sStick[i], "Up: ", CTL_MAINUP, i);
|
||||||
AddControl(m_Controller[i], &(m_StickDown[i]), sStick[i], "Down: ", CTL_MAINDOWN, i);
|
AddControl(m_Controller[i], &(m_StickDown[i]), sStick[i], "Down: ", CTL_MAINDOWN, i);
|
||||||
AddControl(m_Controller[i], &(m_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i);
|
AddControl(m_Controller[i], &(m_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i);
|
||||||
AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, i);
|
AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, i);
|
||||||
|
|
||||||
sDPad[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("D-Pad"));
|
sDPad[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("D-Pad"));
|
||||||
|
|
||||||
AddControl(m_Controller[i], &(m_DPadUp[i]), sDPad[i], "Up: ", CTL_DPADUP, i);
|
AddControl(m_Controller[i], &(m_DPadUp[i]), sDPad[i], "Up: ", CTL_DPADUP, i);
|
||||||
AddControl(m_Controller[i], &(m_DPadDown[i]), sDPad[i], "Down: ", CTL_DPADDOWN, i);
|
AddControl(m_Controller[i], &(m_DPadDown[i]), sDPad[i], "Down: ", CTL_DPADDOWN, i);
|
||||||
AddControl(m_Controller[i], &(m_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i);
|
AddControl(m_Controller[i], &(m_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i);
|
||||||
AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, i);
|
AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, i);
|
||||||
|
|
||||||
sCStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("C-Stick"));
|
sCStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("C-Stick"));
|
||||||
|
|
||||||
AddControl(m_Controller[i], &(m_CStickUp[i]), sCStick[i], "Up: ", CTL_SUBUP, i);
|
AddControl(m_Controller[i], &(m_CStickUp[i]), sCStick[i], "Up: ", CTL_SUBUP, i);
|
||||||
AddControl(m_Controller[i], &(m_CStickDown[i]), sCStick[i], "Down: ", CTL_SUBDOWN, i);
|
AddControl(m_Controller[i], &(m_CStickDown[i]), sCStick[i], "Down: ", CTL_SUBDOWN, i);
|
||||||
AddControl(m_Controller[i], &(m_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i);
|
AddControl(m_Controller[i], &(m_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i);
|
||||||
AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i);
|
AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i);
|
||||||
|
|
||||||
sPage[i] = new wxGridBagSizer(0, 0);
|
sPage[i] = new wxGridBagSizer(0, 0);
|
||||||
sPage[i]->SetFlexibleDirection(wxBOTH);
|
sPage[i]->SetFlexibleDirection(wxBOTH);
|
||||||
sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||||
sPage[i]->Add(sbDevice[i], wxGBPosition(0, 0), wxGBSpan(1, 5), wxEXPAND|wxALL, 1);
|
sPage[i]->Add(sbDevice[i], wxGBPosition(0, 0), wxGBSpan(1, 5), wxEXPAND|wxALL, 1);
|
||||||
sPage[i]->Add(sButtons[i], wxGBPosition(1, 0), wxGBSpan(2, 1), wxALL, 1);
|
sPage[i]->Add(sButtons[i], wxGBPosition(1, 0), wxGBSpan(2, 1), wxALL, 1);
|
||||||
sPage[i]->Add(sTriggers[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 1);
|
sPage[i]->Add(sTriggers[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 1);
|
||||||
sPage[i]->Add(sModifiers[i], wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 1);
|
sPage[i]->Add(sModifiers[i], wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 1);
|
||||||
sPage[i]->Add(sStick[i], wxGBPosition(1, 2), wxGBSpan(2, 1), wxALL, 1);
|
sPage[i]->Add(sStick[i], wxGBPosition(1, 2), wxGBSpan(2, 1), wxALL, 1);
|
||||||
sPage[i]->Add(sDPad[i], wxGBPosition(1, 3), wxGBSpan(2, 1), wxALL, 1);
|
sPage[i]->Add(sDPad[i], wxGBPosition(1, 3), wxGBSpan(2, 1), wxALL, 1);
|
||||||
sPage[i]->Add(sCStick[i], wxGBPosition(1, 4), wxGBSpan(2, 1), wxALL, 1);
|
sPage[i]->Add(sCStick[i], wxGBPosition(1, 4), wxGBSpan(2, 1), wxALL, 1);
|
||||||
m_Controller[i]->SetSizer(sPage[i]);
|
m_Controller[i]->SetSizer(sPage[i]);
|
||||||
sPage[i]->Layout();
|
sPage[i]->Layout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::OnClose(wxCloseEvent& event)
|
void ConfigDialog::OnClose(wxCloseEvent& event) {
|
||||||
{
|
EndModal(0);
|
||||||
EndModal(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::OnKeyDown(wxKeyEvent& event)
|
void ConfigDialog::OnKeyDown(wxKeyEvent& event) {
|
||||||
{
|
|
||||||
if(clickedButton != NULL) {
|
if(clickedButton != NULL) {
|
||||||
int page = m_Notebook->GetSelection();
|
int page = m_Notebook->GetSelection();
|
||||||
|
|
||||||
|
@ -211,37 +206,35 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
|
||||||
|
|
||||||
void ConfigDialog::OnCloseClick(wxCommandEvent& event)
|
void ConfigDialog::OnCloseClick(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
|
void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
int page = m_Notebook->GetSelection();
|
int page = m_Notebook->GetSelection();
|
||||||
|
|
||||||
switch (event.GetId())
|
switch (event.GetId()) {
|
||||||
{
|
case ID_ATTACHED:
|
||||||
case ID_ATTACHED:
|
pad[page].bAttached = m_Attached[page]->GetValue();
|
||||||
pad[page].bAttached = m_Attached[page]->GetValue();
|
break;
|
||||||
break;
|
case ID_DISABLE:
|
||||||
case ID_DISABLE:
|
pad[page].bDisable = m_Disable[page]->GetValue();
|
||||||
pad[page].bDisable = m_Disable[page]->GetValue();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::OnButtonClick(wxCommandEvent& event)
|
void ConfigDialog::OnButtonClick(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if(clickedButton)
|
if(clickedButton) {
|
||||||
{
|
clickedButton->SetLabel(oldLabel);
|
||||||
clickedButton->SetLabel(oldLabel);
|
}
|
||||||
}
|
clickedButton = (wxButton *)event.GetEventObject();
|
||||||
clickedButton = (wxButton *)event.GetEventObject();
|
oldLabel = clickedButton->GetLabel();
|
||||||
oldLabel = clickedButton->GetLabel();
|
clickedButton->SetLabel(_("Press Key"));
|
||||||
clickedButton->SetLabel(_("Press Key"));
|
|
||||||
|
|
||||||
clickedButton->Connect(wxID_ANY, wxEVT_KEY_DOWN,
|
clickedButton->Connect(wxID_ANY, wxEVT_KEY_DOWN,
|
||||||
wxKeyEventHandler(ConfigDialog::OnKeyDown),
|
wxKeyEventHandler(ConfigDialog::OnKeyDown),
|
||||||
(wxObject*)NULL, this);
|
(wxObject*)NULL, this);
|
||||||
}
|
}
|
||||||
void ConfigDialog::DllAbout(wxCommandEvent& event)
|
void ConfigDialog::DllAbout(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -378,8 +378,8 @@ void LoadConfig()
|
||||||
file.Get(SectionName, controlNames[x],
|
file.Get(SectionName, controlNames[x],
|
||||||
&key, (i==0)?defaultKeyForControl[x]:0);
|
&key, (i==0)?defaultKeyForControl[x]:0);
|
||||||
|
|
||||||
pad[i].keyForControl[x] = (sf::Key::Code)key;
|
// pad[i].keyForControl[x] = (sf::Key::Code)key;
|
||||||
|
registerKey(i, x, (sf::Key::Code)key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue