WiimoteEmu: Allow shake frequency and intensity to be configured. Other minor cleanups.

This commit is contained in:
Jordan Woyak
2019-03-29 14:39:48 -05:00
parent 635fd8c22c
commit c89ddf8cba
24 changed files with 285 additions and 313 deletions

View File

@ -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;