Skip to content

Commit

Permalink
reassign freed up controller indices on disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
fallahn committed Sep 14, 2024
1 parent a6f5230 commit c35431e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crogine/src/core/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,15 @@ void App::handleEvents()
}

SDL_GameControllerClose(m_controllers[controllerIndex].controller);
m_controllers[controllerIndex] = {};
//m_controllers[controllerIndex] = {};

m_controllers[controllerIndex] = m_controllers[m_controllerCount];
m_controllers[m_controllerCount] = {};

if (m_controllers[controllerIndex].controller)
{
SDL_GameControllerSetPlayerIndex(m_controllers[controllerIndex].controller, controllerIndex);
}
}

if (m_joysticks.count(id) > 0)
Expand Down

0 comments on commit c35431e

Please sign in to comment.