dimanche 6 juillet 2014

SDL2 jbutton enum?


Vote count:

0




I'm having some trouble figuring out what enums I can/should use for SDL2's gamepad/joystick support. I tried using "SDL_CONTROLLER_*", but I ended up with some odd results. For instance:



SDL_Event e;
while (SDL_PollEvent(&e) != 0)
{
if (e.type == SDL_JOYBUTTONDOWN)
{
printf("%d\n", e.jbutton.button);
if (e.jbutton.button == SDL_CONTROLLER_BUTTON_B)
{
printf("HI\n");
}
}
}


I had this code in my function's main loop, and the second print statement goes off when I press the D-pad's DOWN button, instead of when I press the B button. I'm using an XBOX 360 controller, and it gives me no trouble at all when I play other games. Am I even using the correct enum?


Thanks, -S



asked 22 secs ago






Aucun commentaire:

Enregistrer un commentaire