summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.h
blob: 8815cffa733ffd62edd71d31c2ad234f0f8596d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <array>
#include <string>

#include "Common/Matrix.h"
#include "InputCommon/ControllerEmu/StickGate.h"

namespace ControllerEmu
{
class Force : public ReshapableInput
{
public:
  using StateData = Common::Vec3;

  explicit Force(const std::string& name);

  ReshapeData GetReshapableState(bool adjusted) const final override;
  ControlState GetGateRadiusAtAngle(double ang) const final override;

  ControlState GetDefaultInputRadiusAtAngle(double angle) const final override;

  StateData GetState(bool adjusted = true) const;

  // Velocities returned in m/s.
  ControlState GetSpeed() const;
  ControlState GetReturnSpeed() const;

  // Return twist angle in radians.
  ControlState GetTwistAngle() const;

  // Return swing distance in meters.
  ControlState GetMaxDistance() const;

private:
  SettingValue<double> m_distance_setting;
  SettingValue<double> m_speed_setting;
  SettingValue<double> m_return_speed_setting;
  SettingValue<double> m_angle_setting;
};

class Shake : public ControlGroup
{
public:
  using StateData = Common::Vec3;

  explicit Shake(const std::string& name, ControlState default_intensity_scale = 1);

  StateData GetState(bool adjusted = true) const;

  ControlState GetDeadzone() const;

  // Return total travel distance in meters.
  ControlState GetIntensity() const;

  // Return frequency in Hz.
  ControlState GetFrequency() const;

private:
  SettingValue<double> m_deadzone_setting;
  SettingValue<double> m_intensity_setting;
  SettingValue<double> m_frequency_setting;
};

}  // namespace ControllerEmu