Code Map
module lib.sdl2.keyboard;
//! \brief The SDL keysym structure, used in key events.
struct SDL_Keysym
{
public:
scancode: SDL_Scancode;
sym: SDL_Keycode;
mod: Uint16;
unused: Uint32;
}
//! \brief Get the window which currently has keyboard focus.
fn SDL_GetKeyboardFocus() SDL_Window*;
//! \brief Get a snapshot of the current state of the keyboard.
fn SDL_GetKeyboardState(numkeys: i32*) Uint8*;
//! \brief Get the current key modifier state for the keyboard.
fn SDL_GetModState() SDL_Keymod;
//! \brief Set the current key modifier state for the keyboard.
fn SDL_SetModState(modstate: SDL_Keymod);
//! \brief Get the key code corresponding to the given scancode according
//! to the current keyboard layout.
fn SDL_GetKeyFromScancode(scancode: SDL_Scancode) SDL_Keycode;
//! \brief Get the scancode corresponding to the given key code according
//! to the current keyboard layout.
fn SDL_GetScancodeFromKey(key: SDL_Keycode) SDL_Scancode;
//! \brief Get a human-readable name for a scancode.
fn SDL_GetScancodeName(scancode: SDL_Scancode) char*;
//! \brief Get a scancode from a human-readable name
fn SDL_GetScancodeFromName(name: const(const(char)*)) SDL_Scancode;
//! \brief Get a human-readable name for a key.
fn SDL_GetKeyName(key: SDL_Keycode) char*;
//! \brief Get a key code from a human-readable name
fn SDL_GetKeyFromName(name: const(const(char)*)) SDL_Keycode;
//! \brief Start accepting Unicode text input events. This function will
//! show the on-screen keyboard if supported.
fn SDL_StartTextInput();
//! \brief Return whether or not Unicode text input events are enabled.
fn SDL_IsTextInputActive() SDL_bool;
//! \brief Stop receiving any text input events. This function will hide
//! the on-screen keyboard if supported.
fn SDL_StopTextInput();
//! \brief Set the rectangle used to type Unicode text inputs. This is used
//! as a hint for IME and on-screen keyboard placement.
fn SDL_SetTextInputRect(rect: SDL_Rect*);
//! \brief Returns whether the platform has some screen keyboard support.
fn SDL_HasScreenKeyboardSupport() SDL_bool;
//! \brief Returns whether the screen keyboard is shown for given window.
fn SDL_IsScreenKeyboardShown(window: SDL_Window*) SDL_bool;
\brief The SDL keysym structure, used in key events.
\note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
\brief Get the window which currently has keyboard focus.
\brief Get a snapshot of the current state of the keyboard.
\param numkeys if non-NULL, receives the length of the returned array.
\return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
\b Example:
\code
const Uint8 *state = SDL_GetKeyboardState(NULL);
if ( state[SDL_SCANCODE_RETURN] ) {
printf("
\brief Get the current key modifier state for the keyboard.
\brief Set the current key modifier state for the keyboard.
\note This does not change the keyboard state, only the key modifier flags.
\brief Get the key code corresponding to the given scancode according to the current keyboard layout.
See ::SDL_Keycode for details.
\sa SDL_GetKeyName()
\brief Get the scancode corresponding to the given key code according to the current keyboard layout.
See ::SDL_Scancode for details.
\sa SDL_GetScancodeName()
\brief Get a human-readable name for a scancode.
\return A pointer to the name for the scancode. If the scancode doesn't have a name, this function returns an empty string ("").
\sa SDL_Scancode
\brief Get a scancode from a human-readable name
\return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
\sa SDL_Scancode
\brief Get a human-readable name for a key.
\return 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 ("").
\sa SDL_Key
\brief Get a key code from a human-readable name
\return key code, or SDLK_UNKNOWN if the name wasn't recognized
\sa SDL_Keycode
\brief Start accepting Unicode text input events. This function will show the on-screen keyboard if supported.
\sa SDL_StopTextInput() \sa SDL_SetTextInputRect() \sa SDL_HasScreenKeyboardSupport()
\brief Return whether or not Unicode text input events are enabled.
\sa SDL_StartTextInput() \sa SDL_StopTextInput()
\brief Stop receiving any text input events. This function will hide the on-screen keyboard if supported.
\sa SDL_StartTextInput() \sa SDL_HasScreenKeyboardSupport()
\brief Set the rectangle used to type Unicode text inputs. This is used as a hint for IME and on-screen keyboard placement.
\sa SDL_StartTextInput()
\brief Returns whether the platform has some screen keyboard support.
\return SDL_TRUE if some keyboard support is available else SDL_FALSE.
\note Not all screen keyboard functions are supported on all platforms.
\sa SDL_IsScreenKeyboardShown()
\brief Returns whether the screen keyboard is shown for given window.
\param window The window for which screen keyboard should be queried.
\return SDL_TRUE if screen keyboard is shown else SDL_FALSE.
\sa SDL_HasScreenKeyboardSupport()