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

@ -480,6 +480,28 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture,
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture,
SDL_ScaleMode *scaleMode);
/**
* Associate a user-specified pointer with a texture.
*
* \param texture the texture to update.
* \param userdata the pointer to associate with the texture.
* \returns 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_GetTextureUserData
*/
extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture * texture,
void *userdata);
/**
* Get the user-specified pointer associated with a texture
*
* \param texture the texture to query.
* \return the pointer associated with the texture, or NULL if the texture is not valid.
*
* \sa SDL_SetTextureUserData
*/
extern DECLSPEC void * SDLCALL SDL_GetTextureUserData(SDL_Texture * texture);
/**
* Update the given texture rectangle with new pixel data.
*