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

This commit is contained in:
Sam Lantinga committed 2021-08-10 15:17:59 -07:00
1 parent a0af7ce731
commit f5794f9eeb
7 files changed
+46 -2

No files matched your search

+17
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,