1 //from "sdl_keyboard.h"
4 PKeyStateArr = ^TKeyStateArr;
5 TKeyStateArr = array[0..65000] of UInt8;
8 * The SDL keysym structure, used in key events.
10 PSDL_Keysym = ^TSDL_Keysym;
12 scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details
13 sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details
14 _mod: UInt16; // current key modifiers
15 unicode: UInt32; // (deprecated) use SDL_TextInputEvent instead
19 * Get the window which currently has keyboard focus.
22 function SDL_GetKeyboardFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF}{$ENDIF};
25 * Get a snapshot of the current state of the keyboard.
27 * numkeys if non-nil, receives the length of the returned array.
29 * An array of key states. Indexes into this array are obtained by using SDL_Scancode values.
33 function SDL_GetKeyboardState(numkeys: PInt): PUInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF}{$ENDIF};
36 * Get the current key modifier state for the keyboard.
39 function SDL_GetModState: TSDL_KeyMod cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF}{$ENDIF};
42 * Set the current key modifier state for the keyboard.
44 * This does not change the keyboard state, only the key modifier flags.
47 procedure SDL_SetModState(modstate: TSDL_KeyMod) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF}{$ENDIF};
50 * Get the key code corresponding to the given scancode according
51 * to the current keyboard layout.
53 * See SDL_Keycode for details.
58 function SDL_GetKeyFromScancode(scancode: TSDL_ScanCode): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF}{$ENDIF};
61 * Get the scancode corresponding to the given key code according to the
62 * current keyboard layout.
64 * See SDL_Scancode for details.
66 * SDL_GetScancodeName()
69 function SDL_GetScancodeFromKey(key: TSDL_KeyCode): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF}{$ENDIF};
72 * Get a human-readable name for a scancode.
74 * A pointer to the name for the scancode.
76 * If the scancode doesn't have a name, this function returns
77 * an empty string ("").
81 function SDL_GetScancodeName(scancode: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF}{$ENDIF};
84 * Get a scancode from a human-readable name
86 * scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
91 function SDL_GetScancodeFromName(const name: PAnsiChar): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF}{$ENDIF};
94 * Get a human-readable name for a key.
96 * A pointer to a UTF-8 string that stays valid at least until the next
97 * call to this function. If you need it around any longer, you must
98 * copy it. If the key doesn't have a name, this function returns an
104 function SDL_GetKeyName(key: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF}{$ENDIF};
107 * Get a key code from a human-readable name
109 * key code, or SDLK_UNKNOWN if the name wasn't recognized
114 function SDL_GetKeyFromName(const name: PAnsiChar): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF}{$ENDIF};
117 * Start accepting Unicode text input events.
118 * This function will show the on-screen keyboard if supported.
120 * SDL_StopTextInput()
121 * SDL_SetTextInputRect()
122 * SDL_HasScreenKeyboardSupport()
125 procedure SDL_StartTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF}{$ENDIF};
128 * Return whether or not Unicode text input events are enabled.
130 * SDL_StartTextInput()
131 * SDL_StopTextInput()
134 function SDL_IsTextInputActive: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF}{$ENDIF};
137 * Stop receiving any text input events.
138 * This function will hide the on-screen keyboard if supported.
140 * SDL_StartTextInput()
141 * SDL_HasScreenKeyboardSupport()
144 procedure SDL_StopTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF}{$ENDIF};
147 * Set the rectangle used to type Unicode text inputs.
148 * This is used as a hint for IME and on-screen keyboard placement.
150 * SDL_StartTextInput()
153 procedure SDL_SetTextInputRect(rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF}{$ENDIF};
156 * Returns whether the platform has some screen keyboard support.
158 * SDL_TRUE if some keyboard support is available else SDL_FALSE.
160 * Not all screen keyboard functions are supported on all platforms.
162 * SDL_IsScreenKeyboardShown()
165 function SDL_HasScreenKeyboardSupport: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF}{$ENDIF};
168 * Returns whether the screen keyboard is shown for given window.
170 * window The window for which screen keyboard should be queried.
172 * Result - SDL_TRUE if screen keyboard is shown else SDL_FALSE.
174 * SDL_HasScreenKeyboardSupport()
177 function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF}{$ENDIF};