aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-03-23 23:38:40 +0100
committerStapleButter <thetotalworm@gmail.com>2017-03-23 23:38:40 +0100
commit49314244e1f3923304bc731a691d2c3222f92627 (patch)
treebe2ca1c3672333a69fb595bc27e13ed65ab72b89 /src
parentf237afeb66d45220ae0061c1dd8a35eb0335e8b0 (diff)
start work on the input config dialog. nonfunctional and looks like shit.
add manifest crap under Windows so it gets the cool controls.
Diffstat (limited to 'src')
-rw-r--r--src/wx/InputConfig.cpp81
-rw-r--r--src/wx/InputConfig.h39
-rw-r--r--src/wx/main.cpp10
-rw-r--r--src/wx/main.h2
4 files changed, 132 insertions, 0 deletions
diff --git a/src/wx/InputConfig.cpp b/src/wx/InputConfig.cpp
new file mode 100644
index 0000000..ea5f1c8
--- /dev/null
+++ b/src/wx/InputConfig.cpp
@@ -0,0 +1,81 @@
+/*
+ Copyright 2016-2017 StapleButter
+
+ This file is part of melonDS.
+
+ melonDS 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 3 of the License, or (at your option)
+ any later version.
+
+ melonDS 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 melonDS. If not, see http://www.gnu.org/licenses/.
+*/
+
+#include "../types.h"
+#include "InputConfig.h"
+#include "../Config.h"
+
+
+wxBEGIN_EVENT_TABLE(InputConfigDialog, wxDialog)
+wxEND_EVENT_TABLE()
+
+
+InputConfigDialog::InputConfigDialog(wxWindow* parent)
+ : wxDialog(parent, -1, "Input configuration - melonDS")
+{
+ int keyorder[12] = {0, 1, 10, 11, 5, 4, 6, 7, 9, 8, 3, 2};
+ char keylabels[12][8] = {"A:", "B:", "Select:", "Start:", "Right:", "Left:", "Up:", "Down:", "R:", "L:", "X:", "Y:"};
+
+ wxBoxSizer* vboxmain = new wxBoxSizer(wxVERTICAL);
+
+ {
+ wxPanel* p = new wxPanel(this);
+ wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
+
+ wxStaticBox* kbdside = new wxStaticBox(p, wxID_ANY, "Keyboard");
+ {
+ wxGridSizer* grid = new wxGridSizer(2, 3, 0);
+
+ for (int i = 0; i < 12; i++)
+ {
+ int j = keyorder[i];
+
+ wxStaticText* label = new wxStaticText(kbdside, wxID_ANY, keylabels[j]);
+ grid->Add(label);
+
+ const char* keyname = SDL_GetKeyName(SDL_GetKeyFromScancode((SDL_Scancode)Config::KeyMapping[j]));
+ wxButton* btn = new wxButton(kbdside, 100+i, keyname);
+ grid->Add(btn);
+ }
+
+ kbdside->SetSizer(grid);
+ }
+ sizer->Add(kbdside);
+
+ p->SetSizer(sizer);
+ vboxmain->Add(p, 0, wxALL&(~wxBOTTOM), 15);
+ }
+
+ {
+ wxPanel* p = new wxPanel(this);
+ wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
+
+ wxButton* derp = new wxButton(p, 1001, "derp");
+ sizer->Add(derp);
+
+ wxButton* boobs = new wxButton(p, 1002, "boobs");
+ sizer->Add(3, 0);
+ sizer->Add(boobs);
+
+ p->SetSizer(sizer);
+ vboxmain->Add(p, 0, wxALL|wxALIGN_RIGHT, 15);
+ }
+
+ SetSizer(vboxmain);
+ Fit();
+}
diff --git a/src/wx/InputConfig.h b/src/wx/InputConfig.h
new file mode 100644
index 0000000..c0a60e7
--- /dev/null
+++ b/src/wx/InputConfig.h
@@ -0,0 +1,39 @@
+/*
+ Copyright 2016-2017 StapleButter
+
+ This file is part of melonDS.
+
+ melonDS 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 3 of the License, or (at your option)
+ any later version.
+
+ melonDS 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 melonDS. If not, see http://www.gnu.org/licenses/.
+*/
+
+#ifndef WX_INPUTCONFIG_H
+#define WX_INPUTCONFIG_H
+
+#include <wx/wxprec.h>
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include <SDL2/SDL.h>
+
+class InputConfigDialog : public wxDialog
+{
+public:
+ InputConfigDialog(wxWindow* parent);
+
+private:
+ wxDECLARE_EVENT_TABLE();
+};
+
+#endif // WX_INPUTCONFIG_H
+
diff --git a/src/wx/main.cpp b/src/wx/main.cpp
index b4813af..058808f 100644
--- a/src/wx/main.cpp
+++ b/src/wx/main.cpp
@@ -23,6 +23,8 @@
#include "../NDS.h"
#include "../GPU.h"
+#include "InputConfig.h"
+
bool Touching;
@@ -58,6 +60,8 @@ wxBEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(ID_OPENROM, MainFrame::OnOpenROM)
EVT_MENU(ID_EXIT, MainFrame::OnCloseFromMenu)
+ EVT_MENU(ID_INPUTCONFIG, MainFrame::OnInputConfig)
+
EVT_PAINT(MainFrame::OnPaint)
EVT_IDLE(MainFrame::OnIdle)
wxEND_EVENT_TABLE()
@@ -179,6 +183,12 @@ void MainFrame::OnOpenROM(wxCommandEvent& event)
emustatuschangemutex->Unlock();
}
+void MainFrame::OnInputConfig(wxCommandEvent& event)
+{
+ InputConfigDialog dlg(this);
+ dlg.ShowModal();
+}
+
void MainFrame::ProcessSDLEvents()
{
bool running = (emustatus == 1);
diff --git a/src/wx/main.h b/src/wx/main.h
index f60e381..c05a8a0 100644
--- a/src/wx/main.h
+++ b/src/wx/main.h
@@ -73,6 +73,8 @@ private:
void OnCloseFromMenu(wxCommandEvent& event);
void OnOpenROM(wxCommandEvent& event);
+ void OnInputConfig(wxCommandEvent& event);
+
void ProcessSDLEvents();
void OnPaint(wxPaintEvent& event);