# HG changeset patch # User Ryan C. Gordon # Date 1184520359 0 # Node ID 893c862eed86306729c8c29e6b96fce31c777626 # Parent 7e1caa8452f343e5510a622a72c40c49347bb111 Merged r3292:3293 from branches/SDL-1.2: testjoystick verbose info. diff -r 7e1caa8452f3 -r 893c862eed86 test/testjoystick.c --- a/test/testjoystick.c Sun Jul 15 16:59:16 2007 +0000 +++ b/test/testjoystick.c Sun Jul 15 17:25:59 2007 +0000 @@ -157,7 +157,17 @@ printf("There are %d joysticks attached\n", SDL_NumJoysticks()); for (i = 0; i < SDL_NumJoysticks(); ++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]) {