zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_Keycode SDLCALL SDL_GetKeyFromName (const char *name)
 Get a key code from a human-readable name. 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 const char *SDLCALL SDL_GetKeyName (SDL_Keycode key)
 Get a human-readable name for a key. More...
 
DECLSPEC SDL_Keymod SDLCALL SDL_GetModState (void)
 Get the current key modifier state for the keyboard. 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 SDL_Scancode SDLCALL SDL_GetScancodeFromName (const char *name)
 Get a scancode from a human-readable name. More...
 
DECLSPEC const char *SDLCALL SDL_GetScancodeName (SDL_Scancode scancode)
 Get a human-readable name for a scancode. 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...
 
DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive (void)
 Return whether or not Unicode text input events are enabled. More...
 
DECLSPEC void SDLCALL SDL_SetModState (SDL_Keymod modstate)
 Set the current key modifier state for the keyboard. 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 void SDLCALL SDL_StartTextInput (void)
 Start accepting Unicode text input events. This function will show the on-screen keyboard if supported. More...
 
DECLSPEC void SDLCALL SDL_StopTextInput (void)
 Stop receiving any text input events. This function will hide the on-screen keyboard if supported. More...
 

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.

Definition at line 603 of file SDL_keyboard.c.

References SDL_keyboard.

Referenced by SDL_DestroyWindow(), SDL_PrivateJoystickShouldIgnoreEvent(), and SDL_SetRelativeMouseMode().

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:

* const Uint8 *state = SDL_GetKeyboardState(NULL);
* if ( state[SDL_SCANCODE_RETURN] ) {
* printf("<RETURN> is pressed.\n");
* }
*

Definition at line 832 of file SDL_keyboard.c.

References SDL_keyboard, and SDL_NUM_SCANCODES.

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

Definition at line 964 of file SDL_keyboard.c.

References i, NULL, SDL_default_keymap, SDL_GetScancodeFromName(), SDL_strlen(), and SDLK_UNKNOWN.

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

Definition at line 859 of file SDL_keyboard.c.

References SDL_InvalidParamError, SDL_keyboard, and SDL_NUM_SCANCODES.

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

Definition at line 925 of file SDL_keyboard.c.

References SDL_GetScancodeName(), SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_DELETE, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_RETURN, SDL_SCANCODE_SPACE, SDL_SCANCODE_TAB, SDL_UCS4ToUTF8(), SDLK_BACKSPACE, SDLK_DELETE, SDLK_ESCAPE, SDLK_RETURN, SDLK_SCANCODE_MASK, SDLK_SPACE, and SDLK_TAB.

Referenced by SDLTest_PrintEvent().

DECLSPEC SDL_Keymod SDLCALL SDL_GetModState ( void  )

Get the current key modifier state for the keyboard.

Definition at line 843 of file SDL_keyboard.c.

References SDL_keyboard.

Referenced by Zeni::Game::run().

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

Definition at line 872 of file SDL_keyboard.c.

References SDL_keyboard, SDL_NUM_SCANCODES, and SDL_SCANCODE_UNKNOWN.

Referenced by PSP_PumpEvents().

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

Definition at line 902 of file SDL_keyboard.c.

References i, SDL_arraysize, SDL_InvalidParamError, SDL_scancode_names, SDL_SCANCODE_UNKNOWN, and SDL_strcasecmp().

Referenced by SDL_GetKeyFromName().

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

Definition at line 887 of file SDL_keyboard.c.

References SDL_InvalidParamError, SDL_NUM_SCANCODES, and SDL_scancode_names.

Referenced by SDL_GetKeyName(), SDL_SendKeyboardKey(), and SDLTest_PrintEvent().

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

Definition at line 3074 of file SDL_video.c.

References SDL_VideoDevice::HasScreenKeyboardSupport, and SDL_FALSE.

Referenced by SDL_VideoInit().

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

Definition at line 3083 of file SDL_video.c.

References SDL_VideoDevice::IsScreenKeyboardShown, and SDL_FALSE.

DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive ( void  )

Return whether or not Unicode text input events are enabled.

See Also
SDL_StartTextInput()
SDL_StopTextInput()

Definition at line 3039 of file SDL_video.c.

References SDL_ENABLE, SDL_GetEventState, and SDL_TEXTINPUT.

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.

Definition at line 851 of file SDL_keyboard.c.

References SDL_keyboard.

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

Definition at line 3066 of file SDL_video.c.

References SDL_VideoDevice::SetTextInputRect.

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

Definition at line 3018 of file SDL_video.c.

References SDL_ENABLE, SDL_EventState(), SDL_GetFocusWindow(), SDL_TEXTEDITING, SDL_TEXTINPUT, SDL_VideoDevice::ShowScreenKeyboard, and SDL_VideoDevice::StartTextInput.

Referenced by SDL_VideoInit().

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

Definition at line 3045 of file SDL_video.c.

References SDL_VideoDevice::HideScreenKeyboard, SDL_DISABLE, SDL_EventState(), SDL_GetFocusWindow(), SDL_TEXTEDITING, SDL_TEXTINPUT, and SDL_VideoDevice::StopTextInput.