Adding stick radius setting
because that makes it easier to adjust it Adding visual aid for the hardware range because that makes it easier to adjust the radius relative to it
This commit is contained in:
parent
7aae9ccbc0
commit
b6e1127c8a
|
@ -89,13 +89,53 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
||||||
dc.DrawRectangle( 0, 31 - z*31, 64, 2);
|
dc.DrawRectangle( 0, 31 - z*31, 64, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// circle for visual aid for diagonal adjustment
|
// octagon for visual aid for diagonal adjustment
|
||||||
dc.SetPen(*wxLIGHT_GREY_PEN);
|
dc.SetPen(*wxLIGHT_GREY_PEN);
|
||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
dc.SetBrush(*wxWHITE_BRUSH);
|
||||||
if ( GROUP_TYPE_STICK == (*g)->control_group->type )
|
if ( GROUP_TYPE_STICK == (*g)->control_group->type )
|
||||||
{
|
{
|
||||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
// outline and fill colors
|
||||||
dc.DrawCircle( 32, 32, 32);
|
wxBrush LightGrayBrush(_T("#dddddd"));
|
||||||
|
wxPen LightGrayPen(_T("#bfbfbf"));
|
||||||
|
dc.SetBrush(LightGrayBrush);
|
||||||
|
dc.SetPen(LightGrayPen);
|
||||||
|
|
||||||
|
// polygon offset
|
||||||
|
float max
|
||||||
|
, diagonal
|
||||||
|
, box = 64
|
||||||
|
, d_of = box / 256.0
|
||||||
|
, x_of = box / 2.0;
|
||||||
|
|
||||||
|
if ((*g)->control_group->name == "Main Stick")
|
||||||
|
{
|
||||||
|
max = (87.0 / 127.0) * 100;
|
||||||
|
diagonal = (55.0 / 127.0) * 100.0;
|
||||||
|
}
|
||||||
|
else if ((*g)->control_group->name == "C-Stick")
|
||||||
|
{
|
||||||
|
max = (74.0 / 127.0) * 100;
|
||||||
|
diagonal = (46.0 / 127.0) * 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
max = (82.0 / 127.0) * 100;
|
||||||
|
diagonal = (58.0 / 127.0) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
// polygon corners
|
||||||
|
wxPoint Points[8];
|
||||||
|
Points[0].x = (int)(0.0 * d_of + x_of); Points[0].y = (int)(max * d_of + x_of);
|
||||||
|
Points[1].x = (int)(diagonal * d_of + x_of); Points[1].y = (int)(diagonal * d_of + x_of);
|
||||||
|
Points[2].x = (int)(max * d_of + x_of); Points[2].y = (int)(0.0 * d_of + x_of);
|
||||||
|
Points[3].x = (int)(diagonal * d_of + x_of); Points[3].y = (int)(-diagonal * d_of + x_of);
|
||||||
|
Points[4].x = (int)(0.0 * d_of + x_of); Points[4].y = (int)(-max * d_of + x_of);
|
||||||
|
Points[5].x = (int)(-diagonal * d_of + x_of); Points[5].y = (int)(-diagonal * d_of + x_of);
|
||||||
|
Points[6].x = (int)(-max * d_of + x_of); Points[6].y = (int)(0.0 * d_of + x_of);
|
||||||
|
Points[7].x = (int)(-diagonal * d_of + x_of); Points[7].y = (int)(diagonal * d_of + x_of);
|
||||||
|
|
||||||
|
// draw polygon
|
||||||
|
dc.DrawPolygon(8, Points);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -106,7 +146,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// deadzone circle
|
// deadzone circle
|
||||||
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
|
dc.SetBrush(*wxLIGHT_GREY_BRUSH);
|
||||||
dc.DrawCircle( 32, 32, ((*g)->control_group)->settings[0]->value * 32 );
|
dc.DrawCircle( 32, 32, ((*g)->control_group)->settings[SETTING_DEADZONE]->value * 32 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// raw dot
|
// raw dot
|
||||||
|
|
|
@ -226,6 +226,7 @@ ControllerEmu::AnalogStick::AnalogStick(const char* const _name) : ControlGroup(
|
||||||
|
|
||||||
controls.push_back(new Input(_trans("Modifier")));
|
controls.push_back(new Input(_trans("Modifier")));
|
||||||
|
|
||||||
|
settings.push_back(new Setting(_trans("Radius"), 0.7f, 0, 100));
|
||||||
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||||
settings.push_back(new Setting(_trans("Square Stick"), 0));
|
settings.push_back(new Setting(_trans("Square Stick"), 0));
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,13 @@ enum
|
||||||
GROUP_TYPE_SLIDER,
|
GROUP_TYPE_SLIDER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SETTING_RADIUS,
|
||||||
|
SETTING_DEADZONE,
|
||||||
|
SETTING_SQUARE,
|
||||||
|
};
|
||||||
|
|
||||||
const char * const named_directions[] =
|
const char * const named_directions[] =
|
||||||
{
|
{
|
||||||
"Up",
|
"Up",
|
||||||
|
@ -126,8 +133,9 @@ public:
|
||||||
ControlState yy = controls[0]->control_ref->State() - controls[1]->control_ref->State();
|
ControlState yy = controls[0]->control_ref->State() - controls[1]->control_ref->State();
|
||||||
ControlState xx = controls[3]->control_ref->State() - controls[2]->control_ref->State();
|
ControlState xx = controls[3]->control_ref->State() - controls[2]->control_ref->State();
|
||||||
|
|
||||||
ControlState deadzone = settings[0]->value;
|
ControlState radius = settings[SETTING_RADIUS]->value;
|
||||||
ControlState square = settings[1]->value;
|
ControlState deadzone = settings[SETTING_DEADZONE]->value;
|
||||||
|
ControlState square = settings[SETTING_SQUARE]->value;
|
||||||
ControlState m = controls[4]->control_ref->State();
|
ControlState m = controls[4]->control_ref->State();
|
||||||
|
|
||||||
// modifier code
|
// modifier code
|
||||||
|
@ -138,7 +146,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// deadzone / square stick code
|
// deadzone / square stick code
|
||||||
if (deadzone || square)
|
if (radius != 1 || deadzone || square)
|
||||||
{
|
{
|
||||||
// this section might be all wrong, but its working good enough, I think
|
// this section might be all wrong, but its working good enough, I think
|
||||||
|
|
||||||
|
@ -163,6 +171,9 @@ public:
|
||||||
ControlState amt = dist / stick_full;
|
ControlState amt = dist / stick_full;
|
||||||
dist -= ((square_full - 1) * amt * square);
|
dist -= ((square_full - 1) * amt * square);
|
||||||
|
|
||||||
|
// radius
|
||||||
|
dist *= radius;
|
||||||
|
|
||||||
yy = std::max(-1.0f, std::min(1.0f, ang_sin * dist));
|
yy = std::max(-1.0f, std::min(1.0f, ang_sin * dist));
|
||||||
xx = std::max(-1.0f, std::min(1.0f, ang_cos * dist));
|
xx = std::max(-1.0f, std::min(1.0f, ang_cos * dist));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue