We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 71247be + 04b72e8 commit 97d6113Copy full SHA for 97d6113
src/device/gamepad.cpp
@@ -53,6 +53,10 @@ std::string button_to_string(SDL_GamepadButton button)
53
54
void GamepadDevice::add_gamepad(SDL_JoystickID joystickid)
55
{
56
+ // Return if the gamepad is already opened
57
+ int idx = get_gamepad_idx(joystickid);
58
+ if (idx >= 0 && m_gamepads[idx]) { return; }
59
+
60
SDL_Gamepad *gamepad = SDL_OpenGamepad(joystickid);
61
if (gamepad) {
62
m_gamepads.push_back(gamepad);
0 commit comments