mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
InputCommon: move Setting classes out of ControlGroup
This commit is contained in:
@ -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
|
15
Source/Core/InputCommon/ControllerEmu/Setting/Setting.h
Normal file
15
Source/Core/InputCommon/ControllerEmu/Setting/Setting.h
Normal file
@ -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
|
Reference in New Issue
Block a user