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

@@ -438,6 +438,18 @@ SDL_AudioStream *SDL_CreateAudioStream(const SDL_AudioSpec *src_spec, const SDL_
return retval;
}
SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream *stream)
{
if (!stream) {
SDL_InvalidParamError("stream");
return 0;
}
if (stream->props == 0) {
stream->props = SDL_CreateProperties();
}
return stream->props;
}
int SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata)
{
if (!stream) {
@@ -1161,6 +1173,8 @@ void SDL_DestroyAudioStream(SDL_AudioStream *stream)
return;
}
SDL_DestroyProperties(stream->props);
OnAudioStreamDestroy(stream);
const SDL_bool simplified = stream->simplified;

View File

@@ -170,6 +170,8 @@ struct SDL_AudioStream
{
SDL_Mutex* lock;
SDL_PropertiesID props;
SDL_AudioStreamCallback get_callback;
void *get_callback_userdata;
SDL_AudioStreamCallback put_callback;