TTF_GetNextTextSubString(3)

πŸ’– TTF_GetNextTextSubString(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the manual, where we're talking about TTF_GetNextTextSubString. she's living in SDL3_ttf/SDL_ttf.h, she's defined there, and she is literally here to walk you through a text object one substring at a time. no cap. πŸ¦‹


✨ NAME ✨

TTF_GetNextTextSubString β€” get the next substring in a text object πŸ‘‘


πŸ“ HEADER FILE πŸ“

defined in SDL3_ttf/SDL_ttf.h β€” that's where she lives, that's her address, respect it πŸ’…


🌸 SYNOPSIS 🌸

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_GetNextTextSubString(TTF_Text *text, const TTF_SubString *substring, TTF_SubString *next);

look at her. so clean. so iconic. ✨


πŸŽ€ DESCRIPTION πŸŽ€

so the way this works, bestie: you hand her a text object and a substring, and she goes and gets you the next one. iterator energy. main character behaviour fr fr.

and here's the little plot twist you need to know about: if you call this at the end of the text, she doesn't just give you nothing and walk away β€” she returns a zero length substring with the TTF_SUBSTRING_TEXT_END flag set. so that's your lil signal that you've hit the end. πŸ™ˆ she's polite like that.


🫢 FUNCTION PARAMETERS 🫢

  • text β€” the TTF_Text you want to query. this is the text object in question, your girl πŸ’œ
  • substring β€” the TTF_SubString you want to query. the one you're currently sitting on πŸ“
  • next β€” a pointer that gets filled in with the next substring. yes she writes into it. that's the whole point πŸ’…

⭐ RETURN VALUE ⭐

returns true on success, or false on failure. and if it's a fail? don't panic, just call SDL_GetError() for more information. she'll tell you what went wrong, i promise 😭


🧡 THREAD SAFETY 🧡

bestie listen. this function should be called on the thread that created the text. that's the rule. don't be out here calling her from some random thread, that's not the vibe 😀

🌈 AVAILABILITY 🌈

this function has been available since SDL_ttf 3.0.0. vintage-ish. classic. ate. πŸ”₯


πŸ’« SEE ALSO πŸ’«

okay there's no SEE ALSO section on this one, so instead just go read the rest of the SDL_ttf docs, they're all right there, iykyk πŸ¦‹


and that's the whole page, bestie!! go iterate over some substrings, you're gonna slay it πŸ’–βœ¨πŸŽ€

this has been your girl from the SDL_ttf manual, page TTF_GetNextTextSubString(3), brought to you by SDL_ttf 3.2.2 β€” mwah, take care of yourself, hydrate, and don't forget to check for the end flag πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from