SDL standard library
SDL_keyboard.h File Reference
Include file for SDL keyboard event handling. More...
Go to the source code of this file.
Data Structures | |
struct | SDL_Keysym |
The SDL keysym structure, used in key events. More... | |
Typedefs | |
typedef struct SDL_Keysym | SDL_Keysym |
The SDL keysym structure, used in key events. | |
Functions | |
DECLSPEC SDL_Window *SDLCALL | SDL_GetKeyboardFocus (void) |
Get the window which currently has keyboard focus. | |
DECLSPEC const Uint8 *SDLCALL | SDL_GetKeyboardState (int *numkeys) |
Get a snapshot of the current state of the keyboard. | |
DECLSPEC SDL_Keymod SDLCALL | SDL_GetModState (void) |
Get the current key modifier state for the keyboard. | |
DECLSPEC void SDLCALL | SDL_SetModState (SDL_Keymod modstate) |
Set the current key modifier state for the keyboard. | |
DECLSPEC SDL_Keycode SDLCALL | SDL_GetKeyFromScancode (SDL_Scancode scancode) |
Get the key code corresponding to the given scancode according to the current keyboard layout. | |
DECLSPEC SDL_Scancode SDLCALL | SDL_GetScancodeFromKey (SDL_Keycode key) |
Get the scancode corresponding to the given key code according to the current keyboard layout. | |
DECLSPEC const char *SDLCALL | SDL_GetScancodeName (SDL_Scancode scancode) |
Get a human-readable name for a scancode. | |
DECLSPEC SDL_Scancode SDLCALL | SDL_GetScancodeFromName (const char *name) |
Get a scancode from a human-readable name. | |
DECLSPEC const char *SDLCALL | SDL_GetKeyName (SDL_Keycode key) |
Get a human-readable name for a key. | |
DECLSPEC SDL_Keycode SDLCALL | SDL_GetKeyFromName (const char *name) |
Get a key code from a human-readable name. | |
DECLSPEC void SDLCALL | SDL_StartTextInput (void) |
Start accepting Unicode text input events. | |
DECLSPEC SDL_bool SDLCALL | SDL_IsTextInputActive (void) |
Return whether or not Unicode text input events are enabled. | |
DECLSPEC void SDLCALL | SDL_StopTextInput (void) |
Stop receiving any text input events. | |
DECLSPEC void SDLCALL | SDL_SetTextInputRect (SDL_Rect *rect) |
Set the rectangle used to type Unicode text inputs. | |
DECLSPEC SDL_bool SDLCALL | SDL_HasScreenKeyboardSupport (void) |
Returns whether the platform has some screen keyboard support. | |
DECLSPEC SDL_bool SDLCALL | SDL_IsScreenKeyboardShown (SDL_Window *window) |
Returns whether the screen keyboard is shown for given window. |
Detailed Description
Include file for SDL keyboard event handling.
Definition in file SDL_keyboard.h.
Typedef Documentation
typedef struct SDL_Keysym SDL_Keysym |
The SDL keysym structure, used in key events.
- Note:
- If you are looking for translated character input, see the SDL_TEXTINPUT event.
Function Documentation
DECLSPEC SDL_Window* SDLCALL SDL_GetKeyboardFocus | ( | void | ) |
Get the window which currently has keyboard focus.
DECLSPEC const Uint8* SDLCALL SDL_GetKeyboardState | ( | int * | numkeys ) |
Get a snapshot of the current state of the keyboard.
- Parameters:
-
numkeys if non-NULL, receives the length of the returned array.
- Returns:
- An array of key states. Indexes into this array are obtained by using SDL_Scancode values.
Example:
const Uint8 *state = SDL_GetKeyboardState(NULL); if ( state[SDL_SCANCODE_RETURN] ) { printf("<RETURN> is pressed.\n"); }
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName | ( | const char * | name ) |
Get a key code from a human-readable name.
- Returns:
- key code, or SDLK_UNKNOWN if the name wasn't recognized
- See also:
- SDL_Keycode
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode | ( | SDL_Scancode | scancode ) |
Get the key code corresponding to the given scancode according to the current keyboard layout.
See SDL_Keycode for details.
- See also:
- SDL_GetKeyName()
DECLSPEC const char* SDLCALL SDL_GetKeyName | ( | SDL_Keycode | key ) |
Get a human-readable name for a key.
- Returns:
- A pointer to a UTF-8 string that stays valid at least until the next call to this function. If you need it around any longer, you must copy it. If the key doesn't have a name, this function returns an empty string ("").
- See also:
- SDL_Key
DECLSPEC SDL_Keymod SDLCALL SDL_GetModState | ( | void | ) |
Get the current key modifier state for the keyboard.
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey | ( | SDL_Keycode | key ) |
Get the scancode corresponding to the given key code according to the current keyboard layout.
See SDL_Scancode for details.
- See also:
- SDL_GetScancodeName()
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName | ( | const char * | name ) |
Get a scancode from a human-readable name.
- Returns:
- scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
- See also:
- SDL_Scancode
DECLSPEC const char* SDLCALL SDL_GetScancodeName | ( | SDL_Scancode | scancode ) |
Get a human-readable name for a scancode.
- Returns:
- A pointer to the name for the scancode. If the scancode doesn't have a name, this function returns an empty string ("").
- See also:
- SDL_Scancode
DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport | ( | void | ) |
Returns whether the platform has some screen keyboard support.
- Returns:
- SDL_TRUE if some keyboard support is available else SDL_FALSE.
- Note:
- Not all screen keyboard functions are supported on all platforms.
- See also:
- SDL_IsScreenKeyboardShown()
DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown | ( | SDL_Window * | window ) |
Returns whether the screen keyboard is shown for given window.
- Parameters:
-
window The window for which screen keyboard should be queried.
- Returns:
- SDL_TRUE if screen keyboard is shown else SDL_FALSE.
- See also:
- SDL_HasScreenKeyboardSupport()
DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive | ( | void | ) |
Return whether or not Unicode text input events are enabled.
- See also:
- SDL_StartTextInput()
- SDL_StopTextInput()
DECLSPEC void SDLCALL SDL_SetModState | ( | SDL_Keymod | modstate ) |
Set the current key modifier state for the keyboard.
- Note:
- This does not change the keyboard state, only the key modifier flags.
DECLSPEC void SDLCALL SDL_SetTextInputRect | ( | SDL_Rect * | rect ) |
Set the rectangle used to type Unicode text inputs.
This is used as a hint for IME and on-screen keyboard placement.
- See also:
- SDL_StartTextInput()
DECLSPEC void SDLCALL SDL_StartTextInput | ( | void | ) |
Start accepting Unicode text input events.
This function will show the on-screen keyboard if supported.
DECLSPEC void SDLCALL SDL_StopTextInput | ( | void | ) |
Stop receiving any text input events.
This function will hide the on-screen keyboard if supported.
Generated on Tue Jul 12 2022 13:56:25 by 1.7.2