ControllerEmu: Use make_unique over raw new
This commit is contained in:
parent
5464e698fc
commit
fa05710f2f
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <memory>
|
||||
#include "Common/Common.h"
|
||||
#include "InputCommon/ControllerEmu.h"
|
||||
|
||||
|
@ -151,64 +152,64 @@ ControllerEmu::AnalogStick::AnalogStick(const char* const _name, const char* con
|
|||
: ControlGroup(_name, _ui_name, GROUP_TYPE_STICK)
|
||||
{
|
||||
for (auto& named_direction : named_directions)
|
||||
controls.emplace_back(new Input(named_direction));
|
||||
controls.emplace_back(std::make_unique<Input>(named_direction));
|
||||
|
||||
controls.emplace_back(new Input(_trans("Modifier")));
|
||||
settings.emplace_back(new Setting(_trans("Radius"), default_radius, 0, 100));
|
||||
settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Modifier")));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Radius"), default_radius, 0, 100));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Buttons::Buttons(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_BUTTONS)
|
||||
{
|
||||
settings.emplace_back(new Setting(_trans("Threshold"), 0.5));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Threshold"), 0.5));
|
||||
}
|
||||
|
||||
ControllerEmu::MixedTriggers::MixedTriggers(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_MIXED_TRIGGERS)
|
||||
{
|
||||
settings.emplace_back(new Setting(_trans("Threshold"), 0.9));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Threshold"), 0.9));
|
||||
}
|
||||
|
||||
ControllerEmu::Triggers::Triggers(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_TRIGGERS)
|
||||
{
|
||||
settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Slider::Slider(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_SLIDER)
|
||||
{
|
||||
controls.emplace_back(new Input("Left"));
|
||||
controls.emplace_back(new Input("Right"));
|
||||
controls.emplace_back(std::make_unique<Input>("Left"));
|
||||
controls.emplace_back(std::make_unique<Input>("Right"));
|
||||
|
||||
settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Force::Force(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_FORCE)
|
||||
{
|
||||
memset(m_swing, 0, sizeof(m_swing));
|
||||
|
||||
controls.emplace_back(new Input(_trans("Up")));
|
||||
controls.emplace_back(new Input(_trans("Down")));
|
||||
controls.emplace_back(new Input(_trans("Left")));
|
||||
controls.emplace_back(new Input(_trans("Right")));
|
||||
controls.emplace_back(new Input(_trans("Forward")));
|
||||
controls.emplace_back(new Input(_trans("Backward")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Up")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Down")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Left")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Right")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Forward")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Backward")));
|
||||
|
||||
settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Dead Zone"), 0, 0, 50));
|
||||
}
|
||||
|
||||
ControllerEmu::Tilt::Tilt(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_TILT)
|
||||
{
|
||||
memset(m_tilt, 0, sizeof(m_tilt));
|
||||
|
||||
controls.emplace_back(new Input("Forward"));
|
||||
controls.emplace_back(new Input("Backward"));
|
||||
controls.emplace_back(new Input("Left"));
|
||||
controls.emplace_back(new Input("Right"));
|
||||
controls.emplace_back(std::make_unique<Input>("Forward"));
|
||||
controls.emplace_back(std::make_unique<Input>("Backward"));
|
||||
controls.emplace_back(std::make_unique<Input>("Left"));
|
||||
controls.emplace_back(std::make_unique<Input>("Right"));
|
||||
|
||||
controls.emplace_back(new Input(_trans("Modifier")));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Modifier")));
|
||||
|
||||
settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.emplace_back(new Setting(_trans("Circle Stick"), 0));
|
||||
settings.emplace_back(new Setting(_trans("Angle"), 0.9, 0, 180));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Circle Stick"), 0));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Angle"), 0.9, 0, 180));
|
||||
}
|
||||
|
||||
ControllerEmu::Cursor::Cursor(const std::string& _name)
|
||||
|
@ -216,14 +217,14 @@ ControllerEmu::Cursor::Cursor(const std::string& _name)
|
|||
, m_z(0)
|
||||
{
|
||||
for (auto& named_direction : named_directions)
|
||||
controls.emplace_back(new Input(named_direction));
|
||||
controls.emplace_back(new Input("Forward"));
|
||||
controls.emplace_back(new Input("Backward"));
|
||||
controls.emplace_back(new Input(_trans("Hide")));
|
||||
controls.emplace_back(std::make_unique<Input>(named_direction));
|
||||
controls.emplace_back(std::make_unique<Input>("Forward"));
|
||||
controls.emplace_back(std::make_unique<Input>("Backward"));
|
||||
controls.emplace_back(std::make_unique<Input>(_trans("Hide")));
|
||||
|
||||
settings.emplace_back(new Setting(_trans("Center"), 0.5));
|
||||
settings.emplace_back(new Setting(_trans("Width"), 0.5));
|
||||
settings.emplace_back(new Setting(_trans("Height"), 0.5));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Center"), 0.5));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Width"), 0.5));
|
||||
settings.emplace_back(std::make_unique<Setting>(_trans("Height"), 0.5));
|
||||
}
|
||||
|
||||
void ControllerEmu::LoadDefaults(const ControllerInterface &ciface)
|
||||
|
|
Loading…
Reference in New Issue