SDL_STARTTEXTINPUTWITHPROPERTIES(3)
π SDL_StartTextInputWithProperties(3) π
okay bestie, gather round, because this one is the manual page for SDL_StartTextInputWithProperties(3) and it's genuinely so useful. it lives in the SDL3 functions family and it's about to make your window accept actual human typing. let's go π
β¨ NAME β¨
SDL_StartTextInputWithProperties β start accepting Unicode text input events in a window, with properties describing the input.
like. it turns on the typing. but make it customized. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_keyboard.h>
bool SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props);
π¦ DESCRIPTION π¦
so this function will enable text input β that's SDL_EVENT_TEXT_INPUT and SDL_EVENT_TEXT_EDITING events β in the window you point at. and PLEASE, bestie, use this paired with SDL_StopTextInput(). they're a set. a duo. you don't take one without the other, it's giving matching friendship bracelets. π«Ά
important: text input events are not received by default. so if you're sitting there like "why is nothing happening π" β that's why. you gotta call this.
also, 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. lowkey a side effect, but a real one, so know about it. π
these are the supported properties:
SDL_PROP_TEXTINPUT_TYPE_NUMBERβ anSDL_TextInputTypevalue that describes the text being input. defaults toSDL_TEXTINPUT_TYPE_TEXT.SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBERβ anSDL_Capitalizationvalue that describes how text should be capitalized. defaults toSDL_CAPITALIZE_SENTENCESfor normal text entry,SDL_CAPITALIZE_WORDSforSDL_TEXTINPUT_TYPE_TEXT_NAME, andSDL_CAPITALIZE_NONEfor e-mail addresses, usernames, and passwords. (yeah, it's smart about it, no cap β¨)SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEANβtrueto enable auto completion and auto correction. defaults totrue.SDL_PROP_TEXTINPUT_MULTILINE_BOOLEANβtrueif multiple lines of text are allowed. this defaults totrueifSDL_HINT_RETURN_KEY_HIDES_IMEis"0"or is not set, and defaults tofalseifSDL_HINT_RETURN_KEY_HIDES_IMEis"1".
π€ android girlies, this one's for you
on Android you can directly specify the input type:
SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBERβ the text input type to use, overriding other properties. this is documented athttps://developer.android.com/reference/android/text/InputType.
like, it just overrides everything else. main character energy, honestly. π
π FUNCTION PARAMETERS π
windowβ the window to enable text input. (yes, the window. the one you want the typing to happen in π)propsβ the properties to use. (all those cute little properties from above π)
β RETURN VALUE β
returns true on success or false on failure. and if it fails, bestie, call SDL_GetError() for more information β that's where the tea is. π
π§ THREAD SAFETY π§
this function should only be called on the main thread. don't be sneaky, don't try it from a worker thread, it's not that girl. π
π AVAILABILITY π
this function is available since SDL 3.2.0. vintage-ish, but make it fresh. β¨
π₯ SEE ALSO π₯
and that's the whole page, bestie!! you ate. go forth and accept Unicode text input with properties, you absolute icon π β¨
this has been brought to you by Simple Directmedia Layer β SDL 3.4.18 β mwah, love u, bye π«Άπ
π¦ 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