2017-02-09 03:15:43 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-02-09 03:15:43 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
2018-12-21 22:11:00 +00:00
|
|
|
#include "InputCommon/ControllerEmu/StickGate.h"
|
2020-09-15 11:34:41 +00:00
|
|
|
#include "InputCommon/ControllerInterface/CoreDevice.h"
|
2017-02-09 03:15:43 +00:00
|
|
|
|
|
|
|
namespace ControllerEmu
|
|
|
|
{
|
2018-12-29 22:06:03 +00:00
|
|
|
class AnalogStick : public ReshapableInput
|
2017-02-09 03:15:43 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-12-30 16:52:45 +00:00
|
|
|
using StateData = ReshapeData;
|
2018-12-30 15:10:32 +00:00
|
|
|
|
2018-12-19 02:06:16 +00:00
|
|
|
AnalogStick(const char* name, std::unique_ptr<StickGate>&& stick_gate);
|
|
|
|
AnalogStick(const char* name, const char* ui_name, std::unique_ptr<StickGate>&& stick_gate);
|
|
|
|
|
2021-05-04 20:47:55 +00:00
|
|
|
ReshapeData GetReshapableState(bool adjusted) const final override;
|
2018-12-29 22:06:03 +00:00
|
|
|
ControlState GetGateRadiusAtAngle(double ang) const override;
|
2018-12-19 02:06:16 +00:00
|
|
|
|
2021-05-04 20:47:55 +00:00
|
|
|
StateData GetState() const;
|
2021-03-21 19:27:00 +00:00
|
|
|
StateData GetState(const InputOverrideFunction& override_func) const;
|
|
|
|
StateData GetState(const InputOverrideFunction& override_func, bool* override_occurred) const;
|
2018-12-30 15:10:32 +00:00
|
|
|
|
2018-12-19 02:06:16 +00:00
|
|
|
private:
|
2022-01-04 20:09:50 +00:00
|
|
|
Control* GetModifierInput() const override;
|
|
|
|
|
2018-12-19 02:06:16 +00:00
|
|
|
std::unique_ptr<StickGate> m_stick_gate;
|
2017-02-09 03:15:43 +00:00
|
|
|
};
|
2018-12-19 02:06:16 +00:00
|
|
|
|
|
|
|
// An AnalogStick with an OctagonStickGate
|
|
|
|
class OctagonAnalogStick : public AnalogStick
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OctagonAnalogStick(const char* name, ControlState gate_radius);
|
|
|
|
OctagonAnalogStick(const char* name, const char* ui_name, ControlState gate_radius);
|
2020-10-29 22:11:34 +00:00
|
|
|
|
|
|
|
ControlState GetVirtualNotchSize() const override;
|
2022-05-20 03:19:17 +00:00
|
|
|
ControlState GetGateRadiusAtAngle(double ang) const override;
|
2020-10-29 22:11:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SettingValue<double> m_virtual_notch_setting;
|
2022-05-20 03:19:17 +00:00
|
|
|
SettingValue<double> m_gate_size_setting;
|
2018-12-19 02:06:16 +00:00
|
|
|
};
|
|
|
|
|
2017-02-09 03:15:43 +00:00
|
|
|
} // namespace ControllerEmu
|