Merge pull request #4975 from ligfx/controlsetting
InputCommon: move Setting classes out of ControlGroup
This commit is contained in:
commit
51e932b4ec
|
@ -10,6 +10,8 @@
|
|||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/KeyboardStatus.h"
|
||||
|
||||
static const u16 keys0_bitmasks[] = {KEYMASK_HOME, KEYMASK_END, KEYMASK_PGUP, KEYMASK_PGDN,
|
||||
|
@ -80,11 +82,9 @@ GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index)
|
|||
// options
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BackgroundInputSetting>(
|
||||
_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::ControlGroup::SettingType::VIRTUAL));
|
||||
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL));
|
||||
}
|
||||
|
||||
std::string GCKeyboard::GetName() const
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
static const u16 button_bitmasks[] = {
|
||||
|
@ -78,11 +80,9 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
|
|||
// options
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BackgroundInputSetting>(
|
||||
_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::ControlGroup::SettingType::VIRTUAL));
|
||||
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL));
|
||||
}
|
||||
|
||||
std::string GCPad::GetName() const
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
//#define WIIMOTE_SPEAKER_DUMP
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
#include "InputCommon/ControllerEmu/ControlGroup/Force.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Tilt.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -280,7 +283,7 @@ Wiimote::Wiimote(const unsigned int index)
|
|||
m_extension->attachments.emplace_back(new WiimoteEmu::Turntable(m_reg_ext));
|
||||
|
||||
m_extension->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(_trans("Motion Plus"), false));
|
||||
std::make_unique<ControllerEmu::BooleanSetting>(_trans("Motion Plus"), false));
|
||||
|
||||
// rumble
|
||||
groups.emplace_back(m_rumble = new ControllerEmu::ControlGroup(_trans("Rumble")));
|
||||
|
@ -294,23 +297,17 @@ Wiimote::Wiimote(const unsigned int index)
|
|||
// options
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BackgroundInputSetting>(
|
||||
_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
"Sideways Wiimote", _trans("Sideways Wii Remote"), false));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
"Upright Wiimote", _trans("Upright Wii Remote"), false));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::ControlGroup::SettingType::VIRTUAL));
|
||||
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
|
||||
"Sideways Wiimote", _trans("Sideways Wii Remote"), false));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
|
||||
"Upright Wiimote", _trans("Upright Wii Remote"), false));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL));
|
||||
m_options->numeric_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::NumericSetting>(_trans("Speaker Pan"), 0, -127,
|
||||
127));
|
||||
std::make_unique<ControllerEmu::NumericSetting>(_trans("Speaker Pan"), 0, -127, 127));
|
||||
m_options->numeric_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::NumericSetting>(_trans("Battery"), 95.0 / 100,
|
||||
0, 255));
|
||||
std::make_unique<ControllerEmu::NumericSetting>(_trans("Battery"), 95.0 / 100, 0, 255));
|
||||
|
||||
// hotkeys
|
||||
groups.emplace_back(m_hotkeys = new ControllerEmu::ModifySettingsButton(_trans("Hotkeys")));
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
const std::string hotkey_labels[] = {
|
||||
|
@ -273,11 +275,9 @@ HotkeyManager::HotkeyManager()
|
|||
|
||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BackgroundInputSetting>(
|
||||
_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(
|
||||
std::make_unique<ControllerEmu::ControlGroup::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::ControlGroup::SettingType::VIRTUAL));
|
||||
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
|
||||
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
|
||||
_trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL));
|
||||
}
|
||||
|
||||
HotkeyManager::~HotkeyManager()
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Extension.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
@ -144,7 +146,7 @@ void PadSettingExtension::UpdateValue()
|
|||
}
|
||||
|
||||
PadSettingCheckBox::PadSettingCheckBox(wxWindow* const parent,
|
||||
ControllerEmu::ControlGroup::BooleanSetting* const _setting)
|
||||
ControllerEmu::BooleanSetting* const _setting)
|
||||
: PadSetting(
|
||||
new wxCheckBox(parent, wxID_ANY, wxGetTranslation(StrToWxStr(_setting->m_ui_name)))),
|
||||
setting(_setting)
|
||||
|
@ -167,7 +169,7 @@ void PadSettingCheckBox::UpdateValue()
|
|||
}
|
||||
|
||||
PadSettingSpin::PadSettingSpin(wxWindow* const parent,
|
||||
ControllerEmu::ControlGroup::NumericSetting* const settings)
|
||||
ControllerEmu::NumericSetting* const settings)
|
||||
: PadSetting(new wxSpinCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, settings->m_low, settings->m_high,
|
||||
(int)(settings->m_value * 100))),
|
||||
|
|
|
@ -67,23 +67,21 @@ public:
|
|||
class PadSettingSpin : public PadSetting
|
||||
{
|
||||
public:
|
||||
PadSettingSpin(wxWindow* const parent,
|
||||
ControllerEmu::ControlGroup::NumericSetting* const setting);
|
||||
PadSettingSpin(wxWindow* const parent, ControllerEmu::NumericSetting* const setting);
|
||||
void UpdateGUI() override;
|
||||
void UpdateValue() override;
|
||||
|
||||
ControllerEmu::ControlGroup::NumericSetting* const setting;
|
||||
ControllerEmu::NumericSetting* const setting;
|
||||
};
|
||||
|
||||
class PadSettingCheckBox : public PadSetting
|
||||
{
|
||||
public:
|
||||
PadSettingCheckBox(wxWindow* const parent,
|
||||
ControllerEmu::ControlGroup::BooleanSetting* const setting);
|
||||
PadSettingCheckBox(wxWindow* const parent, ControllerEmu::BooleanSetting* const setting);
|
||||
void UpdateGUI() override;
|
||||
void UpdateValue() override;
|
||||
|
||||
ControllerEmu::ControlGroup::BooleanSetting* const setting;
|
||||
ControllerEmu::BooleanSetting* const setting;
|
||||
};
|
||||
|
||||
class InputEventFilter : public wxEventFilter
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
WiimoteInputConfigDialog::WiimoteInputConfigDialog(wxWindow* const parent, InputConfig& config,
|
||||
const wxString& name, const int port_num)
|
||||
: InputConfigDialog(parent, config, name, port_num)
|
||||
|
|
|
@ -14,6 +14,9 @@ set(SRCS InputConfig.cpp
|
|||
ControllerEmu/ControlGroup/Slider.cpp
|
||||
ControllerEmu/ControlGroup/Tilt.cpp
|
||||
ControllerEmu/ControlGroup/Triggers.cpp
|
||||
ControllerEmu/Setting/BackgroundInputSetting.cpp
|
||||
ControllerEmu/Setting/BooleanSetting.cpp
|
||||
ControllerEmu/Setting/NumericSetting.cpp
|
||||
ControllerInterface/ControllerInterface.cpp
|
||||
ControllerInterface/Device.cpp
|
||||
ControlReference/ControlReference.cpp
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Extension.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
@ -27,8 +29,6 @@ ControlGroup::ControlGroup(const std::string& name_, const std::string& ui_name_
|
|||
|
||||
ControlGroup::~ControlGroup() = default;
|
||||
|
||||
ControlGroup::BooleanSetting::~BooleanSetting() = default;
|
||||
|
||||
void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
const std::string& base)
|
||||
{
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class BooleanSetting;
|
||||
class Control;
|
||||
class NumericSetting;
|
||||
|
||||
enum class GroupType
|
||||
{
|
||||
|
@ -34,74 +35,6 @@ enum class GroupType
|
|||
class ControlGroup
|
||||
{
|
||||
public:
|
||||
enum class SettingType
|
||||
{
|
||||
NORMAL, // normal settings are saved to configuration files
|
||||
VIRTUAL, // virtual settings are not saved at all
|
||||
};
|
||||
|
||||
class NumericSetting
|
||||
{
|
||||
public:
|
||||
NumericSetting(const std::string& setting_name, const ControlState default_value,
|
||||
const u32 low = 0, const u32 high = 100,
|
||||
const SettingType setting_type = SettingType::NORMAL)
|
||||
: m_type(setting_type), m_name(setting_name), m_default_value(default_value), m_low(low),
|
||||
m_high(high)
|
||||
{
|
||||
}
|
||||
|
||||
ControlState GetValue() const { return m_value; }
|
||||
void SetValue(ControlState value) { m_value = value; }
|
||||
const SettingType m_type;
|
||||
const std::string m_name;
|
||||
const ControlState m_default_value;
|
||||
const u32 m_low;
|
||||
const u32 m_high;
|
||||
ControlState m_value;
|
||||
};
|
||||
|
||||
class BooleanSetting
|
||||
{
|
||||
public:
|
||||
BooleanSetting(const std::string& setting_name, const std::string& ui_name,
|
||||
const bool default_value, const SettingType setting_type = SettingType::NORMAL)
|
||||
: m_type(setting_type), m_name(setting_name), m_ui_name(ui_name),
|
||||
m_default_value(default_value)
|
||||
{
|
||||
}
|
||||
BooleanSetting(const std::string& setting_name, const bool default_value,
|
||||
const SettingType setting_type = SettingType::NORMAL)
|
||||
: BooleanSetting(setting_name, setting_name, default_value, setting_type)
|
||||
{
|
||||
}
|
||||
virtual ~BooleanSetting();
|
||||
|
||||
virtual bool GetValue() const { return m_value; }
|
||||
virtual void SetValue(bool value) { m_value = value; }
|
||||
const SettingType m_type;
|
||||
const std::string m_name;
|
||||
const std::string m_ui_name;
|
||||
const bool m_default_value;
|
||||
bool m_value;
|
||||
};
|
||||
|
||||
class BackgroundInputSetting : public BooleanSetting
|
||||
{
|
||||
public:
|
||||
BackgroundInputSetting(const std::string& setting_name)
|
||||
: BooleanSetting(setting_name, false, SettingType::VIRTUAL)
|
||||
{
|
||||
}
|
||||
|
||||
bool GetValue() const override { return SConfig::GetInstance().m_BackgroundInput; }
|
||||
void SetValue(bool value) override
|
||||
{
|
||||
m_value = value;
|
||||
SConfig::GetInstance().m_BackgroundInput = value;
|
||||
}
|
||||
};
|
||||
|
||||
explicit ControlGroup(const std::string& name, GroupType type = GroupType::Other);
|
||||
ControlGroup(const std::string& name, const std::string& ui_name,
|
||||
GroupType type = GroupType::Other);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "Common/Common.h"
|
||||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/Control/Control.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/Setting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
BackgroundInputSetting::BackgroundInputSetting(const std::string& setting_name)
|
||||
: BooleanSetting(setting_name, false, SettingType::VIRTUAL)
|
||||
{
|
||||
}
|
||||
|
||||
bool BackgroundInputSetting::GetValue() const
|
||||
{
|
||||
return SConfig::GetInstance().m_BackgroundInput;
|
||||
}
|
||||
void BackgroundInputSetting::SetValue(bool value)
|
||||
{
|
||||
m_value = value;
|
||||
SConfig::GetInstance().m_BackgroundInput = value;
|
||||
}
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class BackgroundInputSetting : public BooleanSetting
|
||||
{
|
||||
public:
|
||||
BackgroundInputSetting(const std::string& setting_name);
|
||||
|
||||
bool GetValue() const override;
|
||||
void SetValue(bool value) override;
|
||||
};
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
BooleanSetting::BooleanSetting(const std::string& setting_name, const std::string& ui_name,
|
||||
const bool default_value, const SettingType setting_type)
|
||||
: m_type(setting_type), m_name(setting_name), m_ui_name(ui_name), m_default_value(default_value)
|
||||
{
|
||||
}
|
||||
|
||||
BooleanSetting::BooleanSetting(const std::string& setting_name, const bool default_value,
|
||||
const SettingType setting_type)
|
||||
: BooleanSetting(setting_name, setting_name, default_value, setting_type)
|
||||
{
|
||||
}
|
||||
|
||||
BooleanSetting::~BooleanSetting() = default;
|
||||
|
||||
bool BooleanSetting::GetValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
void BooleanSetting::SetValue(bool value)
|
||||
{
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/Setting.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class BooleanSetting
|
||||
{
|
||||
public:
|
||||
BooleanSetting(const std::string& setting_name, const std::string& ui_name,
|
||||
const bool default_value, const SettingType setting_type = SettingType::NORMAL);
|
||||
BooleanSetting(const std::string& setting_name, const bool default_value,
|
||||
const SettingType setting_type = SettingType::NORMAL);
|
||||
virtual ~BooleanSetting();
|
||||
|
||||
virtual bool GetValue() const;
|
||||
virtual void SetValue(bool value);
|
||||
const SettingType m_type;
|
||||
const std::string m_name;
|
||||
const std::string m_ui_name;
|
||||
const bool m_default_value;
|
||||
bool m_value;
|
||||
};
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
NumericSetting::NumericSetting(const std::string& setting_name, const ControlState default_value,
|
||||
const u32 low, const u32 high, const SettingType setting_type)
|
||||
: m_type(setting_type), m_name(setting_name), m_default_value(default_value), m_low(low),
|
||||
m_high(high)
|
||||
{
|
||||
}
|
||||
|
||||
ControlState NumericSetting::GetValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
void NumericSetting::SetValue(ControlState value)
|
||||
{
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/Setting.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class NumericSetting
|
||||
{
|
||||
public:
|
||||
NumericSetting(const std::string& setting_name, const ControlState default_value,
|
||||
const u32 low = 0, const u32 high = 100,
|
||||
const SettingType setting_type = SettingType::NORMAL);
|
||||
|
||||
ControlState GetValue() const;
|
||||
void SetValue(ControlState value);
|
||||
const SettingType m_type;
|
||||
const std::string m_name;
|
||||
const ControlState m_default_value;
|
||||
const u32 m_low;
|
||||
const u32 m_high;
|
||||
ControlState m_value;
|
||||
};
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2017 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
enum class SettingType
|
||||
{
|
||||
NORMAL, // normal settings are saved to configuration files
|
||||
VIRTUAL, // virtual settings are not saved at all
|
||||
};
|
||||
|
||||
} // namespace ControllerEmu
|
|
@ -50,6 +50,9 @@
|
|||
<ClCompile Include="ControllerEmu\ControlGroup\Slider.cpp" />
|
||||
<ClCompile Include="ControllerEmu\ControlGroup\Tilt.cpp" />
|
||||
<ClCompile Include="ControllerEmu\ControlGroup\Triggers.cpp" />
|
||||
<ClCompile Include="ControllerEmu\Setting\BackgroundInputSetting.cpp" />
|
||||
<ClCompile Include="ControllerEmu\Setting\BooleanSetting.cpp" />
|
||||
<ClCompile Include="ControllerEmu\Setting\NumericSetting.cpp" />
|
||||
<ClCompile Include="ControllerInterface\ControllerInterface.cpp" />
|
||||
<ClCompile Include="ControllerInterface\Device.cpp" />
|
||||
<ClCompile Include="ControllerInterface\DInput\DInput.cpp" />
|
||||
|
@ -85,6 +88,10 @@
|
|||
<ClInclude Include="ControllerEmu\ControlGroup\Slider.h" />
|
||||
<ClInclude Include="ControllerEmu\ControlGroup\Tilt.h" />
|
||||
<ClInclude Include="ControllerEmu\ControlGroup\Triggers.h" />
|
||||
<ClInclude Include="ControllerEmu\Setting\BackgroundInputSetting.h" />
|
||||
<ClInclude Include="ControllerEmu\Setting\BooleanSetting.h" />
|
||||
<ClInclude Include="ControllerEmu\Setting\NumericSetting.h" />
|
||||
<ClInclude Include="ControllerEmu\Setting\Setting.h" />
|
||||
<ClInclude Include="ControllerInterface\ControllerInterface.h" />
|
||||
<ClInclude Include="ControllerInterface\Device.h" />
|
||||
<ClInclude Include="ControllerInterface\DInput\DInput.h" />
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
<Filter Include="ControllerEmu\ControlGroup">
|
||||
<UniqueIdentifier>{e805231c-dc4e-4540-8bf8-8c567f3d00ae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ControllerEmu\Setting">
|
||||
<UniqueIdentifier>{ce661cb4-f23f-4ab2-952d-402d381735e5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="GCAdapter.cpp" />
|
||||
|
@ -71,6 +74,15 @@
|
|||
<ClCompile Include="ControllerEmu\ControlGroup\Triggers.cpp">
|
||||
<Filter>ControllerEmu\ControlGroup</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControllerEmu\Setting\BackgroundInputSetting.cpp">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControllerEmu\Setting\BooleanSetting.cpp">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControllerEmu\Setting\NumericSetting.cpp">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ControllerInterface\DInput\DInput.cpp">
|
||||
<Filter>ControllerInterface\DInput</Filter>
|
||||
</ClCompile>
|
||||
|
@ -151,6 +163,18 @@
|
|||
<ClInclude Include="ControllerEmu\ControlGroup\Triggers.h">
|
||||
<Filter>ControllerEmu\ControlGroup</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ControllerEmu\Setting\BackgroundInputSetting.h">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ControllerEmu\Setting\BooleanSetting.h">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ControllerEmu\Setting\NumericSetting.h">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ControllerEmu\Setting\Setting.h">
|
||||
<Filter>ControllerEmu\Setting</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ControllerInterface\DInput\DInput.h">
|
||||
<Filter>ControllerInterface\DInput</Filter>
|
||||
</ClInclude>
|
||||
|
@ -188,4 +212,4 @@
|
|||
<ItemGroup>
|
||||
<Text Include="CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue