diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2017-12-26 00:38:44 +0100 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2019-05-04 23:12:17 +0200 |
| commit | ab9ece9bcab8a6d55dbe6f3a904d49231e5f73e1 (patch) | |
| tree | 3993f73a513f6f80ecddff85882042b73da261da /Source/Core/InputCommon | |
| parent | 6f84984b7b0514227327b2e2c5ef10907d150b96 (diff) | |
Replace MathUtil::Clamp with std::clamp
Diffstat (limited to 'Source/Core/InputCommon')
4 files changed, 9 insertions, 7 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp index dd5bc87887..410cf87b33 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp @@ -109,7 +109,7 @@ Cursor::StateData Cursor::GetState(const bool adjusted) // Smooth out z movement: // FYI: Not using relative input for Z. - m_state.z += MathUtil::Clamp(z - m_state.z, -max_z_step, max_z_step); + m_state.z += std::clamp(z - m_state.z, -max_z_step, max_z_step); // Relative input: if (m_relative_setting.GetValue()) @@ -122,8 +122,8 @@ Cursor::StateData Cursor::GetState(const bool adjusted) } else { - m_state.x = MathUtil::Clamp(m_state.x + input.x * max_step, -1.0, 1.0); - m_state.y = MathUtil::Clamp(m_state.y + input.y * max_step, -1.0, 1.0); + m_state.x = std::clamp(m_state.x + input.x * max_step, -1.0, 1.0); + m_state.y = std::clamp(m_state.y + input.y * max_step, -1.0, 1.0); } } // Absolute input: diff --git a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp index 48c21ae5be..70ed383398 100644 --- a/Source/Core/InputCommon/ControllerEmu/StickGate.cpp +++ b/Source/Core/InputCommon/ControllerEmu/StickGate.cpp @@ -4,6 +4,7 @@ #include "InputCommon/ControllerEmu/StickGate.h" +#include <algorithm> #include <cmath> #include "Common/Common.h" @@ -277,8 +278,8 @@ ReshapableInput::ReshapeData ReshapableInput::Reshape(ControlState x, ControlSta // Scale to the gate shape/radius: dist *= gate_max_dist; - return {MathUtil::Clamp(std::cos(angle) * dist, -1.0, 1.0), - MathUtil::Clamp(std::sin(angle) * dist, -1.0, 1.0)}; + return {std::clamp(std::cos(angle) * dist, -1.0, 1.0), + std::clamp(std::sin(angle) * dist, -1.0, 1.0)}; } } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp index 8b885cad68..1cb76b2d25 100644 --- a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include <algorithm> #include <array> #include <cstdlib> #include <fcntl.h> @@ -15,7 +16,6 @@ #include <vector> #include "Common/FileUtil.h" -#include "Common/MathUtil.h" #include "Common/StringUtil.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/Pipes/Pipes.h" @@ -123,7 +123,7 @@ void PipeDevice::AddAxis(const std::string& name, double value) void PipeDevice::SetAxis(const std::string& entry, double value) { - value = MathUtil::Clamp(value, 0.0, 1.0); + value = std::clamp(value, 0.0, 1.0); double hi = std::max(0.0, value - 0.5) * 2.0; double lo = (0.5 - std::min(0.5, value)) * 2.0; auto search_hi = m_axes.find(entry + " +"); diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index f84f3b01c6..da1e5fc918 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include <algorithm> #include <cstring> #include <fcntl.h> #include <libudev.h> |
