TTF_SetTextPosition(3)
β¨ TTF_SetTextPosition β¨
okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the manual π this one's a lil function called TTF_SetTextPosition, and it's literally the thing that tells a text object where to sit. let's get into it π«Ά
πΈ NAME πΈ
TTF_SetTextPosition β set the position of a text object. that's it, that's the whole vibe π
π HEADER FILE π
it lives in SDL3_ttf/SDL_ttf.h, no cap π
π¦ SYNOPSIS π¦
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_SetTextPosition(TTF_Text *text, int x, int y);
look at her. three little args, returns a bool. iconic. π
π DESCRIPTION π
so what does she actually do? this one lets you position multiple text objects within a single wrapping text area. like, you've got one big wrapping zone and a bunch of text objects hanging out inside it, and this is how you tell each one where to go. slay β¨
heads up though β this function may cause the internal text representation to be rebuilt. so it's not just a free little nudge, okay? she might do some internal rearranging. lowkey important to know π
π FUNCTION PARAMETERS π
textβ theTTF_Textto modify. this is your main character, the text object getting moved πxβ the x offset of the upper left corner of this text, in pixels. that's the horizontal spot πyβ the y offset of the upper left corner of this text, in pixels. and that's the vertical one π
so it's the upper left corner we're positioning, in pixels, both axes. got it? got it. π
π§ THREAD SAFETY π§
real talk bestie: this function should be called on the thread that created the text. like, the same thread. don't be out here calling it from some random other thread, that's not the move π keep it in the family fr fr.
β AVAILABILITY β
this function has been available since SDL_ttf 3.0.0 β so she's been around, she's not new, she's established. periodt. π
π SEE ALSO π
β’(3), TTF_GetTextPosition(3)
(yes, go read TTF_GetTextPosition(3) too, she's the one who tells you where things are β complementary queen energy π
)
and that's the whole page, bestie!! πΈ this was pulled straight from SDL_ttf 3.2.2 in the SDL_ttf manual β go forth and position your text objects with confidence, you've got this π«Άβ¨π
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms