Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c
/* Function to open a joystick for use.
   The joystick to open is specified by the device index.
   This should fill the nbuttons and naxes fields of the joystick structure.
   It returns 0, or -1 if there is an error.
 */
Function to open a joystick for use.
The joystick to open is specified by the device index.
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
Function to open a joystick for use . The joystick to open is specified by the device index . This should fill the nbuttons and naxes fields of the joystick structure . It returns 0 or - 1 if there is an error .
int
SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
{
    SDL_joylist_item *item = JoystickByDevIndex(device_index);
    if (item == NULL ) {
        return SDL_SetError("No such device");
    }
    if (item->joystick != NULL) {
        return SDL_SetError("Joystick already opened");
    }
    joystick->instance_id = item->device_instance;
    joystick->hwdata = (struct joystick_hwdata *) item;
    item->joystick = joystick;
    joystick->nhats = item->nhats;
    joystick->nballs = item->nballs;
    joystick->nbuttons = item->nbuttons;
    joystick->naxes = item->naxes;
    return (0);
}
int SDL_SYS_JoystickOpen ( SDL_Joystick * joystick , int device_index ) { SDL_joylist_item * item = JoystickByDevIndex ( device_index ) ; if ( item == NULL ) { return SDL_SetError ( " " ) ; } if ( item -> joystick != NULL ) { return SDL_SetError ( " " ) ; } joystick -> instance_id = item -> device_instance ; joystick -> hwdata = ( struct joystick_hwdata * ) item ; item -> joystick = joystick ; joystick -> nhats = item -> nhats ; joystick -> nballs = item -> nballs ; joystick -> nbuttons = item -> nbuttons ; joystick -> naxes = item -> naxes ; return ( 0 ) ; }
Function to open a joystick for use.
Function to open a joystick for use .