Commit b98b6308 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Merged r3292:3293 from branches/SDL-1.2: testjoystick verbose info.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402539
parent 6793a28d
...@@ -157,7 +157,17 @@ main(int argc, char *argv[]) ...@@ -157,7 +157,17 @@ main(int argc, char *argv[])
printf("There are %d joysticks attached\n", SDL_NumJoysticks()); printf("There are %d joysticks attached\n", SDL_NumJoysticks());
for (i = 0; i < SDL_NumJoysticks(); ++i) { for (i = 0; i < SDL_NumJoysticks(); ++i) {
name = SDL_JoystickName(i); name = SDL_JoystickName(i);
printf("Joystick %d: %s\n", i, name ? name : "Unknown Joystick"); printf("Joystick %d: %s\n",i,name ? name : "Unknown Joystick");
joystick = SDL_JoystickOpen(i);
if (joystick == NULL) {
fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError());
} else {
printf(" axes: %d\n", SDL_JoystickNumAxes(joystick));
printf(" balls: %d\n", SDL_JoystickNumBalls(joystick));
printf(" hats: %d\n", SDL_JoystickNumHats(joystick));
printf(" buttons: %d\n", SDL_JoystickNumButtons(joystick));
SDL_JoystickClose(joystick);
}
} }
if (argv[1]) { if (argv[1]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment