mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge pull request #4960 from lioncash/type
ControlGroup: Convert group type enum into an enum class
This commit is contained in:
@ -24,7 +24,7 @@ AnalogStick::AnalogStick(const char* const name_, ControlState default_radius)
|
||||
|
||||
AnalogStick::AnalogStick(const char* const name_, const char* const ui_name_,
|
||||
ControlState default_radius)
|
||||
: ControlGroup(name_, ui_name_, GROUP_TYPE_STICK)
|
||||
: ControlGroup(name_, ui_name_, GroupType::Stick)
|
||||
{
|
||||
for (auto& named_direction : named_directions)
|
||||
controls.emplace_back(std::make_unique<Input>(named_direction));
|
||||
|
@ -16,7 +16,7 @@ Buttons::Buttons(const std::string& name_) : Buttons(name_, name_)
|
||||
}
|
||||
|
||||
Buttons::Buttons(const std::string& ini_name, const std::string& group_name)
|
||||
: ControlGroup(ini_name, group_name, GROUP_TYPE_BUTTONS)
|
||||
: ControlGroup(ini_name, group_name, GroupType::Buttons)
|
||||
{
|
||||
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Threshold"), 0.5));
|
||||
}
|
||||
|
@ -14,12 +14,13 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
ControlGroup::ControlGroup(const std::string& name_, const u32 type_)
|
||||
ControlGroup::ControlGroup(const std::string& name_, const GroupType type_)
|
||||
: name(name_), ui_name(name_), type(type_)
|
||||
{
|
||||
}
|
||||
|
||||
ControlGroup::ControlGroup(const std::string& name_, const std::string& ui_name_, const u32 type_)
|
||||
ControlGroup::ControlGroup(const std::string& name_, const std::string& ui_name_,
|
||||
const GroupType type_)
|
||||
: name(name_), ui_name(ui_name_), type(type_)
|
||||
{
|
||||
}
|
||||
@ -62,7 +63,7 @@ void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
}
|
||||
|
||||
// extensions
|
||||
if (type == GROUP_TYPE_EXTENSION)
|
||||
if (type == GroupType::Extension)
|
||||
{
|
||||
Extension* const ext = (Extension*)this;
|
||||
|
||||
@ -115,7 +116,7 @@ void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
}
|
||||
|
||||
// extensions
|
||||
if (type == GROUP_TYPE_EXTENSION)
|
||||
if (type == GroupType::Extension)
|
||||
{
|
||||
Extension* const ext = (Extension*)this;
|
||||
sec->Set(base + name, ext->attachments[ext->switch_extension]->GetName(), "None");
|
||||
|
@ -17,18 +17,18 @@ namespace ControllerEmu
|
||||
{
|
||||
class Control;
|
||||
|
||||
enum
|
||||
enum class GroupType
|
||||
{
|
||||
GROUP_TYPE_OTHER,
|
||||
GROUP_TYPE_STICK,
|
||||
GROUP_TYPE_MIXED_TRIGGERS,
|
||||
GROUP_TYPE_BUTTONS,
|
||||
GROUP_TYPE_FORCE,
|
||||
GROUP_TYPE_EXTENSION,
|
||||
GROUP_TYPE_TILT,
|
||||
GROUP_TYPE_CURSOR,
|
||||
GROUP_TYPE_TRIGGERS,
|
||||
GROUP_TYPE_SLIDER
|
||||
Other,
|
||||
Stick,
|
||||
MixedTriggers,
|
||||
Buttons,
|
||||
Force,
|
||||
Extension,
|
||||
Tilt,
|
||||
Cursor,
|
||||
Triggers,
|
||||
Slider
|
||||
};
|
||||
|
||||
class ControlGroup
|
||||
@ -102,8 +102,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
explicit ControlGroup(const std::string& name, u32 type = GROUP_TYPE_OTHER);
|
||||
ControlGroup(const std::string& name, const std::string& ui_name, u32 type = GROUP_TYPE_OTHER);
|
||||
explicit ControlGroup(const std::string& name, GroupType type = GroupType::Other);
|
||||
ControlGroup(const std::string& name, const std::string& ui_name,
|
||||
GroupType type = GroupType::Other);
|
||||
virtual ~ControlGroup();
|
||||
|
||||
virtual void LoadConfig(IniFile::Section* sec, const std::string& defdev = "",
|
||||
@ -115,7 +116,7 @@ public:
|
||||
|
||||
const std::string name;
|
||||
const std::string ui_name;
|
||||
const u32 type;
|
||||
const GroupType type;
|
||||
|
||||
std::vector<std::unique_ptr<Control>> controls;
|
||||
std::vector<std::unique_ptr<NumericSetting>> numeric_settings;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Cursor::Cursor(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_CURSOR)
|
||||
Cursor::Cursor(const std::string& name_) : ControlGroup(name_, GroupType::Cursor)
|
||||
{
|
||||
for (auto& named_direction : named_directions)
|
||||
controls.emplace_back(std::make_unique<Input>(named_direction));
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Extension::Extension(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_EXTENSION)
|
||||
Extension::Extension(const std::string& name_) : ControlGroup(name_, GroupType::Extension)
|
||||
{
|
||||
}
|
||||
} // namespace ControllerEmu
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Force::Force(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_FORCE)
|
||||
Force::Force(const std::string& name_) : ControlGroup(name_, GroupType::Force)
|
||||
{
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Up")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Down")));
|
||||
|
@ -17,7 +17,7 @@
|
||||
namespace ControllerEmu
|
||||
{
|
||||
MixedTriggers::MixedTriggers(const std::string& name_)
|
||||
: ControlGroup(name_, GROUP_TYPE_MIXED_TRIGGERS)
|
||||
: ControlGroup(name_, GroupType::MixedTriggers)
|
||||
{
|
||||
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Threshold"), 0.9));
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Slider::Slider(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_SLIDER)
|
||||
Slider::Slider(const std::string& name_) : ControlGroup(name_, GroupType::Slider)
|
||||
{
|
||||
controls.emplace_back(std::make_unique<Input>("Left"));
|
||||
controls.emplace_back(std::make_unique<Input>("Right"));
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Tilt::Tilt(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_TILT)
|
||||
Tilt::Tilt(const std::string& name_) : ControlGroup(name_, GroupType::Tilt)
|
||||
{
|
||||
controls.emplace_back(std::make_unique<Input>("Forward"));
|
||||
controls.emplace_back(std::make_unique<Input>("Backward"));
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
Triggers::Triggers(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_TRIGGERS)
|
||||
Triggers::Triggers(const std::string& name_) : ControlGroup(name_, GroupType::Triggers)
|
||||
{
|
||||
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void EmulatedController::UpdateReferences(const ControllerInterface& devi)
|
||||
control->control_ref.get()->UpdateReference(devi, default_device);
|
||||
|
||||
// extension
|
||||
if (ctrlGroup->type == GROUP_TYPE_EXTENSION)
|
||||
if (ctrlGroup->type == GroupType::Extension)
|
||||
{
|
||||
for (auto& attachment : ((Extension*)ctrlGroup.get())->attachments)
|
||||
attachment->UpdateReferences(devi);
|
||||
@ -52,7 +52,7 @@ void EmulatedController::UpdateDefaultDevice()
|
||||
for (auto& ctrlGroup : groups)
|
||||
{
|
||||
// extension
|
||||
if (ctrlGroup->type == GROUP_TYPE_EXTENSION)
|
||||
if (ctrlGroup->type == GroupType::Extension)
|
||||
{
|
||||
for (auto& ai : ((Extension*)ctrlGroup.get())->attachments)
|
||||
{
|
||||
|
Reference in New Issue
Block a user