mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 13:18:50 +00:00
ControlGroup: Convert group type enum into an enum class
Gets some constants out of the ControllerEmu namespace, and modifies ControlGroup so that it uses the enum type itself to represent the underlying type, rather than a u32 value.
This commit is contained in:
parent
51136681df
commit
26f17a1723
14 changed files with 61 additions and 59 deletions
|
@ -159,9 +159,9 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
|
||||
switch (g->control_group->type)
|
||||
{
|
||||
case ControllerEmu::GROUP_TYPE_TILT:
|
||||
case ControllerEmu::GROUP_TYPE_STICK:
|
||||
case ControllerEmu::GROUP_TYPE_CURSOR:
|
||||
case ControllerEmu::GroupType::Tilt:
|
||||
case ControllerEmu::GroupType::Stick:
|
||||
case ControllerEmu::GroupType::Cursor:
|
||||
{
|
||||
// this is starting to be a mess combining all these in one case
|
||||
|
||||
|
@ -169,19 +169,19 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
|
||||
switch (g->control_group->type)
|
||||
{
|
||||
case ControllerEmu::GROUP_TYPE_STICK:
|
||||
case ControllerEmu::GroupType::Stick:
|
||||
((ControllerEmu::AnalogStick*)g->control_group)->GetState(&x, &y);
|
||||
break;
|
||||
case ControllerEmu::GROUP_TYPE_TILT:
|
||||
case ControllerEmu::GroupType::Tilt:
|
||||
((ControllerEmu::Tilt*)g->control_group)->GetState(&x, &y);
|
||||
break;
|
||||
case ControllerEmu::GROUP_TYPE_CURSOR:
|
||||
case ControllerEmu::GroupType::Cursor:
|
||||
((ControllerEmu::Cursor*)g->control_group)->GetState(&x, &y, &z);
|
||||
break;
|
||||
}
|
||||
|
||||
// ir cursor forward movement
|
||||
if (ControllerEmu::GROUP_TYPE_CURSOR == g->control_group->type)
|
||||
if (g->control_group->type == ControllerEmu::GroupType::Cursor)
|
||||
{
|
||||
gc->SetBrush(z ? *wxRED_BRUSH : *wxGREY_BRUSH);
|
||||
wxGraphicsPath path = gc->CreatePath();
|
||||
|
@ -191,7 +191,7 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
|
||||
// input zone
|
||||
gc->SetPen(*wxLIGHT_GREY_PEN);
|
||||
if (ControllerEmu::GROUP_TYPE_STICK == g->control_group->type)
|
||||
if (g->control_group->type == ControllerEmu::GroupType::Stick)
|
||||
{
|
||||
gc->SetBrush(wxColour(0xDDDDDD)); // Light Gray
|
||||
|
||||
|
@ -231,9 +231,9 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
gc->DrawRectangle(16, 16, 32, 32);
|
||||
}
|
||||
|
||||
if (ControllerEmu::GROUP_TYPE_CURSOR != g->control_group->type)
|
||||
if (g->control_group->type != ControllerEmu::GroupType::Cursor)
|
||||
{
|
||||
const int deadzone_idx = g->control_group->type == ControllerEmu::GROUP_TYPE_STICK ?
|
||||
const int deadzone_idx = g->control_group->type == ControllerEmu::GroupType::Stick ?
|
||||
ControllerEmu::AnalogStick::SETTING_DEADZONE :
|
||||
0;
|
||||
|
||||
|
@ -267,7 +267,7 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
}
|
||||
break;
|
||||
|
||||
case ControllerEmu::GROUP_TYPE_FORCE:
|
||||
case ControllerEmu::GroupType::Force:
|
||||
{
|
||||
ControlState raw_dot[3];
|
||||
ControlState adj_dot[3];
|
||||
|
@ -332,7 +332,7 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
}
|
||||
break;
|
||||
|
||||
case ControllerEmu::GROUP_TYPE_BUTTONS:
|
||||
case ControllerEmu::GroupType::Buttons:
|
||||
{
|
||||
const unsigned int button_count = static_cast<unsigned int>(g->control_group->controls.size());
|
||||
std::vector<unsigned int> bitmasks(button_count);
|
||||
|
@ -361,7 +361,7 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
}
|
||||
break;
|
||||
|
||||
case ControllerEmu::GROUP_TYPE_TRIGGERS:
|
||||
case ControllerEmu::GroupType::Triggers:
|
||||
{
|
||||
const unsigned int trigger_count = static_cast<unsigned int>(g->control_group->controls.size());
|
||||
std::vector<ControlState> trigs(trigger_count);
|
||||
|
@ -403,7 +403,7 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
}
|
||||
break;
|
||||
|
||||
case ControllerEmu::GROUP_TYPE_MIXED_TRIGGERS:
|
||||
case ControllerEmu::GroupType::MixedTriggers:
|
||||
{
|
||||
const unsigned int trigger_count = ((unsigned int)(g->control_group->controls.size() / 2));
|
||||
|
||||
|
@ -443,7 +443,7 @@ static void DrawControlGroupBox(wxGraphicsContext* gc, ControlGroupBox* g)
|
|||
}
|
||||
break;
|
||||
|
||||
case ControllerEmu::GROUP_TYPE_SLIDER:
|
||||
case ControllerEmu::GroupType::Slider:
|
||||
{
|
||||
const ControlState deadzone = g->control_group->numeric_settings[0]->GetValue();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue