mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
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:
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "InputCommon/ControlReference/ControlReference.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
@ -52,4 +53,40 @@ private:
|
||||
const ControlState m_half_width;
|
||||
};
|
||||
|
||||
class ReshapableInput : public ControlGroup
|
||||
{
|
||||
public:
|
||||
ReshapableInput(std::string name, std::string ui_name, GroupType type);
|
||||
|
||||
struct StateData
|
||||
{
|
||||
ControlState x{};
|
||||
ControlState y{};
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SETTING_INPUT_RADIUS,
|
||||
SETTING_INPUT_SHAPE,
|
||||
SETTING_DEADZONE,
|
||||
SETTING_COUNT,
|
||||
};
|
||||
|
||||
// Angle is in radians and should be non-negative
|
||||
ControlState GetDeadzoneRadiusAtAngle(double ang) const;
|
||||
ControlState GetInputRadiusAtAngle(double ang) const;
|
||||
|
||||
virtual ControlState GetGateRadiusAtAngle(double ang) const = 0;
|
||||
virtual StateData GetState(bool adjusted = true) = 0;
|
||||
|
||||
protected:
|
||||
void AddReshapingSettings(ControlState default_radius, ControlState default_shape,
|
||||
int max_deadzone);
|
||||
|
||||
StateData Reshape(ControlState x, ControlState y, ControlState modifier = 0.0);
|
||||
|
||||
private:
|
||||
ControlState CalculateInputShapeRadiusAtAngle(double ang) const;
|
||||
};
|
||||
|
||||
} // namespace ControllerEmu
|
||||
|
Reference in New Issue
Block a user