Engine/lib/sdl/src/joystick/SDL_gamecontroller.c
/**
 * Get the SDL joystick layer binding for this controller axis mapping
 */
Get the SDL joystick layer binding for this controller axis mapping
Get the SDL joystick layer binding for this controller axis mapping
SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
{
    SDL_GameControllerButtonBind bind;
    SDL_memset(&bind, 0x0, sizeof(bind));
    if (!gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID)
        return bind;
    if (gamecontroller->mapping.axes[axis] >= 0) {
        bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS;
        bind.value.button = gamecontroller->mapping.axes[axis];
    } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) {
        bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON;
        bind.value.button = gamecontroller->mapping.buttonasaxis[axis];
    }
    return bind;
}
SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis ( SDL_GameController * gamecontroller , SDL_GameControllerAxis axis ) { SDL_GameControllerButtonBind bind ; SDL_memset ( & bind , 0x0 , sizeof ( bind ) ) ; if ( ! gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID ) return bind ; if ( gamecontroller -> mapping . axes [ axis ] >= 0 ) { bind . bindType = SDL_CONTROLLER_BINDTYPE_AXIS ; bind . value . button = gamecontroller -> mapping . axes [ axis ] ; } else if ( gamecontroller -> mapping . buttonasaxis [ axis ] >= 0 ) { bind . bindType = SDL_CONTROLLER_BINDTYPE_BUTTON ; bind . value . button = gamecontroller -> mapping . buttonasaxis [ axis ] ; } return bind ; }
Get the SDL joystick layer binding for this controller axis mapping
Get the SDL joystick layer binding for this controller axis mapping