mirror of https://github.com/PCSX2/pcsx2.git
recording:gui: Overhaul VirtualPad GUIs
This commit is contained in:
parent
3d6bfacd55
commit
db4ff1e8fc
|
@ -6,6 +6,7 @@
|
|||
|
||||
PadData::PadData()
|
||||
{
|
||||
// TODO - multi-tap support eventually?
|
||||
for (int port = 0; port < 2; port++)
|
||||
{
|
||||
buf[port][0] = 255;
|
||||
|
@ -177,6 +178,7 @@ int PadData::getNormalButton(int port, wxString button)const
|
|||
|
||||
void PadData::getKeyBit(wxByte keybit[2], wxString button)const
|
||||
{
|
||||
// TODO - switch statement or search array?
|
||||
if (button == L"up") { keybit[0] = 0b00010000; keybit[1] = 0b00000000; }
|
||||
else if (button == L"left") { keybit[0] = 0b10000000; keybit[1] = 0b00000000; }
|
||||
else if (button == L"right") { keybit[0] = 0b00100000; keybit[1] = 0b00000000; }
|
||||
|
@ -185,7 +187,7 @@ void PadData::getKeyBit(wxByte keybit[2], wxString button)const
|
|||
else if (button == L"start") { keybit[0] = 0b00001000; keybit[1] = 0b00000000; }
|
||||
else if (button == L"select") { keybit[0] = 0b00000001; keybit[1] = 0b00000000; }
|
||||
|
||||
else if (button == L"x") { keybit[0] = 0b00000000; keybit[1] = 0b01000000; }
|
||||
else if (button == L"cross") { keybit[0] = 0b00000000; keybit[1] = 0b01000000; }
|
||||
else if (button == L"circle") { keybit[0] = 0b00000000; keybit[1] = 0b00100000; }
|
||||
else if (button == L"square") { keybit[0] = 0b00000000; keybit[1] = 0b10000000; }
|
||||
else if (button == L"triangle") { keybit[0] = 0b00000000; keybit[1] = 0b00010000; }
|
||||
|
@ -209,13 +211,13 @@ int PadData::getPressureByte(wxString button)const
|
|||
{
|
||||
// button order
|
||||
// R - L - U - D - Tri - Sqr - Circle - Cross - L1 - R1 - L2 - R2
|
||||
|
||||
// TODO - switch statement or search array?
|
||||
if (button == L"up") { return 2; }
|
||||
else if (button == L"left") { return 1; }
|
||||
else if (button == L"right") { return 0; }
|
||||
else if (button == L"down") { return 3; }
|
||||
|
||||
else if (button == L"x") { return 6; }
|
||||
else if (button == L"cross") { return 6; }
|
||||
else if (button == L"circle") { return 5; }
|
||||
else if (button == L"square") { return 7; }
|
||||
else if (button == L"triangle") { return 4; }
|
||||
|
@ -226,7 +228,7 @@ int PadData::getPressureByte(wxString button)const
|
|||
else if (button == L"r2") { return 11; }
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,19 +258,19 @@ void PadData::setAnalogButton(int port, wxString button, int push)
|
|||
if (push < 0)push = 0;
|
||||
else if (push > 255)push = 255;
|
||||
|
||||
if (button == L"l_leftright") { buf[port][4] = push; }
|
||||
else if (button == L"l_updown") { buf[port][5] = push; }
|
||||
else if (button == L"r_leftright") { buf[port][2] = push; }
|
||||
else if (button == L"r_updown") { buf[port][3] = push; }
|
||||
if (button == L"l_analog_x") { buf[port][4] = push; }
|
||||
else if (button == L"l_analog_y") { buf[port][5] = push; }
|
||||
else if (button == L"r_analog_x") { buf[port][2] = push; }
|
||||
else if (button == L"r_analog_y") { buf[port][3] = push; }
|
||||
}
|
||||
|
||||
int PadData::getAnalogButton(int port, wxString button)const
|
||||
{
|
||||
if (port < 0 || 1 < port)return 0;
|
||||
int val = 127;
|
||||
if (button == L"l_leftright") { val = buf[port][4]; }
|
||||
else if (button == L"l_updown") { val = buf[port][5]; }
|
||||
else if (button == L"r_leftright") { val = buf[port][2]; }
|
||||
else if (button == L"r_updown") { val = buf[port][3]; }
|
||||
if (button == L"l_analog_x") { val = buf[port][4]; }
|
||||
else if (button == L"l_analog_y") { val = buf[port][5]; }
|
||||
else if (button == L"r_analog_x") { val = buf[port][2]; }
|
||||
else if (button == L"r_analog_y") { val = buf[port][3]; }
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -9,27 +9,27 @@ const wxString PadDataNormalKeys[PadDataNormalKeysSize] =
|
|||
"right",
|
||||
"left",
|
||||
"down",
|
||||
"select",
|
||||
"start",
|
||||
"x",
|
||||
"cross",
|
||||
"circle",
|
||||
"square",
|
||||
"triangle",
|
||||
"l1",
|
||||
"l2",
|
||||
"l3",
|
||||
"r1",
|
||||
"r2",
|
||||
"r3"
|
||||
"l3",
|
||||
"r3",
|
||||
"select",
|
||||
"start"
|
||||
};
|
||||
|
||||
#define PadDataAnalogKeysSize 4
|
||||
const wxString PadDataAnalogKeys[PadDataAnalogKeysSize] =
|
||||
{
|
||||
"l_updown",
|
||||
"l_leftright",
|
||||
"r_updown",
|
||||
"r_leftright"
|
||||
"l_analog_x",
|
||||
"l_analog_y",
|
||||
"r_analog_x",
|
||||
"r_analog_y"
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5,172 +5,114 @@
|
|||
#include "Recording/VirtualPad.h"
|
||||
#include "Recording/RecordingInputManager.h"
|
||||
|
||||
enum
|
||||
{
|
||||
// Normal
|
||||
ID_UP = 1,
|
||||
ID_RIGHT,
|
||||
ID_LEFT,
|
||||
ID_DOWN,
|
||||
ID_SELECT,
|
||||
ID_START,
|
||||
ID_X,
|
||||
ID_CIRCLE,
|
||||
ID_SQUARE,
|
||||
ID_TRIANGLE,
|
||||
ID_L1,
|
||||
ID_L2,
|
||||
ID_L3,
|
||||
ID_R1,
|
||||
ID_R2,
|
||||
ID_R3,
|
||||
// Button Pressure
|
||||
ID_UP_PRESSURE,
|
||||
ID_RIGHT_PRESSURE,
|
||||
ID_LEFT_PRESSURE,
|
||||
ID_DOWN_PRESSURE,
|
||||
ID_X_PRESSURE,
|
||||
ID_CIRCLE_PRESSURE,
|
||||
ID_SQUARE_PRESSURE,
|
||||
ID_TRIANGLE_PRESSURE,
|
||||
ID_L1_PRESSURE,
|
||||
ID_L2_PRESSURE,
|
||||
ID_R1_PRESSURE,
|
||||
ID_R2_PRESSURE,
|
||||
// Analog (sliders)
|
||||
ID_L_UPDOWN,
|
||||
ID_L_RIGHTLEFT,
|
||||
ID_R_UPDOWN,
|
||||
ID_R_RIGHTLEFT,
|
||||
// Analog (TextCtrl)
|
||||
ID_L_UPDOWN_TEXT,
|
||||
ID_L_RIGHTLEFT_TEXT,
|
||||
ID_R_UPDOWN_TEXT,
|
||||
ID_R_RIGHTLEFT_TEXT,
|
||||
// Reset
|
||||
ID_RESET
|
||||
};
|
||||
|
||||
wxBEGIN_EVENT_TABLE(VirtualPad, wxFrame)
|
||||
EVT_CLOSE(VirtualPad::OnClose)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
VirtualPad::VirtualPad(wxWindow * parent, int controllerPort)
|
||||
: wxFrame(parent, wxID_ANY, wxString::Format("Virtual Pad %d", controllerPort), wxDefaultPosition, wxSize(600, 520), wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX)),
|
||||
port(controllerPort)
|
||||
// TODO - Problems:
|
||||
// Controller inputs dont update UI, add a refresh method or something
|
||||
VirtualPad::VirtualPad(wxWindow* parent, wxWindowID id, const wxString& title, int controllerPort, const wxPoint& pos, const wxSize& size, long style) :
|
||||
wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
|
||||
{
|
||||
// TODO - needs proper wxFrame design, no hardcoding of coordinates
|
||||
// Define components
|
||||
SetSize(wxSize(1000, 700));
|
||||
l2Button = new wxToggleButton(this, wxID_ANY, wxT("L2"));
|
||||
l2ButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
l1Button = new wxToggleButton(this, wxID_ANY, wxT("L1"));
|
||||
l1ButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
r2Button = new wxToggleButton(this, wxID_ANY, wxT("R2"));
|
||||
r2ButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
r1Button = new wxToggleButton(this, wxID_ANY, wxT("R1"));
|
||||
r1ButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
upButton = new wxToggleButton(this, wxID_ANY, wxT("Up"));
|
||||
upButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
leftButton = new wxToggleButton(this, wxID_ANY, wxT("Left"));
|
||||
leftButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
rightButton = new wxToggleButton(this, wxID_ANY, wxT("Right"));
|
||||
rightButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
downButton = new wxToggleButton(this, wxID_ANY, wxT("Down"));
|
||||
downButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
selectButton = new wxToggleButton(this, wxID_ANY, wxT("Select"));
|
||||
startButton = new wxToggleButton(this, wxID_ANY, wxT("Start"));
|
||||
triangleButton = new wxToggleButton(this, wxID_ANY, wxT("Triangle"));
|
||||
triangleButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
squareButton = new wxToggleButton(this, wxID_ANY, wxT("Square"));
|
||||
squareButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
circleButton = new wxToggleButton(this, wxID_ANY, wxT("Circle"));
|
||||
circleButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
crossButton = new wxToggleButton(this, wxID_ANY, wxT("Cross"));
|
||||
crossButtonPressure = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 255, 255);
|
||||
leftAnalogXVal = new wxSlider(this, wxID_ANY, 0, -127, 127);
|
||||
leftAnalogXValPrecise = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -127, 128);
|
||||
l3Button = new wxToggleButton(this, wxID_ANY, wxT("L3"));
|
||||
leftAnalogYVal = new wxSlider(this, wxID_ANY, 0, -127, 127, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL);
|
||||
leftAnalogYValPrecise = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -127, 128);
|
||||
rightAnalogXVal = new wxSlider(this, wxID_ANY, 0, -127, 127);
|
||||
rightAnalogXValPrecise = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -127, 128);
|
||||
r3Button = new wxToggleButton(this, wxID_ANY, wxT("R3"));
|
||||
rightAnalogYVal = new wxSlider(this, wxID_ANY, 0, -127, 127, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL);
|
||||
rightAnalogYValPrecise = new wxSpinCtrl(this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -127, 128);
|
||||
|
||||
// Global
|
||||
wxPanel *panel = new wxPanel(this, wxID_ANY);
|
||||
int x = 10, y = 2;
|
||||
int w = 50, h = 35;
|
||||
int space = 5;
|
||||
// Initialize class members
|
||||
VirtualPad::controllerPort = controllerPort;
|
||||
|
||||
// Left triggers
|
||||
buttons[ID_L2 - 1] = new wxToggleButton(panel, ID_L2, L"L2", wxPoint(x, y), wxSize(w, h));
|
||||
buttonsPressure[ID_L2 - 1] = new wxSpinCtrl(panel, ID_L2_PRESSURE, "255", wxPoint(x + w + space, y), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_L1 - 1] = new wxToggleButton(panel, ID_L1, L"L1", wxPoint(x, y + h + space), wxSize(w, h));
|
||||
buttonsPressure[ID_L1 - 1] = new wxSpinCtrl(panel, ID_L1_PRESSURE, "255", wxPoint(x + w + space, y + h + space), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
// NOTE: Order MATTERS, these match the map-key array defined in PadData.h
|
||||
wxToggleButton* tempButtons[16] = {
|
||||
// Pressure sensitive buttons
|
||||
upButton, rightButton, leftButton, downButton,
|
||||
crossButton, circleButton, squareButton, triangleButton,
|
||||
l1Button, l2Button, r1Button, r2Button,
|
||||
// Non-pressure sensitive buttons
|
||||
l3Button, r3Button,
|
||||
selectButton, startButton};
|
||||
std::copy(std::begin(tempButtons), std::end(tempButtons), std::begin(buttons));
|
||||
|
||||
// Cross Key
|
||||
x = 15;
|
||||
y = 100;
|
||||
buttons[ID_UP - 1] = new wxToggleButton(panel, ID_UP, _("Up"), wxPoint(x + w + space, y), wxSize(w, h));
|
||||
buttonsPressure[ID_UP - 1] = new wxSpinCtrl(panel, ID_UP_PRESSURE, "255", wxPoint(x + 2 * (w + space), y), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_DOWN - 1] = new wxToggleButton(panel, ID_DOWN, _("Down"), wxPoint(x + w + space, y + 2 * h + 2 * space), wxSize(w, h));
|
||||
buttonsPressure[ID_DOWN - 1] = new wxSpinCtrl(panel, ID_DOWN_PRESSURE, "255", wxPoint(x + 2 * (w + space), y + 2 * h + 2 * space), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_LEFT - 1] = new wxToggleButton(panel, ID_LEFT, _("Left"), wxPoint(x, y + h + 5), wxSize(w, h));
|
||||
buttonsPressure[ID_LEFT - 1] = new wxSpinCtrl(panel, ID_LEFT_PRESSURE, "255", wxPoint(x + w + space, y + h + 5), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_RIGHT - 1] = new wxToggleButton(panel, ID_RIGHT, _("Right"), wxPoint(x + 2 * w + 2 * space, y + h + space), wxSize(w, h));
|
||||
buttonsPressure[ID_RIGHT - 1] = new wxSpinCtrl(panel, ID_RIGHT_PRESSURE, "255", wxPoint(x + 3 * (w + space), y + h + space), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
wxSpinCtrl* tempPressureButtons[16] = {
|
||||
// Pressure sensitive buttons
|
||||
upButtonPressure, rightButtonPressure, leftButtonPressure, downButtonPressure,
|
||||
crossButtonPressure, circleButtonPressure, squareButtonPressure, triangleButtonPressure,
|
||||
l1ButtonPressure, l2ButtonPressure, r1ButtonPressure, r2ButtonPressure};
|
||||
std::copy(std::begin(tempPressureButtons), std::end(tempPressureButtons), std::begin(buttonsPressure));
|
||||
|
||||
// Right triggers
|
||||
x = 475;
|
||||
y = 2;
|
||||
buttons[ID_R2 - 1] = new wxToggleButton(panel, ID_R2, L"R2", wxPoint(x, y), wxSize(w, h));
|
||||
buttonsPressure[ID_R2 - 1] = new wxSpinCtrl(panel, ID_R2_PRESSURE, "255", wxPoint(x + w + space, y), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_R1 - 1] = new wxToggleButton(panel, ID_R1, L"R1", wxPoint(x, y + h + space), wxSize(w, h));
|
||||
buttonsPressure[ID_R1 - 1] = new wxSpinCtrl(panel, ID_R1_PRESSURE, "255", wxPoint(x + w + space, y + h + space), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
wxSlider* tempAnalogSliders[4] = { leftAnalogXVal, leftAnalogYVal, rightAnalogXVal, rightAnalogYVal };
|
||||
std::copy(std::begin(tempAnalogSliders), std::end(tempAnalogSliders), std::begin(analogSliders));
|
||||
|
||||
// Action buttons
|
||||
x = 365;
|
||||
y = 100;
|
||||
buttons[ID_TRIANGLE - 1] = new wxToggleButton(panel, ID_TRIANGLE, _("Triangle"), wxPoint(x + w + space, y), wxSize(w, h));
|
||||
buttonsPressure[ID_TRIANGLE - 1] = new wxSpinCtrl(panel, ID_TRIANGLE_PRESSURE, "255", wxPoint(x + 2 * (w + space), y), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_X - 1] = new wxToggleButton(panel, ID_X, _("X"), wxPoint(x + w + space, y + 2 * h + 2 * space), wxSize(w, h));
|
||||
buttonsPressure[ID_X - 1] = new wxSpinCtrl(panel, ID_X_PRESSURE, "255", wxPoint(x + 2 * (w + space), y + 2 * h + 2 * space), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_SQUARE - 1] = new wxToggleButton(panel, ID_SQUARE, _("Square"), wxPoint(x, y + h + 5), wxSize(w, h));
|
||||
buttonsPressure[ID_SQUARE - 1] = new wxSpinCtrl(panel, ID_SQUARE_PRESSURE, "255", wxPoint(x + w + space, y + h + 5), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
buttons[ID_CIRCLE - 1] = new wxToggleButton(panel, ID_CIRCLE, _("Circle"), wxPoint(x + 2 * w + 2 * space, y + h + space), wxSize(w, h));
|
||||
buttonsPressure[ID_CIRCLE - 1] = new wxSpinCtrl(panel, ID_CIRCLE_PRESSURE, "255", wxPoint(x + 3 * (w + space), y + h + space), wxSize(w, h),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 255);
|
||||
wxSpinCtrl* tempAnalogVals[4] = { leftAnalogXValPrecise, leftAnalogYValPrecise, rightAnalogXValPrecise, rightAnalogYValPrecise };
|
||||
std::copy(std::begin(tempAnalogVals), std::end(tempAnalogVals), std::begin(analogVals));
|
||||
|
||||
// L3, R3
|
||||
y = 20;
|
||||
buttons[ID_L3 - 1] = new wxToggleButton(panel, ID_L3, L"L3", wxPoint(150, y), wxSize(w, h));
|
||||
buttons[ID_R3 - 1] = new wxToggleButton(panel, ID_R3, L"R3", wxPoint(350, y), wxSize(w, h));
|
||||
// Setup event bindings
|
||||
for (int i = 0; i < std::size(buttons); i++)
|
||||
{
|
||||
(*buttons[i]).Bind(wxEVT_TOGGLEBUTTON, &VirtualPad::OnButtonPress, this);
|
||||
}
|
||||
for (int i = 0; i < std::size(buttonsPressure); i++)
|
||||
{
|
||||
(*buttonsPressure[i]).Bind(wxEVT_SPINCTRL, &VirtualPad::OnPressureChange, this);
|
||||
}
|
||||
for (int i = 0; i < std::size(analogSliders); i++)
|
||||
{
|
||||
(*analogSliders[i]).Bind(wxEVT_SLIDER, &VirtualPad::OnAnalogSliderChange, this);
|
||||
}
|
||||
for (int i = 0; i < std::size(analogVals); i++)
|
||||
{
|
||||
(*analogVals[i]).Bind(wxEVT_SPINCTRL, &VirtualPad::OnAnalogValChange, this);
|
||||
}
|
||||
|
||||
// Finalize layout
|
||||
SetProperties();
|
||||
DoLayout();
|
||||
}
|
||||
|
||||
// Start, select
|
||||
buttons[ID_SELECT - 1] = new wxToggleButton(panel, ID_SELECT, _("Select"), wxPoint(150, y + h + space), wxSize(w, h));
|
||||
buttons[ID_START - 1] = new wxToggleButton(panel, ID_START, _("Start"), wxPoint(350, y + h + space), wxSize(w, h));
|
||||
|
||||
// Left analog
|
||||
x = 5;
|
||||
y = 220;
|
||||
w = 200;
|
||||
h = 30;
|
||||
space = 3;
|
||||
sticks[0] = new wxSlider(panel, ID_L_UPDOWN, 127, 0, 255, wxPoint(x + w + space, y), wxSize(h, w),
|
||||
wxSL_VERTICAL | wxSL_INVERSE | wxSL_LEFT);
|
||||
sticks[1] = new wxSlider(panel, ID_L_RIGHTLEFT, 127, 0, 255, wxPoint(x, y + w + space), wxSize(w, h), wxSL_HORIZONTAL);
|
||||
|
||||
sticksText[0] = new wxSpinCtrl(panel, ID_L_UPDOWN_TEXT, L"127", wxPoint(x + w + space + 30, y + w / 2 - 10), wxSize(55, 20),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 127);
|
||||
sticksText[1] = new wxSpinCtrl(panel, ID_L_RIGHTLEFT_TEXT, L"127", wxPoint(x + w / 2 - 10, y + w + space + 30), wxSize(55, 20),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 127);
|
||||
|
||||
// Right analog
|
||||
x = 275;
|
||||
sticks[2] = new wxSlider(panel, ID_R_UPDOWN, 127, 0, 255, wxPoint(x + w + space, y), wxSize(h, w),
|
||||
wxSL_VERTICAL | wxSL_INVERSE | wxSL_LEFT);
|
||||
sticks[3] = new wxSlider(panel, ID_R_RIGHTLEFT, 127, 0, 255, wxPoint(x, y + w + space), wxSize(w, h), wxSL_HORIZONTAL);
|
||||
|
||||
sticksText[2] = new wxSpinCtrl(panel, ID_R_UPDOWN_TEXT, L"127", wxPoint(x + w + space + 30, y + w / 2 - 10), wxSize(55, 20),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 127);
|
||||
sticksText[3] = new wxSpinCtrl(panel, ID_R_RIGHTLEFT_TEXT, L"127", wxPoint(x + w / 2 - 10, y + w + space + 30), wxSize(55, 20),
|
||||
wxSP_ARROW_KEYS | wxALIGN_LEFT, 0, 255, 127);
|
||||
|
||||
// Reset
|
||||
reset = new wxButton(panel, ID_RESET, _("Reset"), wxPoint(515, 430), wxSize(50, 35));
|
||||
Bind(wxEVT_BUTTON, &VirtualPad::OnResetButton, this, ID_RESET);
|
||||
|
||||
// Handling buttons (normal keys)
|
||||
for (int i = ID_UP; i <= 16; i++)
|
||||
Bind(wxEVT_TOGGLEBUTTON, &VirtualPad::OnClick, this, i);
|
||||
|
||||
// Handling changes in pressure sensitivity
|
||||
for (int i = ID_UP_PRESSURE; i <= ID_R2_PRESSURE; i++)
|
||||
Bind(wxEVT_SPINCTRL, &VirtualPad::OnPressureCtrlChange, this, i);
|
||||
|
||||
// Handling TextCtrl changes (analog keys)
|
||||
for (int i = ID_L_UPDOWN_TEXT; i <= ID_R_RIGHTLEFT_TEXT; i++)
|
||||
Bind(wxEVT_SPINCTRL, &VirtualPad::OnTextCtrlChange, this, i);
|
||||
|
||||
// Handling Slider changes (analog keys)
|
||||
for (int i = ID_L_UPDOWN; i <= ID_R_RIGHTLEFT; i++)
|
||||
Bind(wxEVT_SLIDER, &VirtualPad::OnSliderMove, this, i);
|
||||
void VirtualPad::SetProperties()
|
||||
{
|
||||
if (controllerPort == 0) {
|
||||
SetTitle(wxT("Virtual Pad - Port 1"));
|
||||
}
|
||||
else {
|
||||
SetTitle(wxT("Virtual Pad - Port 2"));
|
||||
}
|
||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
}
|
||||
|
||||
bool VirtualPad::Show(bool show)
|
||||
|
@ -178,145 +120,280 @@ bool VirtualPad::Show(bool show)
|
|||
if (!wxFrame::Show(show))
|
||||
return false;
|
||||
if (show)
|
||||
g_RecordingInput.SetVirtualPadReading(port, true);
|
||||
g_RecordingInput.SetVirtualPadReading(controllerPort, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void VirtualPad::OnClose(wxCloseEvent & event)
|
||||
{
|
||||
g_RecordingInput.SetVirtualPadReading(port, false);
|
||||
g_RecordingInput.SetVirtualPadReading(controllerPort, false);
|
||||
Hide();
|
||||
}
|
||||
|
||||
void VirtualPad::OnClick(wxCommandEvent & event)
|
||||
/* TODO - remove this, live update later
|
||||
void VirtualPad::FrameUpdate()
|
||||
{
|
||||
if (0 < event.GetId() && event.GetId() <= 16) {
|
||||
int id = event.GetId() - ID_UP;
|
||||
std::map<wxString, int> buttonPressures = g_RecordingInput.GetButtonPressureState(controllerPort);
|
||||
std::map<wxString, int> analogValues = g_RecordingInput.GetAnalogState(controllerPort);
|
||||
|
||||
for (int i = 0; i < PadDataNormalKeysSize - 4; i++)
|
||||
{
|
||||
int value = buttonPressures.at(PadDataNormalKeys[i]);
|
||||
buttonsPressure[i]->SetValue(value);
|
||||
}
|
||||
|
||||
for (int i = 0; i < PadDataAnalogKeysSize; i++)
|
||||
{
|
||||
int value = analogValues.at(PadDataAnalogKeys[i]) - 127;
|
||||
analogSliders[i]->SetValue(value);
|
||||
}
|
||||
}
|
||||
**/
|
||||
|
||||
void VirtualPad::OnButtonPress(wxCommandEvent & event)
|
||||
{
|
||||
wxToggleButton* pressedButton = (wxToggleButton*) event.GetEventObject();
|
||||
int buttonId = -1;
|
||||
for (int i = 0; i < std::size(buttons); i++)
|
||||
{
|
||||
if (pressedButton == buttons[i])
|
||||
{
|
||||
buttonId = i;
|
||||
}
|
||||
}
|
||||
if (buttonId != -1)
|
||||
{
|
||||
u8 pressure = 0;
|
||||
if (event.IsChecked()) {
|
||||
// for a button to be pressed, it just has to be > 0
|
||||
pressure = 255;
|
||||
// skip non-pressure sensitive buttons
|
||||
if (isPressureSensitive(id + ID_UP)) {
|
||||
pressure = buttonsPressure[id]->GetValue(); // null ptrs on buttons with pressure sensitivity (should just skip them or add them back because i skip them later)
|
||||
if (pressure > 255)
|
||||
pressure = 255;
|
||||
else if (pressure < 0)
|
||||
pressure = 0;
|
||||
if (event.IsChecked())
|
||||
{
|
||||
if (buttonId < 12)
|
||||
{
|
||||
pressure = buttonsPressure[buttonId]->GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
pressure = 255;
|
||||
}
|
||||
}
|
||||
g_RecordingInput.SetButtonState(port, PadDataNormalKeys[id], pressure);
|
||||
}
|
||||
else
|
||||
recordingConLog("[VirtualPad]: Unknown toggle button pressed.\n");
|
||||
}
|
||||
|
||||
// TODO Recording - should probably implement an OnRelease (if wxwidgets has that?)
|
||||
|
||||
void VirtualPad::OnResetButton(wxCommandEvent & event)
|
||||
{
|
||||
// Normal buttons
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
buttons[i]->SetValue(false);
|
||||
g_RecordingInput.SetButtonState(port, PadDataNormalKeys[i], 0);
|
||||
}
|
||||
// Pressure sensitivity
|
||||
for (int i = 0; i < 12; i++) {
|
||||
buttonsPressure[i]->SetValue(255);
|
||||
}
|
||||
|
||||
// Analog
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
sticks[i]->SetValue(127);
|
||||
sticksText[i]->SetValue(127);
|
||||
g_RecordingInput.UpdateAnalog(port, PadDataAnalogKeys[i], 127);
|
||||
g_RecordingInput.SetButtonState(controllerPort, PadDataNormalKeys[buttonId], pressure);
|
||||
}
|
||||
}
|
||||
|
||||
void VirtualPad::OnPressureCtrlChange(wxSpinEvent & event)
|
||||
void VirtualPad::OnPressureChange(wxSpinEvent & event)
|
||||
{
|
||||
if (ID_UP_PRESSURE <= event.GetId() && event.GetId() <= ID_R2_PRESSURE)
|
||||
wxSpinCtrl* updatedSpinner = (wxSpinCtrl*) event.GetEventObject();
|
||||
int spinnerId = -1;
|
||||
for (int i = 0; i < std::size(buttonsPressure); i++)
|
||||
{
|
||||
if (updatedSpinner == buttonsPressure[i])
|
||||
{
|
||||
spinnerId = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (spinnerId != -1)
|
||||
{
|
||||
int id = getButtonIdFromPressure(event.GetId()) - ID_UP;
|
||||
if (id == -1)
|
||||
return;
|
||||
u8 pressure = 0;
|
||||
if (event.IsChecked()) {
|
||||
// this event is only fired on buttons with a
|
||||
// pressure spinctrl, so no validation needed!
|
||||
pressure = buttonsPressure[id]->GetValue();
|
||||
if (pressure > 255)
|
||||
pressure = 255;
|
||||
else if (pressure < 0)
|
||||
pressure = 0;
|
||||
pressure = buttonsPressure[spinnerId]->GetValue();
|
||||
}
|
||||
g_RecordingInput.SetButtonState(port, PadDataNormalKeys[id], pressure);
|
||||
g_RecordingInput.SetButtonState(controllerPort, PadDataNormalKeys[spinnerId], pressure);
|
||||
}
|
||||
else
|
||||
recordingConLog("[VirtualPad]: Unknown pressure sensitivty change.\n");
|
||||
}
|
||||
|
||||
void VirtualPad::OnTextCtrlChange(wxSpinEvent & event)
|
||||
void VirtualPad::OnAnalogSliderChange(wxCommandEvent & event)
|
||||
{
|
||||
if (ID_L_UPDOWN_TEXT <= event.GetId() && event.GetId() <= ID_R_RIGHTLEFT_TEXT)
|
||||
wxSlider* movedSlider = (wxSlider*) event.GetEventObject();
|
||||
int sliderId = -1;
|
||||
for (int i = 0; i < std::size(analogSliders); i++)
|
||||
{
|
||||
int id = event.GetId() - ID_L_UPDOWN_TEXT;
|
||||
sticks[id]->SetValue(event.GetInt());
|
||||
// We inverse up and down for more confort
|
||||
if (id % 2 == 0)
|
||||
g_RecordingInput.UpdateAnalog(port, PadDataAnalogKeys[id], 255 - event.GetInt());
|
||||
else
|
||||
g_RecordingInput.UpdateAnalog(port, PadDataAnalogKeys[id], event.GetInt());
|
||||
if (movedSlider == analogSliders[i])
|
||||
{
|
||||
sliderId = i;
|
||||
}
|
||||
}
|
||||
if (sliderId != -1)
|
||||
{
|
||||
if (sliderId % 2 == 0)
|
||||
{
|
||||
analogVals[sliderId]->SetValue(event.GetInt());
|
||||
}
|
||||
else {
|
||||
analogVals[sliderId]->SetValue(event.GetInt() * -1);
|
||||
}
|
||||
|
||||
g_RecordingInput.UpdateAnalog(controllerPort, PadDataAnalogKeys[sliderId], event.GetInt() + 127);
|
||||
}
|
||||
else
|
||||
recordingConLog("[VirtualPad]: Unknown TextCtrl change.\n");
|
||||
}
|
||||
|
||||
void VirtualPad::OnSliderMove(wxCommandEvent & event)
|
||||
void VirtualPad::OnAnalogValChange(wxSpinEvent & event)
|
||||
{
|
||||
if (ID_L_UPDOWN <= event.GetId() && event.GetId() <= ID_R_RIGHTLEFT)
|
||||
wxSpinCtrl* updatedSpinner = (wxSpinCtrl*)event.GetEventObject();
|
||||
int spinnerId = -1;
|
||||
for (int i = 0; i < std::size(analogVals); i++)
|
||||
{
|
||||
int id = event.GetId() - ID_L_UPDOWN;
|
||||
sticksText[id]->SetValue(event.GetInt());
|
||||
// We inverse up and down for more confort
|
||||
if (id % 2 == 0)
|
||||
g_RecordingInput.UpdateAnalog(port, PadDataAnalogKeys[id], 255 - event.GetInt());
|
||||
else
|
||||
g_RecordingInput.UpdateAnalog(port, PadDataAnalogKeys[id], event.GetInt());
|
||||
if (updatedSpinner == analogVals[i])
|
||||
{
|
||||
spinnerId = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
recordingConLog("[VirtualPad]: Unknown TextCtrl change.\n");
|
||||
}
|
||||
|
||||
int VirtualPad::getButtonIdFromPressure(int pressureCtrlId) {
|
||||
|
||||
if (pressureCtrlId <= ID_DOWN_PRESSURE) {
|
||||
return pressureCtrlId - 16;
|
||||
}
|
||||
else if (pressureCtrlId >= ID_X_PRESSURE && pressureCtrlId <= ID_L2_PRESSURE) {
|
||||
// Skip start and select buttons
|
||||
return pressureCtrlId - 16 + 2;
|
||||
}
|
||||
else if (pressureCtrlId >= ID_R1_PRESSURE && pressureCtrlId <= ID_R2_PRESSURE) {
|
||||
// skip L3 button
|
||||
return pressureCtrlId - 16 + 2 + 1;
|
||||
}
|
||||
else {
|
||||
// else, wasnt a pressure sensitive event
|
||||
return -1;
|
||||
if (spinnerId != -1)
|
||||
{
|
||||
if (spinnerId % 2 == 0)
|
||||
{
|
||||
analogVals[spinnerId]->SetValue(event.GetInt());
|
||||
}
|
||||
else {
|
||||
analogVals[spinnerId]->SetValue(event.GetInt() * -1);
|
||||
}
|
||||
g_RecordingInput.UpdateAnalog(controllerPort, PadDataAnalogKeys[spinnerId], event.GetInt() + 127);
|
||||
}
|
||||
}
|
||||
|
||||
bool VirtualPad::isPressureSensitive(int buttonId) {
|
||||
|
||||
|
||||
if (buttonId != ID_SELECT ||
|
||||
buttonId != ID_START ||
|
||||
buttonId != ID_L3 ||
|
||||
buttonId != ID_R3) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void VirtualPad::DoLayout()
|
||||
{
|
||||
wxBoxSizer* container = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* analogSticks = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace6 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* rightAnalogContainer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* rightAnalog = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* rightAnalogYContainer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* rightAnalogY = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* rightAnalogButtonAndGUI = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* rightAnalogX = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace5 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* leftAnalogContainer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* leftAnalog = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* leftAnalogYContainer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* leftAnalogY = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* leftAnalogButtonAndGUI = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* leftAnalogX = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace4 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* faceButtonRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxGridSizer* faceButtons = new wxGridSizer(0, 3, 0, 0);
|
||||
wxBoxSizer* cross = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* circle = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* square = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* triangle = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* middleOfController = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* emptySpace8 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* startAndSelect = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace9 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace7 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxGridSizer* dPad = new wxGridSizer(0, 3, 0, 0);
|
||||
wxBoxSizer* dPadDown = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* dPadRight = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* dPadLeft = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* dPadUp = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* shoulderButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace3 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* rightShoulderButtons = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* r1ButtonRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* r2ButtonRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* leftShoulderButtons = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* l1ButtonRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* l2ButtonRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* emptySpace1 = new wxBoxSizer(wxVERTICAL);
|
||||
emptySpace1->Add(0, 0, 0, 0, 0);
|
||||
shoulderButtons->Add(emptySpace1, 2, wxEXPAND, 0);
|
||||
l2ButtonRow->Add(l2Button, 0, wxEXPAND, 0);
|
||||
l2ButtonRow->Add(l2ButtonPressure, 0, wxEXPAND, 0);
|
||||
leftShoulderButtons->Add(l2ButtonRow, 1, wxEXPAND, 0);
|
||||
l1ButtonRow->Add(l1Button, 0, wxEXPAND, 0);
|
||||
l1ButtonRow->Add(l1ButtonPressure, 0, wxEXPAND, 0);
|
||||
leftShoulderButtons->Add(l1ButtonRow, 1, wxEXPAND, 0);
|
||||
shoulderButtons->Add(leftShoulderButtons, 5, wxEXPAND, 0);
|
||||
emptySpace2->Add(0, 0, 0, 0, 0);
|
||||
shoulderButtons->Add(emptySpace2, 13, wxEXPAND, 0);
|
||||
r2ButtonRow->Add(r2Button, 0, wxEXPAND, 0);
|
||||
r2ButtonRow->Add(r2ButtonPressure, 0, wxEXPAND, 0);
|
||||
rightShoulderButtons->Add(r2ButtonRow, 1, wxEXPAND, 0);
|
||||
r1ButtonRow->Add(r1Button, 0, wxEXPAND, 0);
|
||||
r1ButtonRow->Add(r1ButtonPressure, 0, wxEXPAND, 0);
|
||||
rightShoulderButtons->Add(r1ButtonRow, 1, wxEXPAND, 0);
|
||||
shoulderButtons->Add(rightShoulderButtons, 5, wxEXPAND, 0);
|
||||
emptySpace3->Add(0, 0, 0, 0, 0);
|
||||
shoulderButtons->Add(emptySpace3, 2, wxEXPAND, 0);
|
||||
container->Add(shoulderButtons, 1, wxBOTTOM | wxEXPAND | wxTOP, 3);
|
||||
dPad->Add(0, 0, 0, 0, 0);
|
||||
dPadUp->Add(upButton, 0, wxEXPAND, 0);
|
||||
dPadUp->Add(upButtonPressure, 0, wxEXPAND, 0);
|
||||
dPad->Add(dPadUp, 1, wxEXPAND, 0);
|
||||
dPad->Add(0, 0, 0, 0, 0);
|
||||
dPadLeft->Add(leftButton, 0, wxEXPAND, 0);
|
||||
dPadLeft->Add(leftButtonPressure, 0, wxEXPAND, 0);
|
||||
dPad->Add(dPadLeft, 1, wxEXPAND, 0);
|
||||
dPad->Add(0, 0, 0, 0, 0);
|
||||
dPadRight->Add(rightButton, 0, wxEXPAND, 0);
|
||||
dPadRight->Add(rightButtonPressure, 0, wxEXPAND, 0);
|
||||
dPad->Add(dPadRight, 1, wxEXPAND, 0);
|
||||
dPad->Add(0, 0, 0, 0, 0);
|
||||
dPadDown->Add(downButton, 0, wxEXPAND, 0);
|
||||
dPadDown->Add(downButtonPressure, 0, wxEXPAND, 0);
|
||||
dPad->Add(dPadDown, 1, wxEXPAND, 0);
|
||||
dPad->Add(0, 0, 0, 0, 0);
|
||||
faceButtonRow->Add(dPad, 9, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
||||
emptySpace7->Add(0, 0, 0, 0, 0);
|
||||
middleOfController->Add(emptySpace7, 1, wxEXPAND, 0);
|
||||
startAndSelect->Add(selectButton, 0, 0, 0);
|
||||
emptySpace9->Add(0, 0, 0, 0, 0);
|
||||
startAndSelect->Add(emptySpace9, 1, wxEXPAND, 0);
|
||||
startAndSelect->Add(startButton, 0, 0, 0);
|
||||
middleOfController->Add(startAndSelect, 1, wxEXPAND, 0);
|
||||
emptySpace8->Add(0, 0, 0, 0, 0);
|
||||
middleOfController->Add(emptySpace8, 1, wxEXPAND, 0);
|
||||
faceButtonRow->Add(middleOfController, 8, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
||||
faceButtons->Add(0, 0, 0, 0, 0);
|
||||
triangle->Add(triangleButton, 0, wxEXPAND, 0);
|
||||
triangle->Add(triangleButtonPressure, 0, wxEXPAND, 0);
|
||||
faceButtons->Add(triangle, 1, wxEXPAND, 0);
|
||||
faceButtons->Add(0, 0, 0, 0, 0);
|
||||
square->Add(squareButton, 0, wxEXPAND, 0);
|
||||
square->Add(squareButtonPressure, 0, wxEXPAND, 0);
|
||||
faceButtons->Add(square, 1, wxEXPAND, 0);
|
||||
faceButtons->Add(0, 0, 0, 0, 0);
|
||||
circle->Add(circleButton, 0, wxEXPAND, 0);
|
||||
circle->Add(circleButtonPressure, 0, wxEXPAND, 0);
|
||||
faceButtons->Add(circle, 1, wxEXPAND, 0);
|
||||
faceButtons->Add(0, 0, 0, 0, 0);
|
||||
cross->Add(crossButton, 0, wxEXPAND, 0);
|
||||
cross->Add(crossButtonPressure, 0, wxEXPAND, 0);
|
||||
faceButtons->Add(cross, 1, wxEXPAND, 0);
|
||||
faceButtons->Add(0, 0, 0, 0, 0);
|
||||
faceButtonRow->Add(faceButtons, 9, wxEXPAND | wxLEFT | wxRIGHT, 3);
|
||||
container->Add(faceButtonRow, 4, wxBOTTOM | wxEXPAND | wxTOP, 3);
|
||||
emptySpace4->Add(0, 0, 0, 0, 0);
|
||||
analogSticks->Add(emptySpace4, 6, wxEXPAND, 0);
|
||||
leftAnalogX->Add(leftAnalogXVal, 1, wxALL | wxEXPAND, 0);
|
||||
leftAnalogX->Add(leftAnalogXValPrecise, 0, wxEXPAND, 0);
|
||||
leftAnalog->Add(leftAnalogX, 1, wxEXPAND, 0);
|
||||
leftAnalogButtonAndGUI->Add(0, 0, 0, 0, 0);
|
||||
leftAnalogButtonAndGUI->Add(l3Button, 0, wxALIGN_CENTER, 0);
|
||||
leftAnalogYContainer->Add(leftAnalogButtonAndGUI, 1, wxEXPAND, 0);
|
||||
leftAnalogY->Add(leftAnalogYVal, 1, wxALIGN_RIGHT, 0);
|
||||
leftAnalogY->Add(leftAnalogYValPrecise, 0, wxALIGN_RIGHT, 0);
|
||||
leftAnalogYContainer->Add(leftAnalogY, 1, wxEXPAND, 0);
|
||||
leftAnalog->Add(leftAnalogYContainer, 5, wxEXPAND, 0);
|
||||
leftAnalogContainer->Add(leftAnalog, 1, wxEXPAND, 0);
|
||||
analogSticks->Add(leftAnalogContainer, 6, wxEXPAND, 0);
|
||||
emptySpace5->Add(0, 0, 0, 0, 0);
|
||||
analogSticks->Add(emptySpace5, 3, wxEXPAND, 0);
|
||||
rightAnalogX->Add(rightAnalogXVal, 1, wxEXPAND, 0);
|
||||
rightAnalogX->Add(rightAnalogXValPrecise, 0, wxEXPAND, 0);
|
||||
rightAnalog->Add(rightAnalogX, 1, wxEXPAND, 0);
|
||||
rightAnalogButtonAndGUI->Add(0, 0, 0, 0, 0);
|
||||
rightAnalogButtonAndGUI->Add(r3Button, 0, wxALIGN_CENTER, 0);
|
||||
rightAnalogYContainer->Add(rightAnalogButtonAndGUI, 1, wxEXPAND, 0);
|
||||
rightAnalogY->Add(rightAnalogYVal, 1, wxALIGN_RIGHT, 0);
|
||||
rightAnalogY->Add(rightAnalogYValPrecise, 0, wxALIGN_RIGHT | wxEXPAND, 0);
|
||||
rightAnalogYContainer->Add(rightAnalogY, 1, wxEXPAND, 0);
|
||||
rightAnalog->Add(rightAnalogYContainer, 5, wxEXPAND, 0);
|
||||
rightAnalogContainer->Add(rightAnalog, 1, wxEXPAND, 0);
|
||||
analogSticks->Add(rightAnalogContainer, 6, wxEXPAND, 0);
|
||||
emptySpace6->Add(0, 0, 0, 0, 0);
|
||||
analogSticks->Add(emptySpace6, 6, wxEXPAND, 0);
|
||||
container->Add(analogSticks, 3, wxBOTTOM | wxEXPAND | wxTOP, 3);
|
||||
SetSizer(container);
|
||||
Layout();
|
||||
}
|
||||
|
|
|
@ -9,32 +9,72 @@
|
|||
class VirtualPad : public wxFrame
|
||||
{
|
||||
public:
|
||||
VirtualPad(wxWindow *parent, int controllerPort);
|
||||
VirtualPad(wxWindow* parent, wxWindowID id, const wxString& title, int controllerPort, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
bool Show(bool show = true) override;
|
||||
void FrameUpdate();
|
||||
|
||||
private:
|
||||
void SetProperties();
|
||||
void DoLayout();
|
||||
|
||||
protected:
|
||||
int port;
|
||||
int controllerPort;
|
||||
|
||||
wxToggleButton *buttons[16];
|
||||
wxSpinCtrl *buttonsPressure[16];
|
||||
wxButton *reset;
|
||||
wxToggleButton* l2Button;
|
||||
wxSpinCtrl* l2ButtonPressure;
|
||||
wxToggleButton* l1Button;
|
||||
wxSpinCtrl* l1ButtonPressure;
|
||||
wxToggleButton* r2Button;
|
||||
wxSpinCtrl* r2ButtonPressure;
|
||||
wxToggleButton* r1Button;
|
||||
wxSpinCtrl* r1ButtonPressure;
|
||||
wxToggleButton* upButton;
|
||||
wxSpinCtrl* upButtonPressure;
|
||||
wxToggleButton* leftButton;
|
||||
wxSpinCtrl* leftButtonPressure;
|
||||
wxToggleButton* rightButton;
|
||||
wxSpinCtrl* rightButtonPressure;
|
||||
wxToggleButton* downButton;
|
||||
wxSpinCtrl* downButtonPressure;
|
||||
wxToggleButton* startButton;
|
||||
wxToggleButton* selectButton;
|
||||
wxToggleButton* triangleButton;
|
||||
wxSpinCtrl* triangleButtonPressure;
|
||||
wxToggleButton* squareButton;
|
||||
wxSpinCtrl* squareButtonPressure;
|
||||
wxToggleButton* circleButton;
|
||||
wxSpinCtrl* circleButtonPressure;
|
||||
wxToggleButton* crossButton;
|
||||
wxSpinCtrl* crossButtonPressure;
|
||||
wxSlider* leftAnalogXVal;
|
||||
wxSpinCtrl* leftAnalogXValPrecise;
|
||||
wxToggleButton* l3Button;
|
||||
wxSlider* leftAnalogYVal;
|
||||
wxSpinCtrl* leftAnalogYValPrecise;
|
||||
wxSlider* rightAnalogXVal;
|
||||
wxSpinCtrl* rightAnalogXValPrecise;
|
||||
wxToggleButton* r3Button;
|
||||
wxSlider* rightAnalogYVal;
|
||||
wxSpinCtrl* rightAnalogYValPrecise;
|
||||
|
||||
wxSlider *sticks[4];
|
||||
wxSpinCtrl *sticksText[4];
|
||||
wxToggleButton* buttons[16];
|
||||
int buttonsLength = 16;
|
||||
wxSpinCtrl* buttonsPressure[12];
|
||||
int buttonsPressureLength = 12;
|
||||
wxSlider* analogSliders[4];
|
||||
int analogSlidersLength = 4;
|
||||
wxSpinCtrl* analogVals[4];
|
||||
int analogValsLength = 4;
|
||||
|
||||
// TODO - reset button
|
||||
|
||||
protected:
|
||||
void OnClose(wxCloseEvent &event);
|
||||
|
||||
void OnClick(wxCommandEvent &event);
|
||||
void OnResetButton(wxCommandEvent &event);
|
||||
void OnPressureCtrlChange(wxSpinEvent &event);
|
||||
void OnTextCtrlChange(wxSpinEvent &event);
|
||||
void OnSliderMove(wxCommandEvent &event);
|
||||
|
||||
int getButtonIdFromPressure(int pressureCtrlId);
|
||||
|
||||
bool isPressureSensitive(int buttonId);
|
||||
void OnButtonPress(wxCommandEvent &event);
|
||||
void OnPressureChange(wxSpinEvent &event);
|
||||
void OnAnalogValChange(wxSpinEvent &event);
|
||||
void OnAnalogSliderChange(wxCommandEvent &event);
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
|
|
@ -77,12 +77,12 @@ void Pcsx2App::OpenMainFrame()
|
|||
m_id_Disassembler = disassembly->GetId();
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
InputRecordingEditor* inputRecordingEditor = new InputRecordingEditor(mainFrame);
|
||||
InputRecordingEditor* inputRecordingEditor = new InputRecordingEditor(mainFrame, wxID_ANY, wxEmptyString);
|
||||
m_id_InputRecordingEditor = inputRecordingEditor->GetId();
|
||||
|
||||
VirtualPad* virtualPad0 = new VirtualPad(mainFrame, 0);
|
||||
VirtualPad* virtualPad0 = new VirtualPad(mainFrame, wxID_ANY, wxEmptyString, 0);
|
||||
m_id_VirtualPad[0] = virtualPad0->GetId();
|
||||
VirtualPad *virtualPad1 = new VirtualPad(mainFrame, 1);
|
||||
VirtualPad *virtualPad1 = new VirtualPad(mainFrame, wxID_ANY, wxEmptyString, 1);
|
||||
m_id_VirtualPad[1] = virtualPad1->GetId();
|
||||
|
||||
NewRecordingFrame* newRecordingFrame = new NewRecordingFrame(mainFrame);
|
||||
|
|
Loading…
Reference in New Issue