Engine/lib/sdl/src/joystick/SDL_gamecontroller.c
/*
 * Initialize the game controller system, mostly load our DB of controller config mappings
 */
Initialize the game controller system, mostly load our DB of controller config mappings
Initialize the game controller system mostly load our DB of controller config mappings
int
SDL_GameControllerInit(void)
{
    int i = 0;
    const char *pMappingString = NULL;
    s_pSupportedControllers = NULL;
    pMappingString = s_ControllerMappings[i];
    while (pMappingString) {
        SDL_GameControllerAddMapping(pMappingString);
        i++;
        pMappingString = s_ControllerMappings[i];
    }
    SDL_GameControllerLoadHints();
    SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL);
    for (i = 0; i < SDL_NumJoysticks(); ++i) {
        if (SDL_IsGameController(i)) {
            SDL_Event deviceevent;
            deviceevent.type = SDL_CONTROLLERDEVICEADDED;
            deviceevent.cdevice.which = i;
            SDL_PushEvent(&deviceevent);
        }
    }
    return (0);
}
int SDL_GameControllerInit ( void ) { int i = 0 ; const char * pMappingString = NULL ; s_pSupportedControllers = NULL ; pMappingString = s_ControllerMappings [ i ] ; while ( pMappingString ) { SDL_GameControllerAddMapping ( pMappingString ) ; i ++ ; pMappingString = s_ControllerMappings [ i ] ; } SDL_GameControllerLoadHints ( ) ; SDL_AddEventWatch ( SDL_GameControllerEventWatcher , NULL ) ; for ( i = 0 ; i < SDL_NumJoysticks ( ) ; ++ i ) { if ( SDL_IsGameController ( i ) ) { SDL_Event deviceevent ; deviceevent . type = SDL_CONTROLLERDEVICEADDED ; deviceevent . cdevice . which = i ; SDL_PushEvent ( & deviceevent ) ; } } return ( 0 ) ; }
Initialize the game controller system, mostly load our DB of controller config mappings
Initialize the game controller system mostly load our DB of controller config mappings
/* load in any user supplied config */ /* watch for joy events and fire controller ones if needed */ /* Send added events for controllers currently attached */