test/testgamecontroller.c
changeset 9922 b066d5fd5fa7
parent 9916 9429bc102632
child 9998 f67cf37e9cd4
equal deleted inserted replaced
9921:8865d17947de 9922:b066d5fd5fa7
   245     int retcode = 0;
   245     int retcode = 0;
   246     char guid[64];
   246     char guid[64];
   247     SDL_GameController *gamecontroller;
   247     SDL_GameController *gamecontroller;
   248 
   248 
   249     /* Enable standard application logging */
   249     /* Enable standard application logging */
   250 	SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
   250     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
   251 
   251 
   252     /* Initialize SDL (Note: video is required to start event loop) */
   252     /* Initialize SDL (Note: video is required to start event loop) */
   253     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER ) < 0) {
   253     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER ) < 0) {
   254         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
   254         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
   255         return 1;
   255         return 1;
   282         SDL_bool reportederror = SDL_FALSE;
   282         SDL_bool reportederror = SDL_FALSE;
   283         SDL_bool keepGoing = SDL_TRUE;
   283         SDL_bool keepGoing = SDL_TRUE;
   284         SDL_Event event;
   284         SDL_Event event;
   285         int device = atoi(argv[1]);
   285         int device = atoi(argv[1]);
   286         if (device >= SDL_NumJoysticks()) {
   286         if (device >= SDL_NumJoysticks()) {
   287 			SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%i is an invalid joystick index.\n", device);
   287             SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%i is an invalid joystick index.\n", device);
   288             retcode = 1;
   288             retcode = 1;
   289         } else {
   289         } else {
   290             SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(device),
   290             SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(device),
   291                                       guid, sizeof (guid));
   291                                       guid, sizeof (guid));
   292             SDL_Log("Attempting to open device %i, guid %s\n", device, guid);
   292             SDL_Log("Attempting to open device %i, guid %s\n", device, guid);