Mercurial > sdl-ios-xcode
diff test/testjoystick.c @ 4071:3d9040dcc47e SDL-1.2
Dump more information about each joystick in testjoytick.c
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 15 Jul 2007 16:33:45 +0000 |
parents | 5ff2c01e475e |
children | 0dd0ca51d941 |
line wrap: on
line diff
--- a/test/testjoystick.c Sun Jul 15 15:58:00 2007 +0000 +++ b/test/testjoystick.c Sun Jul 15 16:33:45 2007 +0000 @@ -158,8 +158,19 @@ /* 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] ) {