TTF_DrawSurfaceText(3)

✨ TTF_DrawSurfaceText ✨

okay bestie, gather round, it's TTF_DrawSurfaceText(3) time β€” a lil function from the SDL_ttf3 FUNCTIONS squad, and it's literally just "draw text to an SDL surface." that's the whole vibe. πŸ’…


🌸 NAME 🌸

TTF_DrawSurfaceText β€” Draw text to an SDL surface. periodt.


πŸŽ€ HEADER FILE πŸŽ€

Defined in SDL3_ttf/SDL_ttf.h


πŸ¦‹ SYNOPSIS πŸ¦‹

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_DrawSurfaceText(TTF_Text *text, int x, int y, SDL_Surface *surface);

πŸ’– DESCRIPTION πŸ’–

so like. here's the tea. πŸ«– your text has to have been created using a TTF_TextEngine from

TTF_CreateSurfaceTextEngine().

no other engine, bestie. it's giving loyalty. iykyk.


⭐ FUNCTION PARAMETERS ⭐

  • text β€” the text to draw. the main character, obviously. πŸ‘‘
  • x β€” the x coordinate in pixels, positive from the left edge towards the right. ➑️
  • y β€” the y coordinate in pixels, positive from the top edge towards the bottom. ⬇️
  • surface β€” the surface to draw on. the canvas. the stage. the moment. ✨

🌈 RETURN VALUE 🌈

Returns true on success or false on failure β€” and if it's a flop, call SDL_GetError() for more information. 😭 no cap, always check your errors.


πŸ”₯ THREAD SAFETY πŸ”₯

This function should be called on the thread that created the text. like, the SAME thread. don't be messy about it. πŸ™ˆ


πŸ’œ AVAILABILITY πŸ’œ

This function is available since SDL_ttf 3.0.0. so it's been iconic for a while now. πŸ’…


🧚 SEE ALSO 🧚

  • β€’(3)
  • TTF_CreateSurfaceTextEngine(3)
  • β€’(3)
  • TTF_CreateText(3)

and that's the whole page, bestie!! go draw some text, slay, and remember to check that return value. 🫢

β€” with love, from the SDL_ttf girlies. this one's part of SDL_ttf 3.2.2 πŸŽ€πŸŒΈπŸ’–

πŸ“¦ where this page comes from