Input: use std::lerp instead of lerp template
This commit is contained in:
@@ -321,11 +321,6 @@ protected:
|
|||||||
std::unordered_map<u32, std::string> button_list;
|
std::unordered_map<u32, std::string> button_list;
|
||||||
std::vector<u32> blacklist;
|
std::vector<u32> blacklist;
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T lerp(T v0, T v1, T t) {
|
|
||||||
return std::fma(t, v1, std::fma(-t, v0, v0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search an unordered map for a string value and return found keycode
|
// Search an unordered map for a string value and return found keycode
|
||||||
static int FindKeyCode(const std::unordered_map<u32, std::string>& map, const cfg::string& name, bool fallback = true);
|
static int FindKeyCode(const std::unordered_map<u32, std::string>& map, const cfg::string& name, bool fallback = true);
|
||||||
|
|
||||||
|
|||||||
@@ -693,7 +693,7 @@ void keyboard_pad_handler::ThreadProc()
|
|||||||
const f32 v1 = static_cast<f32>(m_stick_val[j]);
|
const f32 v1 = static_cast<f32>(m_stick_val[j]);
|
||||||
|
|
||||||
// linear interpolation from the current stick value v0 to the desired stick value v1
|
// linear interpolation from the current stick value v0 to the desired stick value v1
|
||||||
f32 res = lerp(v0, v1, stick_lerp_factor);
|
f32 res = std::lerp(v0, v1, stick_lerp_factor);
|
||||||
|
|
||||||
// round to the correct direction to prevent sticky sticks on small factors
|
// round to the correct direction to prevent sticky sticks on small factors
|
||||||
res = (v0 <= v1) ? std::ceil(res) : std::floor(res);
|
res = (v0 <= v1) ? std::ceil(res) : std::floor(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user