SDL_GetModState(3)
π SDL_GetModState π
okay bestie, listen up β this is a page from the SDL3 FUNCTIONS collection, and today's main character is SDL_GetModState. she's small, she's simple, and she's about to tell you exactly which modifier keys your keyboard is holding down right now. shift? ctrl? alt? gui? she knows. she always knows. π
πΈ NAME πΈ
SDL_GetModState β get the current key modifier state for the keyboard. no cap, that's literally the whole job description. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_keyboard.h>
SDL_Keymod SDL_GetModState(void);
okay so you include the header, you call her with no arguments at all β she takes void, she needs nothing from you β and she hands you back an SDL_Keymod. she's low maintenance like that. π
π¦ RETURN VALUE π¦
She returns an OR'd combination of the modifier keys for the keyboard. π«Ά
that's it. that's the tea. it's giving bitmask, it's giving "every modifier currently held gets its own bit OR'd together." you want to check for one specific one? you AND it, bestie. iykyk. π
π₯ THREAD SAFETY π₯
It is safe to call this function from any thread. π
so go off, spawn all the threads you want, she does not care. main character energy means being available to everyone. π
β AVAILABILITY β
This function has been available since SDL 3.2.0. she's not new new, but she's not ancient either β she's in her prime. π
π SEE ALSO π
SDL_GetKeyboardState(3)β the girlies who want the whole keyboard, not just the modifiersSDL_SetModState(3)β if you're feeling chaotic and want to set the mod state yourself π
fr fr though β remember she only reports the modifier keys. for the full keys-down situation you're gonna want her friend in SEE ALSO. don't get it twisted. π
and that's a wrap, bestie! π this page came to you from Simple Directmedia Layer, documenting SDL 3.4.18 β mwah, slay, go write some keyboard code, you absolute icon. π β¨π¦
π¦ 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