ControllerInterface: Input detection improvements.

This commit is contained in:
Jordan Woyak 2019-02-26 19:46:21 -06:00
parent 13b2b93d3d
commit 48b69ca018
7 changed files with 90 additions and 60 deletions

View file

@ -4,6 +4,7 @@
#include "InputCommon/ControllerInterface/Device.h"
#include <cmath>
#include <memory>
#include <sstream>
#include <string>
@ -68,6 +69,11 @@ Device::Output* Device::FindOutput(const std::string& name) const
return nullptr;
}
ControlState Device::FullAnalogSurface::GetState() const
{
return (1 + std::max(0.0, m_high.GetState()) - std::max(0.0, m_low.GetState())) / 2;
}
//
// DeviceQualifier :: ToString
//
@ -214,5 +220,5 @@ bool DeviceContainer::HasConnectedDevice(const DeviceQualifier& qualifier) const
const auto device = FindDevice(qualifier);
return device != nullptr && device->IsValid();
}
}
}
} // namespace Core
} // namespace ciface