test/testjoystick.c
branchSDL-1.2
changeset 4071 3d9040dcc47e
parent 1855 5ff2c01e475e
child 4073 0dd0ca51d941
     1.1 --- a/test/testjoystick.c	Sun Jul 15 15:58:00 2007 +0000
     1.2 +++ b/test/testjoystick.c	Sun Jul 15 16:33:45 2007 +0000
     1.3 @@ -158,8 +158,19 @@
     1.4  	/* Print information about the joysticks */
     1.5  	printf("There are %d joysticks attached\n", SDL_NumJoysticks());
     1.6  	for ( i=0; i<SDL_NumJoysticks(); ++i ) {
     1.7 +		SDL_Joystick *stick = NULL;
     1.8  		name = SDL_JoystickName(i);
     1.9  		printf("Joystick %d: %s\n",i,name ? name : "Unknown Joystick");
    1.10 +		stick = SDL_JoystickOpen(i);
    1.11 +		if (stick == NULL) {
    1.12 +			fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError());
    1.13 +		} else {
    1.14 +			printf("       axes: %d\n", SDL_JoystickNumAxes(stick));
    1.15 +			printf("      balls: %d\n", SDL_JoystickNumBalls(stick));
    1.16 +			printf("       hats: %d\n", SDL_JoystickNumHats(stick));
    1.17 +			printf("    buttons: %d\n", SDL_JoystickNumButtons(stick));
    1.18 +			SDL_JoystickClose(stick);
    1.19 +		}
    1.20  	}
    1.21  
    1.22  	if ( argv[1] ) {