Skip to content

Commit

Permalink
Keyboard takes precedence over analog in keyboard player
Browse files Browse the repository at this point in the history
  • Loading branch information
jorio committed Feb 7, 2024
1 parent e2f54d4 commit 9dd4de8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/System/SDLInput.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,12 @@ static float GetAnalogValue(int needID, bool raw, int playerID)

const Controller* controller = &gControllers[playerID];

// Keyboard takes precedence when the key is pressed
if ((gNumLocalPlayers <= 1 || controller->fallbackToKeyboard) && gNeedStates[needID])
{
return 1.0f;
}

if (controller->open && controller->needAnalogRaw[needID] != 0.0f)
{
float value = controller->needAnalogRaw[needID];
Expand All @@ -506,12 +512,6 @@ static float GetAnalogValue(int needID, bool raw, int playerID)
return value;
}

// Fallback to KB/M
if (gNumLocalPlayers <= 1 || controller->fallbackToKeyboard)
{
return gNeedStates[needID] ? 1.0f : 0.0f;
}

return 0;
}

Expand Down

0 comments on commit 9dd4de8

Please sign in to comment.