arsa  2.7
Classes | Typedefs | Functions
SDL_keyboard.h File Reference
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_keycode.h"
#include "SDL_video.h"
#include "begin_code.h"
#include "close_code.h"

Go to the source code of this file.

Classes

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. More...
 

Functions

DECLSPEC SDL_Window *SDLCALL SDL_GetKeyboardFocus (void)
 Get the window which currently has keyboard focus. More...
 
DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState (int *numkeys)
 Get a snapshot of the current state of the keyboard. More...
 
DECLSPEC SDL_Keymod SDLCALL SDL_GetModState (void)
 Get the current key modifier state for the keyboard. More...
 
DECLSPEC void SDLCALL SDL_SetModState (SDL_Keymod modstate)
 Set the current key modifier state for the keyboard. More...
 
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode (SDL_Scancode scancode)
 Get the key code corresponding to the given scancode according to the current keyboard layout. More...
 
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey (SDL_Keycode key)
 Get the scancode corresponding to the given key code according to the current keyboard layout. More...
 
DECLSPEC const char *SDLCALL SDL_GetScancodeName (SDL_Scancode scancode)
 Get a human-readable name for a scancode. More...
 
DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName (const char *name)
 Get a scancode from a human-readable name. More...
 
DECLSPEC const char *SDLCALL SDL_GetKeyName (SDL_Keycode key)
 Get a human-readable name for a key. More...
 
DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName (const char *name)
 Get a key code from a human-readable name. More...
 
DECLSPEC void SDLCALL SDL_StartTextInput (void)
 Start accepting Unicode text input events. This function will show the on-screen keyboard if supported. More...
 
DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive (void)
 Return whether or not Unicode text input events are enabled. More...
 
DECLSPEC void SDLCALL SDL_StopTextInput (void)
 Stop receiving any text input events. This function will hide the on-screen keyboard if supported. More...
 
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. More...
 
DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport (void)
 Returns whether the platform has some screen keyboard support. More...
 
DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown (SDL_Window *window)
 Returns whether the screen keyboard is shown for given window. More...
 

Detailed Description

Include file for SDL keyboard event handling

Definition in file SDL_keyboard.h.

Typedef Documentation

◆ SDL_Keysym

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

◆ SDL_GetKeyboardFocus()

DECLSPEC SDL_Window* SDLCALL SDL_GetKeyboardFocus ( void  )

Get the window which currently has keyboard focus.

◆ SDL_GetKeyboardState()

DECLSPEC const Uint8* SDLCALL SDL_GetKeyboardState ( int *  numkeys)

Get a snapshot of the current state of the keyboard.

Parameters
numkeysif 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:

if ( state[SDL_SCANCODE_RETURN] ) {
printf("<RETURN> is pressed.\n");
}

◆ SDL_GetKeyFromName()

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

◆ SDL_GetKeyFromScancode()

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()

◆ 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_Keycode

◆ SDL_GetModState()

DECLSPEC SDL_Keymod SDLCALL SDL_GetModState ( void  )

Get the current key modifier state for the keyboard.

◆ SDL_GetScancodeFromKey()

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()

◆ SDL_GetScancodeFromName()

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

◆ SDL_GetScancodeName()

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

◆ SDL_HasScreenKeyboardSupport()

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()

◆ SDL_IsScreenKeyboardShown()

DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown ( SDL_Window window)

Returns whether the screen keyboard is shown for given window.

Parameters
windowThe window for which screen keyboard should be queried.
Returns
SDL_TRUE if screen keyboard is shown else SDL_FALSE.
See also
SDL_HasScreenKeyboardSupport()

◆ SDL_IsTextInputActive()

DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive ( void  )

Return whether or not Unicode text input events are enabled.

See also
SDL_StartTextInput()
SDL_StopTextInput()

◆ SDL_SetModState()

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.

◆ SDL_SetTextInputRect()

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()

◆ SDL_StartTextInput()

DECLSPEC void SDLCALL SDL_StartTextInput ( void  )

Start accepting Unicode text input events. This function will show the on-screen keyboard if supported.

See also
SDL_StopTextInput()
SDL_SetTextInputRect()
SDL_HasScreenKeyboardSupport()

◆ SDL_StopTextInput()

DECLSPEC void SDLCALL SDL_StopTextInput ( void  )

Stop receiving any text input events. This function will hide the on-screen keyboard if supported.

See also
SDL_StartTextInput()
SDL_HasScreenKeyboardSupport()