libretro: Replace std::clamp() with clamp()

This commit is contained in:
Rob Loach committed 2024-05-23 12:51:20 -04:00
1 parent 26ab2b77d7
commit 41d2e4a40f
2 files changed
+5 -2

No files matched your search

+2
View File
@@ -2,6 +2,8 @@
#include <cstdint>
template <typename T>
static T clamp(T f, T low, T high);
uint32_t whiteAlpha(float alpha);
uint32_t blackAlpha(float alpha);
uint32_t colorAlpha(uint32_t color, float alpha);
+3 -2
View File
@@ -8,6 +8,7 @@
#include <mutex>
#include "Common/CPUDetect.h"
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/Log.h"
#include "Common/LogManager.h"
#include "Common/System/Display.h"
@@ -1430,8 +1431,8 @@ static void retro_input(void)
}
float mappedNorm = norm;
x_left = std::clamp(x_left / norm * mappedNorm, -1.0f, 1.0f);
y_left = std::clamp(y_left / norm * mappedNorm, -1.0f, 1.0f);
x_left = clamp(x_left / norm * mappedNorm, -1.0f, 1.0f);
y_left = clamp(y_left / norm * mappedNorm, -1.0f, 1.0f);
__CtrlSetAnalogXY(CTRL_STICK_LEFT, x_left, y_left);
__CtrlSetAnalogXY(CTRL_STICK_RIGHT, x_right, y_right);