From f07457b6ccb0ef6773b08c0e494df28a29c1b3e6 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 8 Feb 2020 20:36:26 -0600 Subject: InputCommon: Eliminate some duplicated button threshold logic. --- .../Core/InputCommon/ControlReference/ControlReference.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Source/Core/InputCommon/ControlReference/ControlReference.h') diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.h b/Source/Core/InputCommon/ControlReference/ControlReference.h index 80c4a65d51..de289ba265 100644 --- a/Source/Core/InputCommon/ControlReference/ControlReference.h +++ b/Source/Core/InputCommon/ControlReference/ControlReference.h @@ -4,10 +4,10 @@ #pragma once +#include #include #include "InputCommon/ControlReference/ExpressionParser.h" -#include "InputCommon/ControlReference/FunctionExpression.h" #include "InputCommon/ControllerInterface/Device.h" // ControlReference @@ -52,11 +52,18 @@ protected: template <> inline bool ControlReference::GetState() { - return State() > ciface::ExpressionParser::CONDITION_THRESHOLD; + // Round to nearest of 0 or 1. + return std::lround(State()) > 0; } -template -T ControlReference::GetState() +template <> +inline int ControlReference::GetState() +{ + return std::lround(State()); +} + +template <> +inline ControlState ControlReference::GetState() { return State(); } -- cgit v1.2.3