-
Notifications
You must be signed in to change notification settings - Fork 1
/
glfw_constants.py
290 lines (286 loc) · 6.3 KB
/
glfw_constants.py
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
GLFW_KEY_SPACE = 32
GLFW_KEY_APOSTROPHE = 39 # '
GLFW_KEY_COMMA = 44 # ,
GLFW_KEY_MINUS = 45 # -
GLFW_KEY_PERIOD = 46 # .
GLFW_KEY_SLASH = 47 # /
GLFW_KEY_0 = 48
GLFW_KEY_1 = 49
GLFW_KEY_2 = 50
GLFW_KEY_3 = 51
GLFW_KEY_4 = 52
GLFW_KEY_5 = 53
GLFW_KEY_6 = 54
GLFW_KEY_7 = 55
GLFW_KEY_8 = 56
GLFW_KEY_9 = 57
GLFW_KEY_SEMICOLON = 59 # ;
GLFW_KEY_EQUAL = 61 # =
GLFW_KEY_A = 65
GLFW_KEY_B = 66
GLFW_KEY_C = 67
GLFW_KEY_D = 68
GLFW_KEY_E = 69
GLFW_KEY_F = 70
GLFW_KEY_G = 71
GLFW_KEY_H = 72
GLFW_KEY_I = 73
GLFW_KEY_J = 74
GLFW_KEY_K = 75
GLFW_KEY_L = 76
GLFW_KEY_M = 77
GLFW_KEY_N = 78
GLFW_KEY_O = 79
GLFW_KEY_P = 80
GLFW_KEY_Q = 81
GLFW_KEY_R = 82
GLFW_KEY_S = 83
GLFW_KEY_T = 84
GLFW_KEY_U = 85
GLFW_KEY_V = 86
GLFW_KEY_W = 87
GLFW_KEY_X = 88
GLFW_KEY_Y = 89
GLFW_KEY_Z = 90
GLFW_KEY_LEFT_BRACKET = 91 # [
GLFW_KEY_BACKSLASH = 92 # \
GLFW_KEY_RIGHT_BRACKET = 93 # ]
GLFW_KEY_GRAVE_ACCENT = 96 # `
GLFW_KEY_WORLD_1 = 161 # non-US #1
GLFW_KEY_WORLD_2 = 162 # non-US #2
GLFW_KEY_ESCAPE = 256
GLFW_KEY_ENTER = 257
GLFW_KEY_TAB = 258
GLFW_KEY_BACKSPACE = 259
GLFW_KEY_INSERT = 260
GLFW_KEY_DELETE = 261
GLFW_KEY_RIGHT = 262
GLFW_KEY_LEFT = 263
GLFW_KEY_DOWN = 264
GLFW_KEY_UP = 265
GLFW_KEY_PAGE_UP = 266
GLFW_KEY_PAGE_DOWN = 267
GLFW_KEY_HOME = 268
GLFW_KEY_END = 269
GLFW_KEY_CAPS_LOCK = 280
GLFW_KEY_SCROLL_LOCK = 281
GLFW_KEY_NUM_LOCK = 282
GLFW_KEY_PRINT_SCREEN = 283
GLFW_KEY_PAUSE = 284
GLFW_KEY_F1 = 290
GLFW_KEY_F2 = 291
GLFW_KEY_F3 = 292
GLFW_KEY_F4 = 293
GLFW_KEY_F5 = 294
GLFW_KEY_F6 = 295
GLFW_KEY_F7 = 296
GLFW_KEY_F8 = 297
GLFW_KEY_F9 = 298
GLFW_KEY_F10 = 299
GLFW_KEY_F11 = 300
GLFW_KEY_F12 = 301
GLFW_KEY_F13 = 302
GLFW_KEY_F14 = 303
GLFW_KEY_F15 = 304
GLFW_KEY_F16 = 305
GLFW_KEY_F17 = 306
GLFW_KEY_F18 = 307
GLFW_KEY_F19 = 308
GLFW_KEY_F20 = 309
GLFW_KEY_F21 = 310
GLFW_KEY_F22 = 311
GLFW_KEY_F23 = 312
GLFW_KEY_F24 = 313
GLFW_KEY_F25 = 314
GLFW_KEY_KP_0 = 320
GLFW_KEY_KP_1 = 321
GLFW_KEY_KP_2 = 322
GLFW_KEY_KP_3 = 323
GLFW_KEY_KP_4 = 324
GLFW_KEY_KP_5 = 325
GLFW_KEY_KP_6 = 326
GLFW_KEY_KP_7 = 327
GLFW_KEY_KP_8 = 328
GLFW_KEY_KP_9 = 329
GLFW_KEY_KP_DECIMAL = 330
GLFW_KEY_KP_DIVIDE = 331
GLFW_KEY_KP_MULTIPLY = 332
GLFW_KEY_KP_SUBTRACT = 333
GLFW_KEY_KP_ADD = 334
GLFW_KEY_KP_ENTER = 335
GLFW_KEY_KP_EQUAL = 336
GLFW_KEY_LEFT_SHIFT = 340
GLFW_KEY_LEFT_CONTROL = 341
GLFW_KEY_LEFT_ALT = 342
GLFW_KEY_LEFT_SUPER = 343
GLFW_KEY_RIGHT_SHIFT = 344
GLFW_KEY_RIGHT_CONTROL = 345
GLFW_KEY_RIGHT_ALT = 346
GLFW_KEY_RIGHT_SUPER = 347
GLFW_KEY_MENU = 348
GLFW_KEY_LAST = GLFW_KEY_MENU
NON_DRAWABLE_KEYS = {
GLFW_KEY_WORLD_1,
GLFW_KEY_WORLD_2,
GLFW_KEY_ESCAPE,
GLFW_KEY_ENTER,
GLFW_KEY_TAB,
GLFW_KEY_BACKSPACE,
GLFW_KEY_INSERT,
GLFW_KEY_DELETE,
GLFW_KEY_RIGHT,
GLFW_KEY_LEFT,
GLFW_KEY_DOWN,
GLFW_KEY_UP,
GLFW_KEY_PAGE_UP,
GLFW_KEY_PAGE_DOWN,
GLFW_KEY_HOME,
GLFW_KEY_END,
GLFW_KEY_CAPS_LOCK,
GLFW_KEY_SCROLL_LOCK,
GLFW_KEY_NUM_LOCK,
GLFW_KEY_PRINT_SCREEN,
GLFW_KEY_PAUSE,
GLFW_KEY_F1,
GLFW_KEY_F2,
GLFW_KEY_F3,
GLFW_KEY_F4,
GLFW_KEY_F5,
GLFW_KEY_F6,
GLFW_KEY_F7,
GLFW_KEY_F8,
GLFW_KEY_F9,
GLFW_KEY_F10,
GLFW_KEY_F11,
GLFW_KEY_F12,
GLFW_KEY_F13,
GLFW_KEY_F14,
GLFW_KEY_F15,
GLFW_KEY_F16,
GLFW_KEY_F17,
GLFW_KEY_F18,
GLFW_KEY_F19,
GLFW_KEY_F20,
GLFW_KEY_F21,
GLFW_KEY_F22,
GLFW_KEY_F23,
GLFW_KEY_F24,
GLFW_KEY_F25,
GLFW_KEY_KP_0,
GLFW_KEY_KP_1,
GLFW_KEY_KP_2,
GLFW_KEY_KP_3,
GLFW_KEY_KP_4,
GLFW_KEY_KP_5,
GLFW_KEY_KP_6,
GLFW_KEY_KP_7,
GLFW_KEY_KP_8,
GLFW_KEY_KP_9,
GLFW_KEY_LEFT_SHIFT,
GLFW_KEY_LEFT_CONTROL,
GLFW_KEY_LEFT_ALT,
GLFW_KEY_LEFT_SUPER,
GLFW_KEY_RIGHT_SHIFT,
GLFW_KEY_RIGHT_CONTROL,
GLFW_KEY_RIGHT_ALT,
GLFW_KEY_RIGHT_SUPER,
GLFW_KEY_MENU,
}
SHIFT_PRESSED = True
SHIFT_NOT_PRESSED = False
GLFW_TO_GLYPH_NAME = {
SHIFT_NOT_PRESSED: {
GLFW_KEY_SPACE: "space",
GLFW_KEY_APOSTROPHE: "quotesingle",
GLFW_KEY_COMMA: "comma",
GLFW_KEY_MINUS: "minus",
GLFW_KEY_PERIOD: "period",
GLFW_KEY_SLASH: "slash",
GLFW_KEY_EQUAL: "equal",
GLFW_KEY_LEFT_BRACKET: "bracketleft",
GLFW_KEY_BACKSLASH: "backslash",
GLFW_KEY_RIGHT_BRACKET: "bracketright",
GLFW_KEY_GRAVE_ACCENT: "grave",
GLFW_KEY_0: "zero",
GLFW_KEY_1: "one",
GLFW_KEY_2: "two",
GLFW_KEY_3: "three",
GLFW_KEY_4: "four",
GLFW_KEY_5: "five",
GLFW_KEY_6: "six",
GLFW_KEY_7: "seven",
GLFW_KEY_8: "eight",
GLFW_KEY_9: "nine",
GLFW_KEY_SEMICOLON: "semicolon", # TODO: not rendered properly
},
SHIFT_PRESSED: {
GLFW_KEY_SPACE: "space",
GLFW_KEY_APOSTROPHE: "quotedbl",
GLFW_KEY_COMMA: "less",
GLFW_KEY_MINUS: "underscore",
GLFW_KEY_PERIOD: "greater",
GLFW_KEY_SLASH: "question",
GLFW_KEY_EQUAL: "plus",
GLFW_KEY_LEFT_BRACKET: "braceleft",
GLFW_KEY_BACKSLASH: "backslash",
GLFW_KEY_RIGHT_BRACKET: "braceright",
GLFW_KEY_GRAVE_ACCENT: "tilde",
GLFW_KEY_0: "parenright",
GLFW_KEY_1: "exclam",
GLFW_KEY_2: "at",
GLFW_KEY_3: "numbersign",
GLFW_KEY_4: "dollar",
GLFW_KEY_5: "percent",
GLFW_KEY_6: "circumflex",
GLFW_KEY_7: "ampersand",
GLFW_KEY_8: "asterisk",
GLFW_KEY_9: "parenleft",
GLFW_KEY_SEMICOLON: "colon",
},
}
CHAR_TO_GLYPH_NAME = {
' ': "space",
'\'': "quotesingle",
',': "comma",
'-': "minus",
'.': "period",
'/': "slash",
'=': "equal",
'[': "bracketleft",
'\\': "backslash",
']': "bracketright",
'`': "grave",
'0': "zero",
'1': "one",
'2': "two",
'3': "three",
'4': "four",
'5': "five",
'6': "six",
'7': "seven",
'8': "eight",
'9': "nine",
';': "semicolon", # TODO: not rendered properly
' ': "space",
'"': "quotedbl",
'<': "less",
'_': "underscore",
'>': "greater",
'?': "question",
'+': "plus",
'{': "braceleft",
'\\': "backslash", # TODO: should be a pipe!
'}': "braceright",
'~': "tilde",
')': "parenright",
'!': "exclam",
'@': "at",
'#': "numbersign",
'$': "dollar",
'%': "percent",
'^': "circumflex",
'&': "ampersand",
'*': "asterisk",
'(': "parenleft",
':': "colon",
}