mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 15:08:31 +00:00
Added SDL_SetTextureUserData() and SDL_GetTextureUserData() to associate a user-specified pointer with an SDL texture
This commit is contained in:
@@ -815,3 +815,5 @@
|
||||
#define SDL_GameControllerSendEffect SDL_GameControllerSendEffect_REAL
|
||||
#define SDL_JoystickSendEffect SDL_JoystickSendEffect_REAL
|
||||
#define SDL_GameControllerGetSensorDataRate SDL_GameControllerGetSensorDataRate_REAL
|
||||
#define SDL_SetTextureUserData SDL_SetTextureUserData_REAL
|
||||
#define SDL_GetTextureUserData SDL_GetTextureUserData_REAL
|
||||
|
@@ -880,3 +880,5 @@ SDL_DYNAPI_PROC(int,SDL_FlashWindow,(SDL_Window *a, SDL_FlashOperation b),(a,b),
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSendEffect,(SDL_GameController *a, const void *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_JoystickSendEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_GameControllerGetSensorDataRate,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureUserData,(SDL_Texture *a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetTextureUserData,(SDL_Texture *a),(a),return)
|
||||
|
@@ -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,
|
||||
|
@@ -58,6 +58,7 @@ struct SDL_Texture
|
||||
Uint32 last_command_generation; /* last command queue generation this texture was in. */
|
||||
|
||||
void *driverdata; /**< Driver specific texture representation */
|
||||
void *userdata;
|
||||
|
||||
SDL_Texture *prev;
|
||||
SDL_Texture *next;
|
||||
|
Reference in New Issue
Block a user