test/testhotplug.c
changeset 9922 b066d5fd5fa7
parent 9619 b94b6d0bff0f
child 9998 f67cf37e9cd4
equal deleted inserted replaced
9921:8865d17947de 9922:b066d5fd5fa7
    40     if(enable_haptic) {
    40     if(enable_haptic) {
    41         init_subsystems |= SDL_INIT_HAPTIC;
    41         init_subsystems |= SDL_INIT_HAPTIC;
    42     }
    42     }
    43     
    43     
    44     /* Enable standard application logging */
    44     /* Enable standard application logging */
    45     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);	
    45     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    46 
    46 
    47     SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
    47     SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
    48 
    48 
    49     /* Initialize SDL (Note: video is required to start event loop) */
    49     /* Initialize SDL (Note: video is required to start event loop) */
    50     if (SDL_Init(init_subsystems) < 0) {
    50     if (SDL_Init(init_subsystems) < 0) {
   132                     SDL_Log("Button Press: %d\n", event.jbutton.button);
   132                     SDL_Log("Button Press: %d\n", event.jbutton.button);
   133                     if(enable_haptic && haptic)
   133                     if(enable_haptic && haptic)
   134                     {
   134                     {
   135                         SDL_HapticRumblePlay(haptic, 0.25, 250);
   135                         SDL_HapticRumblePlay(haptic, 0.25, 250);
   136                     }
   136                     }
   137 					if (event.jbutton.button == 0) {
   137                     if (event.jbutton.button == 0) {
   138 						SDL_Log("Exiting due to button press of button 0\n");
   138                         SDL_Log("Exiting due to button press of button 0\n");
   139 						keepGoing = SDL_FALSE;
   139                         keepGoing = SDL_FALSE;
   140 					}
   140                     }
   141                     break;
   141                     break;
   142                 case SDL_JOYBUTTONUP:
   142                 case SDL_JOYBUTTONUP:
   143                     SDL_Log("Button Release: %d\n", event.jbutton.button);
   143                     SDL_Log("Button Release: %d\n", event.jbutton.button);
   144                     break;
   144                     break;
   145             }
   145             }