src/joystick/android/SDL_sysjoystick.c
changeset 6696 73e2ad636f6e
parent 6695 ec21e81c62aa
child 6707 70eeb7e3ec2f
equal deleted inserted replaced
6695:ec21e81c62aa 6696:73e2ad636f6e
    62    The joystick to open is specified by the index field of the joystick.
    62    The joystick to open is specified by the index field of the joystick.
    63    This should fill the nbuttons and naxes fields of the joystick structure.
    63    This should fill the nbuttons and naxes fields of the joystick structure.
    64    It returns 0, or -1 if there is an error.
    64    It returns 0, or -1 if there is an error.
    65  */
    65  */
    66 int
    66 int
    67 SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int index)
    67 SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
    68 {
    68 {
    69     joystick->nbuttons = 0;
    69     if (device_index == 0) {
    70     joystick->nhats = 0;
    70         joystick->nbuttons = 0;
    71     joystick->nballs = 0;
    71         joystick->nhats = 0;
    72     joystick->naxes = 3;
    72         joystick->nballs = 0;
    73     return 0;
    73         joystick->naxes = 3;
       
    74         return 0;
       
    75 	} else {
       
    76 		SDL_SetError("No joystick available with that index");
       
    77 		return (-1);
       
    78 	}
    74 }
    79 }
    75 
    80 
    76 
    81 
    77 /* Function to update the state of a joystick - called as a device poll.
    82 /* Function to update the state of a joystick - called as a device poll.
    78  * This function shouldn't update the joystick structure directly,
    83  * This function shouldn't update the joystick structure directly,