From a943450dd74637dc58dfebaf5c157cad2fa1e321 Mon Sep 17 00:00:00 2001 From: Ricardo Antunes Date: Sat, 30 Sep 2023 19:46:12 +0100 Subject: [PATCH] fix(input): do not use std::clamp --- engine/src/cubos/engine/input/axis.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engine/src/cubos/engine/input/axis.cpp b/engine/src/cubos/engine/input/axis.cpp index 14b6d28a4..80c5d2334 100644 --- a/engine/src/cubos/engine/input/axis.cpp +++ b/engine/src/cubos/engine/input/axis.cpp @@ -1,3 +1,5 @@ +#include + #include #include @@ -45,9 +47,11 @@ float InputAxis::value() const void InputAxis::value(float value) { - if (std::abs(value) > 1.0F) + mValue = value; + + if (std::abs(mValue) > 1.0F) { - CUBOS_WARN("Axis value out of range: {}", value); + CUBOS_WARN("Axis value out of range: {}", mValue); + mValue = mValue > 1.0F ? 1.0F : -1.0F; } - mValue = std::clamp(value, -1.0F, 1.0F); }