0
\$\begingroup\$

I've faced a weird problem with SDL2.

case SDL_CONTROLLERAXISMOTION:
    switch (e->caxis.axis)
    {
    /* LEFT && RIGHT Stick Movement */
    case SDL_CONTROLLER_AXIS_LEFTY:
        puts("Y");
        break;
    /* UP && DOWN Stick Movement */
    case SDL_CONTROLLER_AXIS_LEFTX:
        puts("X");
        break;
    }
    break;

Using my Xbox 360 Controller on Windows 10, I just the move the left stick forward and backward which is in the y-axis logically. But it prints X instead.

There's no problem with my controller since it works as it should be with all other games.

I've also used some gamepad tools for debugging and the results are the true y and x axes directions.

What did I miss? It's the same with the right stick too.

\$\endgroup\$
  • \$\begingroup\$ Do you have the last SDL version? \$\endgroup\$ – HolyBlackCat Jul 15 '18 at 9:01
  • \$\begingroup\$ @HolyBlackCat Yes, I have the 2.0.8 version (latest). I can work with them this way but it's just confusing... \$\endgroup\$ – X Stylish Jul 15 '18 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.