ControllerEmu: Reorganize stick reshaping code and use it for emu wiimote tilt as well. Also make the tilt mapping indicator pretty.

This commit is contained in:
Jordan Woyak
2018-12-29 16:06:03 -06:00
parent 6a6195f53c
commit c3dc3c106c
8 changed files with 189 additions and 164 deletions

View File

@ -4,26 +4,32 @@
#pragma once
#include <chrono>
#include <string>
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
#include "InputCommon/ControllerEmu/StickGate.h"
#include "InputCommon/ControllerInterface/Device.h"
namespace ControllerEmu
{
class Tilt : public ControlGroup
class Tilt : public ReshapableInput
{
public:
struct StateData
enum
{
ControlState x{};
ControlState y{};
SETTING_MAX_ANGLE = ReshapableInput::SETTING_COUNT,
};
explicit Tilt(const std::string& name);
StateData GetState(bool step = true);
StateData GetState(bool adjusted = true);
ControlState GetGateRadiusAtAngle(double ang) const override;
private:
typedef std::chrono::steady_clock Clock;
StateData m_tilt;
Clock::time_point m_last_update;
};
} // namespace ControllerEmu