Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial()

This commit is contained in:
Sam Lantinga 2020-11-16 17:36:47 -08:00
parent 55e59a4f33
commit d140d88744
12 changed files with 210 additions and 150 deletions

View file

@ -57,6 +57,7 @@ struct _SDL_Joystick
{
SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */
char *name; /* Joystick name - system dependent */
char *serial; /* Joystick serial */
SDL_JoystickGUID guid; /* Joystick guid */
int naxes; /* Number of axis controls on the joystick */
@ -143,25 +144,25 @@ typedef struct _SDL_JoystickDriver
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
*/
int (*Open)(SDL_Joystick * joystick, int device_index);
int (*Open)(SDL_Joystick *joystick, int device_index);
/* Rumble functionality */
int (*Rumble)(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
int (*RumbleTriggers)(SDL_Joystick * joystick, Uint16 left_rumble, Uint16 right_rumble);
int (*Rumble)(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
int (*RumbleTriggers)(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble);
/* LED functionality */
SDL_bool (*HasLED)(SDL_Joystick * joystick);
int (*SetLED)(SDL_Joystick * joystick, Uint8 red, Uint8 green, Uint8 blue);
SDL_bool (*HasLED)(SDL_Joystick *joystick);
int (*SetLED)(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
void (*Update)(SDL_Joystick * joystick);
void (*Update)(SDL_Joystick *joystick);
/* Function to close a joystick after use */
void (*Close)(SDL_Joystick * joystick);
void (*Close)(SDL_Joystick *joystick);
/* Function to perform any system-specific joystick related cleanup */
void (*Quit)(void);