Controller: Round floating point axis values instead of flooring
This commit is contained in:
parent
b01d49fa52
commit
3cf12e8f0d
3 changed files with 3 additions and 3 deletions
|
|
@ -123,7 +123,7 @@ void AnalogController::SetAxisState(s32 axis_code, float value)
|
|||
|
||||
// -1..1 -> 0..255
|
||||
const float scaled_value = std::clamp(value * m_axis_scale, -1.0f, 1.0f);
|
||||
const u8 u8_value = static_cast<u8>(std::clamp(((scaled_value + 1.0f) / 2.0f) * 255.0f, 0.0f, 255.0f));
|
||||
const u8 u8_value = static_cast<u8>(std::clamp(std::round(((scaled_value + 1.0f) / 2.0f) * 255.0f), 0.0f, 255.0f));
|
||||
|
||||
SetAxisState(static_cast<Axis>(axis_code), u8_value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue