Skip to content

Commit

Permalink
Dump more information about each joystick in testjoytick.c
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 15, 2007
1 parent 632e5cf commit 857f271
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/testjoystick.c
Expand Up @@ -158,8 +158,19 @@ int main(int argc, char *argv[])
/* Print information about the joysticks */
printf("There are %d joysticks attached\n", SDL_NumJoysticks());
for ( i=0; i<SDL_NumJoysticks(); ++i ) {
SDL_Joystick *stick = NULL;
name = SDL_JoystickName(i);
printf("Joystick %d: %s\n",i,name ? name : "Unknown Joystick");
stick = SDL_JoystickOpen(i);
if (stick == NULL) {
fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError());
} else {
printf(" axes: %d\n", SDL_JoystickNumAxes(stick));
printf(" balls: %d\n", SDL_JoystickNumBalls(stick));
printf(" hats: %d\n", SDL_JoystickNumHats(stick));
printf(" buttons: %d\n", SDL_JoystickNumButtons(stick));
SDL_JoystickClose(stick);
}
}

if ( argv[1] ) {
Expand Down

0 comments on commit 857f271

Please sign in to comment.