Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture

This commit is contained in:
Sam Lantinga 2021-08-10 15:17:59 -07:00
parent a0af7ce731
commit f5794f9eeb
7 changed files with 46 additions and 2 deletions

View file

@ -1486,6 +1486,23 @@ SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode)
return 0;
}
int
SDL_SetTextureUserData(SDL_Texture * texture, void *userdata)
{
CHECK_TEXTURE_MAGIC(texture, -1);
texture->userdata = userdata;
return 0;
}
void *
SDL_GetTextureUserData(SDL_Texture * texture)
{
CHECK_TEXTURE_MAGIC(texture, NULL);
return texture->userdata;
}
#if SDL_HAVE_YUV
static int
SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,