forked from ev1313/Pascal-SDL-2-Headers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdlkeyboard.inc
177 lines (143 loc) · 6.07 KB
/
sdlkeyboard.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//from "sdl_keyboard.h"
type
PKeyStateArr = ^TKeyStateArr;
TKeyStateArr = array[0..65000] of UInt8;
{**
* The SDL keysym structure, used in key events.
*}
PSDL_Keysym = ^TSDL_Keysym;
TSDL_Keysym = record
scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details
sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details
_mod: UInt16; // current key modifiers
unicode: UInt32; // (deprecated) use SDL_TextInputEvent instead
end;
{**
* Get the window which currently has keyboard focus.
*}
function SDL_GetKeyboardFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF}{$ENDIF};
{**
* Get a snapshot of the current state of the keyboard.
*
* numkeys if non-nil, receives the length of the returned array.
*
* An array of key states. Indexes into this array are obtained by using SDL_Scancode values.
*
*}
function SDL_GetKeyboardState(numkeys: PInt): PUInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF}{$ENDIF};
{**
* Get the current key modifier state for the keyboard.
*}
function SDL_GetModState: TSDL_KeyMod cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF}{$ENDIF};
{**
* Set the current key modifier state for the keyboard.
*
* This does not change the keyboard state, only the key modifier flags.
*}
procedure SDL_SetModState(modstate: TSDL_KeyMod) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF}{$ENDIF};
{**
* Get the key code corresponding to the given scancode according
* to the current keyboard layout.
*
* See SDL_Keycode for details.
*
* SDL_GetKeyName()
*}
function SDL_GetKeyFromScancode(scancode: TSDL_ScanCode): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF}{$ENDIF};
{**
* Get the scancode corresponding to the given key code according to the
* current keyboard layout.
*
* See SDL_Scancode for details.
*
* SDL_GetScancodeName()
*}
function SDL_GetScancodeFromKey(key: TSDL_KeyCode): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF}{$ENDIF};
{**
* Get a human-readable name for a scancode.
*
* A pointer to the name for the scancode.
*
* If the scancode doesn't have a name, this function returns
* an empty string ("").
*
*}
function SDL_GetScancodeName(scancode: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF}{$ENDIF};
{**
* Get a scancode from a human-readable name
*
* scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
*
* SDL_Scancode
*}
function SDL_GetScancodeFromName(const name: PAnsiChar): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF}{$ENDIF};
{**
* Get a human-readable name for a key.
*
* 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 ("").
*
* SDL_Key
*}
function SDL_GetKeyName(key: TSDL_KeyCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF}{$ENDIF};
{**
* Get a key code from a human-readable name
*
* key code, or SDLK_UNKNOWN if the name wasn't recognized
*
* SDL_Keycode
*}
function SDL_GetKeyFromName(const name: PAnsiChar): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF}{$ENDIF};
{**
* Start accepting Unicode text input events.
* This function will show the on-screen keyboard if supported.
*
* SDL_StopTextInput()
* SDL_SetTextInputRect()
* SDL_HasScreenKeyboardSupport()
*}
procedure SDL_StartTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF}{$ENDIF};
{**
* Return whether or not Unicode text input events are enabled.
*
* SDL_StartTextInput()
* SDL_StopTextInput()
*}
function SDL_IsTextInputActive: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF}{$ENDIF};
{**
* Stop receiving any text input events.
* This function will hide the on-screen keyboard if supported.
*
* SDL_StartTextInput()
* SDL_HasScreenKeyboardSupport()
*}
procedure SDL_StopTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF}{$ENDIF};
{**
* Set the rectangle used to type Unicode text inputs.
* This is used as a hint for IME and on-screen keyboard placement.
*
* SDL_StartTextInput()
*}
procedure SDL_SetTextInputRect(rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF}{$ENDIF};
{**
* Returns whether the platform has some screen keyboard support.
*
* SDL_TRUE if some keyboard support is available else SDL_FALSE.
*
* Not all screen keyboard functions are supported on all platforms.
*
* SDL_IsScreenKeyboardShown()
*}
function SDL_HasScreenKeyboardSupport: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF}{$ENDIF};
{**
* Returns whether the screen keyboard is shown for given window.
*
* window The window for which screen keyboard should be queried.
*
* Result - SDL_TRUE if screen keyboard is shown else SDL_FALSE.
*
* SDL_HasScreenKeyboardSupport()
*}
function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF}{$ENDIF};