SDL_SetTextInputArea(3)

✨ SDL_SetTextInputArea ✨

okay bestie, welcome to the SDL_SetTextInputArea(3) page β€” it's a real one from the SDL3 FUNCTIONS crew, and it's literally all about telling SDL where your text input vibes live πŸ’…


🌸 NAME 🌸

SDL_SetTextInputArea β€” set the area used to type Unicode text input.

yes queen, we're setting the text input area, that's the whole job πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_keyboard.h>

bool SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor);

look at that signature, she's giving function, she's giving bool, she's giving three parameters and not one more ✨


πŸ’– DESCRIPTION πŸ’–

So here's the tea: native input methods may place a window with word suggestions near the cursor β€” and you want that little suggestion popup to not cover the text being entered. Rude of it, honestly. So this function is how you handle that. πŸ™ˆ


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • window β€” the window for which to set the text input area. your main character window, fr fr
  • rect β€” the SDL_Rect representing the text input area, in window coordinates, or NULL to clear it. pass NULL and it's gone, periodt
  • cursor β€” the offset of the current cursor location relative to rect->x, in window coordinates. it's an offset, bestie, not a coordinate, do not come for me

⭐ RETURN VALUE ⭐

Returns true on success or false on failure; call SDL_GetError() for more information.

so if it's false, go ask SDL_GetError() what happened, she'll tell you everything 😭


🧚 THREAD SAFETY 🧚

This function should only be called on the main thread.

main thread ONLY, bestie. do not be cute with the other threads. i'm serious. πŸ’€

🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0.

3.2.0 girlies rise up, you have been blessed πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

go read those too, iykyk 🫢


and that's the whole page, no cap β€” this was the Simple Directmedia Layer manual, SDL 3.4.18 edition, dated 2024, and honestly? iconic. slay. bye bestie πŸ’œ

πŸ“¦ where this page comes from