SDL_StartTextInput(3)
π SDL_StartTextInput(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where we learn how to make a window actually listen to your typing π
β¨ NAME β¨
SDL_StartTextInput β start accepting Unicode text input events in a window. periodt. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_keyboard.h>
bool SDL_StartTextInput(SDL_Window *window);
π¦ DESCRIPTION π¦
okay so here's the tea β β this function will enable text input (that's SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING events, no cap) in the window you point at. the way it works is you use this one paired with SDL_StopTextInput(), like the iconic duo they are π«Ά
and listen β text input events are not received by default. like, at all. zero. nada. you gotta ask for them, bestie. π
also heads up, on some platforms using this function shows the screen keyboard and/or activates an IME, which can prevent some key press events from being passed through. so like, some keys might just get ghosted π not by you, by the platform. iykyk.
π FUNCTION PARAMETERS π
windowβ the window to enable text input. that's it, that's the whole list, she's simple and she's iconic π
β RETURN VALUE β
Returns true on success or false on failure π and if it fails, you call SDL_GetError() for more information β like, go get the receipts, she'll tell you what went wrong.
π THREAD SAFETY π
this function should only be called on the main thread. no side quests, no extra threads, main character energy only π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. she's new-ish, she's fresh, she ate π
π SEE ALSO π
SDL_SetTextInputArea(3)SDL_StartTextInputWithProperties(3)SDL_StopTextInput(3)SDL_TextInputActive(3)
ok that's the whole page bestie, go forth and enable some text input π
and that's a wrap on this little Simple Directmedia Layer moment, brought to you by SDL 3.4.18 β¨ thanks for reading, ily, mwah π«Άπ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms