cmdfx 0.3.2
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
keys.h
Go to the documentation of this file.
1
11#pragma once
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#if defined(_WINDOWS) || defined(_WIN32) || defined(__CYGWIN__) || \
18 defined(__MINGW32__)
19 #define KEY_A 0x41
20 #define KEY_B 0x42
21 #define KEY_C 0x43
22 #define KEY_D 0x44
23 #define KEY_E 0x45
24 #define KEY_F 0x46
25 #define KEY_G 0x47
26 #define KEY_H 0x48
27 #define KEY_I 0x49
28 #define KEY_J 0x4A
29 #define KEY_K 0x4B
30 #define KEY_L 0x4C
31 #define KEY_M 0x4D
32 #define KEY_N 0x4E
33 #define KEY_O 0x4F
34 #define KEY_P 0x50
35 #define KEY_Q 0x51
36 #define KEY_R 0x52
37 #define KEY_S 0x53
38 #define KEY_T 0x54
39 #define KEY_U 0x55
40 #define KEY_V 0x56
41 #define KEY_W 0x57
42 #define KEY_X 0x58
43 #define KEY_Y 0x59
44 #define KEY_Z 0x5A
45 #define KEY_0 0x30
46 #define KEY_1 0x31
47 #define KEY_2 0x32
48 #define KEY_3 0x33
49 #define KEY_4 0x34
50 #define KEY_5 0x35
51 #define KEY_6 0x36
52 #define KEY_7 0x37
53 #define KEY_8 0x38
54 #define KEY_9 0x39
55 #define KEY_ENTER 0x0D
56 #define KEY_ESCAPE 0x1B
57 #define KEY_BACKSPACE 0x08
58 #define KEY_TAB 0x09
59 #define KEY_SPACE 0x20
60 #define KEY_MINUS 0x6D
61 #define KEY_EQUAL 0x6B
62 #define KEY_LEFT_BRACKET 0xDB
63 #define KEY_RIGHT_BRACKET 0xDD
64 #define KEY_BACKSLASH 0xDC
65 #define KEY_SEMICOLON 0xBA
66 #define KEY_APOSTROPHE 0xDE
67 #define KEY_COMMA 0xBC
68 #define KEY_PERIOD 0xBE
69 #define KEY_SLASH 0xBF
70 #define KEY_CAPS_LOCK 0x14
71 #define KEY_F1 0x70
72 #define KEY_F2 0x71
73 #define KEY_F3 0x72
74 #define KEY_F4 0x73
75 #define KEY_F5 0x74
76 #define KEY_F6 0x75
77 #define KEY_F7 0x76
78 #define KEY_F8 0x77
79 #define KEY_F9 0x78
80 #define KEY_F10 0x79
81 #define KEY_F11 0x7A
82 #define KEY_F12 0x7B
83 #define KEY_PRINT_SCREEN 0x2C
84 #define KEY_SCROLL_LOCK 0x91
85 #define KEY_PAUSE 0x13
86 #define KEY_INSERT 0x2D
87 #define KEY_HOME 0x24
88 #define KEY_PAGE_UP 0x21
89 #define KEY_DELETE 0x2E
90 #define KEY_END 0x23
91 #define KEY_PAGE_DOWN 0x22
92 #define KEY_RIGHT 0x27
93 #define KEY_LEFT 0x25
94 #define KEY_DOWN 0x28
95 #define KEY_UP 0x26
96 #define KEY_NUMLOCK 0x90
97 #define KEY_KP0 0x60
98 #define KEY_KP1 0x61
99 #define KEY_KP2 0x62
100 #define KEY_KP3 0x63
101 #define KEY_KP4 0x64
102 #define KEY_KP5 0x65
103 #define KEY_KP6 0x66
104 #define KEY_KP7 0x67
105 #define KEY_KP8 0x68
106 #define KEY_KP9 0x69
107 #define KEY_KPASTERISK 0x6A
108 #define KEY_KPPLUS 0x6B
109 #define KEY_KPMINUS 0x6D
110 #define KEY_KPDOT 0x6E
111 #define KEY_KPSLASH 0x6F
112 #define KEY_F13 0x7C
113 #define KEY_F14 0x7D
114 #define KEY_F15 0x7E
115 #define KEY_F16 0x7F
116 #define KEY_F17 0x80
117 #define KEY_F18 0x81
118 #define KEY_F19 0x82
119 #define KEY_F20 0x83
120 #define KEY_F21 0x84
121 #define KEY_F22 0x85
122 #define KEY_F23 0x86
123 #define KEY_F24 0x87
124 #define KEY_TILE 0xC0
125 #define KEY_SHIFT 0x10
126 #define KEY_CONTROL 0x11
127 #define KEY_ALT 0x12
128 #define KEY_LEFT_ALT 0xA4
129 #define KEY_LEFT_CONTROL 0xA2
130 #define KEY_LEFT_SHIFT 0xA0
131 #define KEY_RIGHT_ALT 0xA5
132 #define KEY_RIGHT_CONTROL 0xA3
133 #define KEY_RIGHT_SHIFT 0xA1
134 #define KEY_LEFT_WINDOWS 0x5B
135 #define KEY_RIGHT_WINDOWS 0x5C
136#elif defined(__linux__)
137 #include <linux/input-event-codes.h> // has definitions for KEY_* macros
138 #define KEY_LEFT_ARROW KEY_LEFT
139 #define KEY_RIGHT_ARROW KEY_RIGHT
140 #define KEY_UP_ARROW KEY_UP
141 #define KEY_DOWN_ARROW KEY_DOWN
142#elif defined(__APPLE__)
143 #define KEY_A 0x00
144 #define KEY_S 0x01
145 #define KEY_D 0x02
146 #define KEY_F 0x03
147 #define KEY_H 0x04
148 #define KEY_G 0x05
149 #define KEY_Z 0x06
150 #define KEY_X 0x07
151 #define KEY_C 0x08
152 #define KEY_V 0x09
153 #define KEY_B 0x0B
154 #define KEY_Q 0x0C
155 #define KEY_W 0x0D
156 #define KEY_E 0x0E
157 #define KEY_R 0x0F
158 #define KEY_Y 0x10
159 #define KEY_T 0x11
160 #define KEY_1 0x12
161 #define KEY_2 0x13
162 #define KEY_3 0x14
163 #define KEY_4 0x15
164 #define KEY_6 0x16
165 #define KEY_5 0x17
166 #define KEY_EQUAL 0x18
167 #define KEY_9 0x19
168 #define KEY_7 0x1A
169 #define KEY_MINUS 0x1B
170 #define KEY_8 0x1C
171 #define KEY_0 0x1D
172 #define KEY_RIGHT_BRACKET 0x1E
173 #define KEY_O 0x1F
174 #define KEY_U 0x20
175 #define KEY_LEFT_BRACKET 0x21
176 #define KEY_I 0x22
177 #define KEY_P 0x23
178 #define KEY_RETURN 0x24
179 #define KEY_L 0x25
180 #define KEY_J 0x26
181 #define KEY_APOSTROPHE 0x27
182 #define KEY_K 0x28
183 #define KEY_SEMICOLON 0x29
184 #define KEY_BACKSLASH 0x2A
185 #define KEY_COMMA 0x2B
186 #define KEY_SLASH 0x2C
187 #define KEY_N 0x2D
188 #define KEY_M 0x2E
189 #define KEY_PERIOD 0x2F
190 #define KEY_TAB 0x30
191 #define KEY_SPACE 0x31
192 #define KEY_TILDE 0x32
193 #define KEY_DELETE 0x33
194 #define KEY_ESCAPE 0x35
195 #define KEY_RIGHT_COMMAND 0x36
196 #define KEY_COMMAND 0x37
197 #define KEY_SHIFT 0x38
198 #define KEY_CAPSLOCK 0x39
199 #define KEY_OPTION 0x3A
200 #define KEY_CONTROL 0x3B
201 #define KEY_RIGHT_SHIFT 0x3C
202 #define KEY_RIGHT_OPTION 0x3D
203 #define KEY_RIGHT_CONTROL 0x3E
204 #define KEY_FUNCTION 0x3F
205 #define KEY_F17 0x40
206 #define KEY_KPASTERISK 0x43
207 #define KEY_VOLUMEUP 0x48
208 #define KEY_VOLUMEDOWN 0x49
209 #define KEY_MUTE 0x4A
210 #define KEY_F18 0x4F
211 #define KEY_F19 0x50
212 #define KEY_KPEQUAL 0x51
213 #define KEY_KP0 0x52
214 #define KEY_KP1 0x53
215 #define KEY_KP2 0x54
216 #define KEY_KP3 0x55
217 #define KEY_KP4 0x56
218 #define KEY_KP5 0x57
219 #define KEY_KP6 0x58
220 #define KEY_KP7 0x59
221 #define KEY_F20 0x5A
222 #define KEY_KP8 0x5B
223 #define KEY_KP9 0x5C
224 #define KEY_F5 0x60
225 #define KEY_F6 0x61
226 #define KEY_F7 0x62
227 #define KEY_F3 0x63
228 #define KEY_F8 0x64
229 #define KEY_F9 0x65
230 #define KEY_F11 0x67
231 #define KEY_F13 0x69
232 #define KEY_F16 0x6A
233 #define KEY_F14 0x6B
234 #define KEY_F10 0x6D
235 #define KEY_F12 0x6F
236 #define KEY_F15 0x71
237 #define KEY_HELP 0x72
238 #define KEY_HOME 0x73
239 #define KEY_F4 0x76
240 #define KEY_F2 0x78
241 #define KEY_F1 0x7A
242 #define KEY_LEFT_ARROW 0x7B
243 #define KEY_RIGHT_ARROW 0x7C
244 #define KEY_DOWN_ARROW 0x7D
245 #define KEY_UP_ARROW 0x7E
246#endif
247#ifdef __cplusplus
248}
249#endif