i just recently updated to SDL 2.0.9 so i could try and get my switch pro controller working with a project i have. i am able to detect the controller, but it just doesn’t read any inputs from it at all. i have tried with both PS4 pads and 360 pads which work completely fine. its just the switch pro controller which doesn’t get any inputs
std::vector < padInputs > gamepadInputs;
SDL_JoystickEventState(SDL_ENABLE);
SDL_Init(SDL_INIT_JOYSTICK);
printf("%i joysticks were found.\n\n", SDL_NumJoysticks());
std::vector < SDL_Joystick *> joystick;
for (int i = 0; i < SDL_NumJoysticks(); i++)
{
joystick.push_back(SDL_JoystickOpen(i));
gamepadInputs.push_back({ 0,0,0,{},{} });
printf(SDL_JoystickName(joystick[i]));
}
// main game loop
while (!quit)
{
for(int i = 0; i < gamepadInputs.size(); i++)
{
gamepadInputs[i].buttonsP = {};
gamepadInputs[i].buttonsR = {};
}
while (SDL_PollEvent(&e) != 0)
{
if (e.type == SDL_QUIT)
{
quit = true;
}
if (e.type == SDL_JOYAXISMOTION)
{
if (e.jaxis.axis == 0)
{
gamepadInputs[e.jaxis.which].Xaxis = e.jaxis.value;
}
if (e.jaxis.axis == 1)
{
gamepadInputs[e.jaxis.which].Yaxis = e.jaxis.value;
}
}
if (e.type == SDL_JOYBUTTONDOWN)
{
gamepadInputs[e.jbutton.which].buttonsP.push_back(e.jbutton.button);
}
if (e.type == SDL_JOYBUTTONUP)
{
gamepadInputs[e.jbutton.which].buttonsR.push_back(e.jbutton.button);
}
if (e.type == SDL_JOYHATMOTION)
{
gamepadInputs[e.jhat.which].Dpad = e.jhat.value;
}
}
}