Added properties to various SDL objects

The following objects now have properties that can be user modified:
* SDL_AudioStream
* SDL_Gamepad
* SDL_Joystick
* SDL_RWops
* SDL_Renderer
* SDL_Sensor
* SDL_Surface
* SDL_Texture
* SDL_Window
This commit is contained in:
Sam Lantinga 2023-10-11 16:59:51 -07:00
parent 973c8b3273
commit 4368f70ff9
32 changed files with 434 additions and 292 deletions

View file

@ -1213,6 +1213,27 @@ SDL_Joystick *SDL_GetJoystickFromPlayerIndex(int player_index)
return joystick;
}
/*
* Get the properties associated with a joystick
*/
SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick *joystick)
{
SDL_PropertiesID retval;
SDL_LockJoysticks();
{
CHECK_JOYSTICK_MAGIC(joystick, 0);
if (joystick->props == 0) {
joystick->props = SDL_CreateProperties();
}
retval = joystick->props;
}
SDL_UnlockJoysticks();
return retval;
}
/*
* Get the friendly name of this joystick
*/
@ -1465,6 +1486,8 @@ void SDL_CloseJoystick(SDL_Joystick *joystick)
return;
}
SDL_DestroyProperties(joystick->props);
if (joystick->rumble_expiration) {
SDL_RumbleJoystick(joystick, 0, 0, 0);
}