mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
WiimoteEmu: Allow shake frequency and intensity to be configured. Other minor cleanups.
This commit is contained in:
@ -4,8 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
@ -35,7 +37,8 @@ enum class GroupType
|
||||
Tilt,
|
||||
Cursor,
|
||||
Triggers,
|
||||
Slider
|
||||
Slider,
|
||||
Shake,
|
||||
};
|
||||
|
||||
class ControlGroup
|
||||
@ -64,6 +67,12 @@ public:
|
||||
|
||||
void AddDeadzoneSetting(SettingValue<double>* value, double maximum_deadzone);
|
||||
|
||||
template <typename T>
|
||||
static T ApplyDeadzone(T input, std::common_type_t<T> deadzone)
|
||||
{
|
||||
return std::copysign(std::max(T{0}, std::abs(input) - deadzone) / (T{1} - deadzone), input);
|
||||
}
|
||||
|
||||
const std::string name;
|
||||
const std::string ui_name;
|
||||
const GroupType type;
|
||||
|
Reference in New Issue
Block a user