TTF_GetTextPosition(3)

πŸ’– TTF_GetTextPosition(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 girlies' manual, we're talking about TTF_GetTextPosition today and it's literally so simple you'll be obsessed πŸŽ€


✨ NAME ✨

TTF_GetTextPosition β€” get the position of a text object. that's it. that's the whole job. she's a getter. she gets. πŸ’…


πŸ“ HEADER FILE πŸ“

she lives in SDL3_ttf/SDL_ttf.h β€” defined in SDL3_ttf/SDL_ttf.h, to be exact. go say hi.


🌸 SYNOPSIS 🌸

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_GetTextPosition(TTF_Text *text, int *x, int *y);

look at her. three args. returns a bool. iconic, no notes. ✨


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • text β€” the TTF_Text you wanna query. the main character in question πŸ‘‘
  • x β€” a pointer that gets filled in with the x offset of the upper left corner of this text, in pixels. may be NULL (she's flexible, we love that) πŸ™ˆ
  • y β€” a pointer that gets filled in with the y offset of the upper left corner of this text, in pixels. may be NULL too. equal opportunity NULL-ing 🫢
ngl the phrasing is "upper left corner" for both, and yes that's the whole corner, we're not doing math here, just reporting the vibe check on where the top-left pixel party starts.

🧚 THREAD SAFETY 🧚

⚠️ bestie. this function should be called on the thread that created the text. do NOT go wandering into other threads with this one, that's giving chaos and we don't do chaos. thread that made it = thread that asks about it. periodt. πŸ’€

⭐ AVAILABILITY ⭐

this function is available since SDL_ttf 3.0.0. if you're on anything older, she simply does not exist for you, sorry, no cap. 😭


πŸ‘€ SEE ALSO πŸ‘€

(yeah the bullet thing in the original is just like that, we don't question the ancients πŸ’œ β€” but the one you actually want next is TTF_SetTextPosition(3), her setter sister. get/set. a duo. a duo of all time. πŸ”₯)


and that's the page!! go forth and query your text position, you absolute legend πŸŒˆπŸ’–

signing off from the SDL_ttf 3.2.2 era β€” xoxo, your local manpage bestie πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from