SDL_GetWindowSizeInPixels(3)

πŸ’– SDL_GetWindowSizeInPixels(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_GetWindowSizeInPixels β€” she tells you how big your window's client area is, but in pixels (not those fake units, we'll get there).


✨ NAME ✨

SDL_GetWindowSizeInPixels β€” get the size of a window's client area, in pixels. no cap, that's literally the whole job. πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

bool SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h);

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • window β€” the window you wanna interrogate. this is the one whose drawable size should be queried, so like, hand her over. 🫢
  • w β€” a pointer to a variable for storing the width in pixels. and get this β€” it may be NULL. so if you don't care about width, you can just... not. iconic. πŸ’…
  • h β€” a pointer to a variable for storing the height in pixels. also may be NULL. same energy, same freedom. ✨

⭐ RETURN VALUE ⭐

returns true on success or false on failure. and if it's giving false, call SDL_GetError() for more information β€” she'll spill the tea on what went wrong. 😭


πŸ’€ THREAD SAFETY πŸ’€

this function should only be called on the main thread. do not try to be cute and call her from a side thread, bestie. she's a main-character function and she stays on the main thread. periodt. πŸ‘‘


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on something older, sorry babe, she doesn't exist yet. πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ


and that's the vibe check βœ… β€” brought to you by Simple Directmedia Layer, version SDL 3.4.18. go forth and get those pixels, bestie, iykyk πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from