mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 03:34:52 +01:00
Fixed issue where GetAnalogActionData magnitude of joystick was always maximum.
This commit is contained in:
parent
663728edca
commit
09704ae243
2 changed files with 11 additions and 0 deletions
|
|
@ -554,6 +554,10 @@ static void GamepadUpdateStick(GAMEPAD_AXIS* axis, float deadzone) {
|
|||
axis->nx = axis->x / axis->length;
|
||||
axis->ny = axis->y / axis->length;
|
||||
|
||||
//fix special case
|
||||
if (axis->nx < -1.0) axis->nx = -1.0;
|
||||
if (axis->ny < -1.0) axis->ny = -1.0;
|
||||
|
||||
// adjust length for deadzone and find normalized length
|
||||
axis->length -= deadzone;
|
||||
axis->length /= (32767.0f - deadzone);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue