SDL_Keymod(3type)
π SDL_Keymod π
okay so bestie, welcome to the SDL_Keymod page, straight out of the SDL3 DATATYPES section. this is the whole vibe of keyboard modifiers in SDL3, and it's lowkey iconic. β¨
β¨ NAME β¨
SDL_Keymod β valid key modifiers (possibly OR'd together). no cap, that's literally it. π
πΈ SYNOPSIS πΈ
first you gotta bring in the header:
#include <SDL3/SDL_keycode.h>
then you got the actual type, which is just a lil Uint16 in a trench coat:
typedef Uint16 SDL_Keymod;
and here come ALL the defines, exactly as they are, don't touch a single character:
#define SDL_KMOD_NONE 0x0000u /**< no modifier is applicable. */
#define SDL_KMOD_LSHIFT 0x0001u /**< the left Shift key is down. */
#define SDL_KMOD_RSHIFT 0x0002u /**< the right Shift key is down. */
#define SDL_KMOD_LEVEL5 0x0004u /**< the Level 5 Shift key is down. */
#define SDL_KMOD_LCTRL 0x0040u /**< the left Ctrl (Control) key is down. */
#define SDL_KMOD_RCTRL 0x0080u /**< the right Ctrl (Control) key is down. */
#define SDL_KMOD_LALT 0x0100u /**< the left Alt key is down. */
#define SDL_KMOD_RALT 0x0200u /**< the right Alt key is down. */
#define SDL_KMOD_LGUI 0x0400u /**< the left GUI key (often the Windows key) is down. */
#define SDL_KMOD_RGUI 0x0800u /**< the right GUI key (often the Windows key) is down. */
#define SDL_KMOD_NUM 0x1000u /**< the Num Lock key (may be located on an extended keypad) is down. */
#define SDL_KMOD_CAPS 0x2000u /**< the Caps Lock key is down. */
#define SDL_KMOD_MODE 0x4000u /**< the !AltGr key is down. */
#define SDL_KMOD_SCROLL 0x8000u /**< the Scroll Lock key is down. */
#define SDL_KMOD_CTRL (SDL_KMOD_LCTRL | SDL_KMOD_RCTRL) /**< Any Ctrl key is down. */
#define SDL_KMOD_SHIFT (SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT) /**< Any Shift key is down. */
#define SDL_KMOD_ALT (SDL_KMOD_LALT | SDL_KMOD_RALT) /**< Any Alt key is down. */
#define SDL_KMOD_GUI (SDL_KMOD_LGUI | SDL_KMOD_RGUI) /**< Any GUI key is down. */
#endif /* SDL_keycode_h_ */
π the modifiers, one by one π
these are the individual flags, and yes they can be OR'd together, so you can stack them like accessories. π«Ά
SDL_KMOD_NONEβ0x0000u: no modifier is applicable. it's giving absolutely nothing, and honestly? sometimes that's the moment. πSDL_KMOD_LSHIFTβ0x0001u: the left Shift key is down.SDL_KMOD_RSHIFTβ0x0002u: the right Shift key is down.SDL_KMOD_LEVEL5β0x0004u: the Level 5 Shift key is down. rare, fancy, main character energy. πSDL_KMOD_LCTRLβ0x0040u: the left Ctrl (Control) key is down.SDL_KMOD_RCTRLβ0x0080u: the right Ctrl (Control) key is down.SDL_KMOD_LALTβ0x0100u: the left Alt key is down.SDL_KMOD_RALTβ0x0200u: the right Alt key is down.SDL_KMOD_LGUIβ0x0400u: the left GUI key is down. that's often the Windows key, iykyk. πͺSDL_KMOD_RGUIβ0x0800u: the right GUI key is down. also often the Windows key. no cap.SDL_KMOD_NUMβ0x1000u: the Num Lock key is down, and it may be located on an extended keypad. slay, extended keypad. π’SDL_KMOD_CAPSβ0x2000u: the Caps Lock key is down. YOU KNOW WHAT THAT MEANS. πSDL_KMOD_MODEβ0x4000u: the!AltGrkey is down. yes, that exclamation mark is literally in the name, don't come for me.SDL_KMOD_SCROLLβ0x8000u: the Scroll Lock key is down. the forgotten icon, still valid. π
π the combined "any of them" ones π
because sometimes you don't care which side, you just want the whole vibe check to pass. β¨
SDL_KMOD_CTRLβ(SDL_KMOD_LCTRL | SDL_KMOD_RCTRL): any Ctrl key is down.SDL_KMOD_SHIFTβ(SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT): any Shift key is down.SDL_KMOD_ALTβ(SDL_KMOD_LALT | SDL_KMOD_RALT): any Alt key is down.SDL_KMOD_GUIβ(SDL_KMOD_LGUI | SDL_KMOD_RGUI): any GUI key is down.
π¦ AVAILABILITY π¦
this datatype is available since SDL 3.2.0. so if you're on anything older, bestie, it's not you, it's the version. π
and that's the page!! brought to you by Simple Directmedia Layer, version SDL 3.4.18, under the title SDL_Keymod(3type). periodt. πβ¨π
π¦ 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