summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/Device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Device.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Device.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp
index b8d73d9ab8..efe1372711 100644
--- a/Source/Core/InputCommon/ControllerInterface/Device.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp
@@ -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