SDL_GetTextureSize(3)

✨ SDL_GetTextureSize ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_GetTextureSize πŸ’–


🌸 NAME 🌸

SDL_GetTextureSize β€” get the size of a texture, as floating point values. yes literally that's the whole vibe, it tells you how big your texture is πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_render.h>

bool SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h);

πŸ’… FUNCTION PARAMETERS πŸ’…

  • texture β€” the texture you're querying. the one you wanna know the size of, the main character of this whole operation πŸ‘‘
  • w β€” a pointer that gets filled in with the width of the texture, in pixels. and here's the cute part: this argument can be NULL if you don't need this info 🫢 so if you only care about height, you can just yeet a NULL in there, no big deal
  • h β€” a pointer that gets filled in with the height of the texture, in pixels. same deal, this argument can be NULL if you don't need this information 🌸

⭐ RETURN VALUE ⭐

Returns true on success or false on failure β€” and if it fails, call SDL_GetError() for more information, she'll tell you what went wrong πŸ’€


πŸ”₯ THREAD SAFETY πŸ”₯

This function should only be called on the main thread. no cap, do not try to be sneaky about this one πŸ™ˆ

🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. it's giving established, it's giving iconic, periodt ✨


and that's the whole page bestie, you ate that πŸ“πŸ’œ

this lil love letter to your codebase comes to you courtesy of Simple Directmedia Layer, running version SDL 3.4.18 β€” SDL_GetTextureSize(3), out here doing the most so your textures never have to guess their own size πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from