comparison test/testjoystick.c @ 2201:6280c111ee80

indent
author Sam Lantinga <slouken@libsdl.org>
date Sun, 15 Jul 2007 21:53:51 +0000
parents 893c862eed86
children 450a9bf50c37 f55c87ae336b
comparison
equal deleted inserted replaced
2200:893c862eed86 2201:6280c111ee80
155 155
156 /* Print information about the joysticks */ 156 /* Print information about the joysticks */
157 printf("There are %d joysticks attached\n", SDL_NumJoysticks()); 157 printf("There are %d joysticks attached\n", SDL_NumJoysticks());
158 for (i = 0; i < SDL_NumJoysticks(); ++i) { 158 for (i = 0; i < SDL_NumJoysticks(); ++i) {
159 name = SDL_JoystickName(i); 159 name = SDL_JoystickName(i);
160 printf("Joystick %d: %s\n",i,name ? name : "Unknown Joystick"); 160 printf("Joystick %d: %s\n", i, name ? name : "Unknown Joystick");
161 joystick = SDL_JoystickOpen(i); 161 joystick = SDL_JoystickOpen(i);
162 if (joystick == NULL) { 162 if (joystick == NULL) {
163 fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError()); 163 fprintf(stderr, "SDL_JoystickOpen(%d) failed: %s\n", i,
164 SDL_GetError());
164 } else { 165 } else {
165 printf(" axes: %d\n", SDL_JoystickNumAxes(joystick)); 166 printf(" axes: %d\n", SDL_JoystickNumAxes(joystick));
166 printf(" balls: %d\n", SDL_JoystickNumBalls(joystick)); 167 printf(" balls: %d\n", SDL_JoystickNumBalls(joystick));
167 printf(" hats: %d\n", SDL_JoystickNumHats(joystick)); 168 printf(" hats: %d\n", SDL_JoystickNumHats(joystick));
168 printf(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); 169 printf(" buttons: %d\n", SDL_JoystickNumButtons(joystick));