mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-10 12:21:39 +00:00
ControllerInterface: Input detection improvements.
This commit is contained in:
parent
13b2b93d3d
commit
48b69ca018
7 changed files with 90 additions and 60 deletions
|
@ -217,7 +217,19 @@ public:
|
|||
std::shared_ptr<Device> m_device;
|
||||
|
||||
explicit ControlExpression(ControlQualifier qualifier_) : qualifier(qualifier_) {}
|
||||
ControlState GetValue() const override { return control ? control->ToInput()->GetState() : 0.0; }
|
||||
ControlState GetValue() const override
|
||||
{
|
||||
if (!control)
|
||||
return 0.0;
|
||||
|
||||
// Note: Inputs may return negative values in situations where opposing directions are
|
||||
// activated. We clamp off the negative values here.
|
||||
|
||||
// FYI: Clamping values greater than 1.0 is purposely not done to support unbounded values in
|
||||
// the future. (e.g. raw accelerometer/gyro data)
|
||||
|
||||
return std::max(0.0, control->ToInput()->GetState());
|
||||
}
|
||||
void SetValue(ControlState value) override
|
||||
{
|
||||
if (control)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue