diff --git a/src/wx/InputConfig.cpp b/src/wx/InputConfig.cpp index 104adc73..9ed9dfc8 100644 --- a/src/wx/InputConfig.cpp +++ b/src/wx/InputConfig.cpp @@ -22,7 +22,8 @@ wxBEGIN_EVENT_TABLE(InputConfigDialog, wxDialog) - EVT_COMMAND(1001, wxEVT_BUTTON, InputConfigDialog::OnDerp) + EVT_COMMAND(1001, wxEVT_BUTTON, InputConfigDialog::OnOk) + EVT_COMMAND(1002, wxEVT_BUTTON, InputConfigDialog::OnCancel) EVT_TIMER(wxID_ANY, InputConfigDialog::OnPoll) wxEND_EVENT_TABLE() @@ -141,22 +142,21 @@ InputConfigDialog::InputConfigDialog(wxWindow* parent) p->SetSizer(sizer); vboxmain->Add(p, 0, wxALL&(~wxBOTTOM), 15); } -wxButton* boobs; + { wxPanel* p = new wxPanel(this); wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); - //keycatcher = new wxButton(p, wxID_ANY, "pancake"); keycatcher = new wxPanel(p, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); sizer->Add(keycatcher); keycatcher->Show(false); - wxButton* derp = new wxButton(p, 1001, "derp"); - sizer->Add(derp); + wxButton* ok = new wxButton(p, 1001, "OK"); + sizer->Add(ok); - boobs = new wxButton(p, 1002, "boobs"); + wxButton* cancel = new wxButton(p, 1002, "Cancel"); sizer->Add(3, 0); - sizer->Add(boobs); + sizer->Add(cancel); p->SetSizer(sizer); vboxmain->Add(p, 0, wxALL|wxALIGN_RIGHT, 15); @@ -186,9 +186,18 @@ InputConfigDialog::~InputConfigDialog() SDL_DestroyWindow(sdlwin); } -void InputConfigDialog::OnDerp(wxCommandEvent& event) +void InputConfigDialog::OnOk(wxCommandEvent& event) { - printf("OnDerp %d\n", event.GetId()); + memcpy(Config::KeyMapping, keymapping, 12*sizeof(int)); + memcpy(Config::JoyMapping, joymapping, 12*sizeof(int)); + Config::Save(); + + Close(); +} + +void InputConfigDialog::OnCancel(wxCommandEvent& event) +{ + Close(); } // black magic going on there @@ -342,12 +351,6 @@ void InputConfigDialog::OnPoll(wxTimerEvent& event) } } -void InputConfigDialog::OnKeyDown(wxKeyEvent& event) -{ - printf("!!\n"); - event.Skip(); -} - void InputConfigDialog::OnFancybuttonHover(wxMouseEvent& event) { wxStaticText* btn = (wxStaticText*)this; diff --git a/src/wx/InputConfig.h b/src/wx/InputConfig.h index 35d1e3f6..adf8dec3 100644 --- a/src/wx/InputConfig.h +++ b/src/wx/InputConfig.h @@ -35,7 +35,8 @@ public: private: wxDECLARE_EVENT_TABLE(); - void OnDerp(wxCommandEvent& event); + void OnOk(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); void OnConfigureKey(wxMouseEvent& event); void OnConfigureJoy(wxMouseEvent& event);