[SDL2] Get the texture width and height

How do i get the width and height from a SDL_Texture
There was a similar question from 2013 that linked to SDL_QueryTexture but then i don’t know what to do next with the returned type of that function

SDL_QueryTexture() returns the useful information through the pointer arguments – the return value is just used to report errors.

SDL_Point getsize(SDL_Texture *texture) {
    SDL_Point size;
    SDL_QueryTexture(texture, NULL, NULL, &size.x, &size.y);
    return size;

This function will return the width and height in the x and y fields of an SDL_Point structure, for example.

1 Like