-
Notifications
You must be signed in to change notification settings - Fork 19
/
key.c
712 lines (708 loc) · 36.7 KB
/
key.c
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
#include "key.h"
#include <SDL/SDL.h>
/* Big list o' key names. These are just the SDLK_* macros with their prefix chopped off. */
static const char *key_name_backspace = "backspace";
static const char *key_name_tab = "tab";
static const char *key_name_clear = "clear";
static const char *key_name_return = "return";
static const char *key_name_pause = "pause";
static const char *key_name_escape = "escape";
static const char *key_name_space = "space";
static const char *key_name_exclaim = "exclaim";
static const char *key_name_quotedbl = "quotedbl";
static const char *key_name_hash = "hash";
static const char *key_name_dollar = "dollar";
static const char *key_name_ampersand = "ampersand";
static const char *key_name_quote = "quote";
static const char *key_name_leftparen = "leftparen";
static const char *key_name_rightparen = "rightparen";
static const char *key_name_asterisk = "asterisk";
static const char *key_name_plus = "plus";
static const char *key_name_comma = "comma";
static const char *key_name_minus = "minus";
static const char *key_name_period = "period";
static const char *key_name_slash = "slash";
static const char *key_name_0 = "0";
static const char *key_name_1 = "1";
static const char *key_name_2 = "2";
static const char *key_name_3 = "3";
static const char *key_name_4 = "4";
static const char *key_name_5 = "5";
static const char *key_name_6 = "6";
static const char *key_name_7 = "7";
static const char *key_name_8 = "8";
static const char *key_name_9 = "9";
static const char *key_name_colon = "colon";
static const char *key_name_semicolon = "semicolon";
static const char *key_name_less = "less";
static const char *key_name_equals = "equals";
static const char *key_name_greater = "greater";
static const char *key_name_question = "question";
static const char *key_name_at = "at";
static const char *key_name_leftbracket = "leftbracket";
static const char *key_name_backslash = "backslash";
static const char *key_name_rightbracket = "rightbracket";
static const char *key_name_caret = "caret";
static const char *key_name_underscore = "underscore";
static const char *key_name_backquote = "backquote";
static const char *key_name_a = "a";
static const char *key_name_b = "b";
static const char *key_name_c = "c";
static const char *key_name_d = "d";
static const char *key_name_e = "e";
static const char *key_name_f = "f";
static const char *key_name_g = "g";
static const char *key_name_h = "h";
static const char *key_name_i = "i";
static const char *key_name_j = "j";
static const char *key_name_k = "k";
static const char *key_name_l = "l";
static const char *key_name_m = "m";
static const char *key_name_n = "n";
static const char *key_name_o = "o";
static const char *key_name_p = "p";
static const char *key_name_q = "q";
static const char *key_name_r = "r";
static const char *key_name_s = "s";
static const char *key_name_t = "t";
static const char *key_name_u = "u";
static const char *key_name_v = "v";
static const char *key_name_w = "w";
static const char *key_name_x = "x";
static const char *key_name_y = "y";
static const char *key_name_z = "z";
static const char *key_name_delete = "delete";
static const char *key_name_world_0 = "world_0";
static const char *key_name_world_1 = "world_1";
static const char *key_name_world_2 = "world_2";
static const char *key_name_world_3 = "world_3";
static const char *key_name_world_4 = "world_4";
static const char *key_name_world_5 = "world_5";
static const char *key_name_world_6 = "world_6";
static const char *key_name_world_7 = "world_7";
static const char *key_name_world_8 = "world_8";
static const char *key_name_world_9 = "world_9";
static const char *key_name_world_10 = "world_10";
static const char *key_name_world_11 = "world_11";
static const char *key_name_world_12 = "world_12";
static const char *key_name_world_13 = "world_13";
static const char *key_name_world_14 = "world_14";
static const char *key_name_world_15 = "world_15";
static const char *key_name_world_16 = "world_16";
static const char *key_name_world_17 = "world_17";
static const char *key_name_world_18 = "world_18";
static const char *key_name_world_19 = "world_19";
static const char *key_name_world_20 = "world_20";
static const char *key_name_world_21 = "world_21";
static const char *key_name_world_22 = "world_22";
static const char *key_name_world_23 = "world_23";
static const char *key_name_world_24 = "world_24";
static const char *key_name_world_25 = "world_25";
static const char *key_name_world_26 = "world_26";
static const char *key_name_world_27 = "world_27";
static const char *key_name_world_28 = "world_28";
static const char *key_name_world_29 = "world_29";
static const char *key_name_world_30 = "world_30";
static const char *key_name_world_31 = "world_31";
static const char *key_name_world_32 = "world_32";
static const char *key_name_world_33 = "world_33";
static const char *key_name_world_34 = "world_34";
static const char *key_name_world_35 = "world_35";
static const char *key_name_world_36 = "world_36";
static const char *key_name_world_37 = "world_37";
static const char *key_name_world_38 = "world_38";
static const char *key_name_world_39 = "world_39";
static const char *key_name_world_40 = "world_40";
static const char *key_name_world_41 = "world_41";
static const char *key_name_world_42 = "world_42";
static const char *key_name_world_43 = "world_43";
static const char *key_name_world_44 = "world_44";
static const char *key_name_world_45 = "world_45";
static const char *key_name_world_46 = "world_46";
static const char *key_name_world_47 = "world_47";
static const char *key_name_world_48 = "world_48";
static const char *key_name_world_49 = "world_49";
static const char *key_name_world_50 = "world_50";
static const char *key_name_world_51 = "world_51";
static const char *key_name_world_52 = "world_52";
static const char *key_name_world_53 = "world_53";
static const char *key_name_world_54 = "world_54";
static const char *key_name_world_55 = "world_55";
static const char *key_name_world_56 = "world_56";
static const char *key_name_world_57 = "world_57";
static const char *key_name_world_58 = "world_58";
static const char *key_name_world_59 = "world_59";
static const char *key_name_world_60 = "world_60";
static const char *key_name_world_61 = "world_61";
static const char *key_name_world_62 = "world_62";
static const char *key_name_world_63 = "world_63";
static const char *key_name_world_64 = "world_64";
static const char *key_name_world_65 = "world_65";
static const char *key_name_world_66 = "world_66";
static const char *key_name_world_67 = "world_67";
static const char *key_name_world_68 = "world_68";
static const char *key_name_world_69 = "world_69";
static const char *key_name_world_70 = "world_70";
static const char *key_name_world_71 = "world_71";
static const char *key_name_world_72 = "world_72";
static const char *key_name_world_73 = "world_73";
static const char *key_name_world_74 = "world_74";
static const char *key_name_world_75 = "world_75";
static const char *key_name_world_76 = "world_76";
static const char *key_name_world_77 = "world_77";
static const char *key_name_world_78 = "world_78";
static const char *key_name_world_79 = "world_79";
static const char *key_name_world_80 = "world_80";
static const char *key_name_world_81 = "world_81";
static const char *key_name_world_82 = "world_82";
static const char *key_name_world_83 = "world_83";
static const char *key_name_world_84 = "world_84";
static const char *key_name_world_85 = "world_85";
static const char *key_name_world_86 = "world_86";
static const char *key_name_world_87 = "world_87";
static const char *key_name_world_88 = "world_88";
static const char *key_name_world_89 = "world_89";
static const char *key_name_world_90 = "world_90";
static const char *key_name_world_91 = "world_91";
static const char *key_name_world_92 = "world_92";
static const char *key_name_world_93 = "world_93";
static const char *key_name_world_94 = "world_94";
static const char *key_name_world_95 = "world_95";
static const char *key_name_kp0 = "kp0";
static const char *key_name_kp1 = "kp1";
static const char *key_name_kp2 = "kp2";
static const char *key_name_kp3 = "kp3";
static const char *key_name_kp4 = "kp4";
static const char *key_name_kp5 = "kp5";
static const char *key_name_kp6 = "kp6";
static const char *key_name_kp7 = "kp7";
static const char *key_name_kp8 = "kp8";
static const char *key_name_kp9 = "kp9";
static const char *key_name_kp_period = "kp_period";
static const char *key_name_kp_divide = "kp_divide";
static const char *key_name_kp_multiply = "kp_multiply";
static const char *key_name_kp_minus = "kp_minus";
static const char *key_name_kp_plus = "kp_plus";
static const char *key_name_kp_enter = "kp_enter";
static const char *key_name_kp_equals = "kp_equals";
static const char *key_name_up = "up";
static const char *key_name_down = "down";
static const char *key_name_right = "right";
static const char *key_name_left = "left";
static const char *key_name_insert = "insert";
static const char *key_name_home = "home";
static const char *key_name_end = "end";
static const char *key_name_pageup = "pageup";
static const char *key_name_pagedown = "pagedown";
static const char *key_name_f1 = "f1";
static const char *key_name_f2 = "f2";
static const char *key_name_f3 = "f3";
static const char *key_name_f4 = "f4";
static const char *key_name_f5 = "f5";
static const char *key_name_f6 = "f6";
static const char *key_name_f7 = "f7";
static const char *key_name_f8 = "f8";
static const char *key_name_f9 = "f9";
static const char *key_name_f10 = "f10";
static const char *key_name_f11 = "f11";
static const char *key_name_f12 = "f12";
static const char *key_name_f13 = "f13";
static const char *key_name_f14 = "f14";
static const char *key_name_f15 = "f15";
static const char *key_name_numlock = "numlock";
static const char *key_name_capslock = "capslock";
static const char *key_name_scrollock = "scrollock";
static const char *key_name_rshift = "rshift";
static const char *key_name_lshift = "lshift";
static const char *key_name_rctrl = "rctrl";
static const char *key_name_lctrl = "lctrl";
static const char *key_name_ralt = "ralt";
static const char *key_name_lalt = "lalt";
static const char *key_name_rmeta = "rmeta";
static const char *key_name_lmeta = "lmeta";
static const char *key_name_lsuper = "lsuper";
static const char *key_name_rsuper = "rsuper";
static const char *key_name_mode = "mode";
static const char *key_name_compose = "compose";
static const char *key_name_help = "help";
static const char *key_name_print = "print";
static const char *key_name_sysreq = "sysreq";
static const char *key_name_break = "break";
static const char *key_name_menu = "menu";
static const char *key_name_power = "power";
static const char *key_name_euro = "euro";
static const char *key_name_undo = "undo";
int key_id( char *name ) {
if( name == NULL ) {
fprintf( stderr, "Warning: Null key name\n" );
return -1;
}
if( strcasecmp( name, key_name_backspace ) == 0 )return SDLK_BACKSPACE;
else if( strcasecmp( name, key_name_tab ) == 0 )return SDLK_TAB;
else if( strcasecmp( name, key_name_clear ) == 0 )return SDLK_CLEAR;
else if( strcasecmp( name, key_name_return ) == 0 )return SDLK_RETURN;
else if( strcasecmp( name, key_name_pause ) == 0 )return SDLK_PAUSE;
else if( strcasecmp( name, key_name_escape ) == 0 )return SDLK_ESCAPE;
else if( strcasecmp( name, key_name_space ) == 0 )return SDLK_SPACE;
else if( strcasecmp( name, key_name_exclaim ) == 0 )return SDLK_EXCLAIM;
else if( strcasecmp( name, key_name_quotedbl ) == 0 )return SDLK_QUOTEDBL;
else if( strcasecmp( name, key_name_hash ) == 0 )return SDLK_HASH;
else if( strcasecmp( name, key_name_dollar ) == 0 )return SDLK_DOLLAR;
else if( strcasecmp( name, key_name_ampersand ) == 0 )return SDLK_AMPERSAND;
else if( strcasecmp( name, key_name_quote ) == 0 )return SDLK_QUOTE;
else if( strcasecmp( name, key_name_leftparen ) == 0 )return SDLK_LEFTPAREN;
else if( strcasecmp( name, key_name_rightparen ) == 0 )return SDLK_RIGHTPAREN;
else if( strcasecmp( name, key_name_asterisk ) == 0 )return SDLK_ASTERISK;
else if( strcasecmp( name, key_name_plus ) == 0 )return SDLK_PLUS;
else if( strcasecmp( name, key_name_comma ) == 0 )return SDLK_COMMA;
else if( strcasecmp( name, key_name_minus ) == 0 )return SDLK_MINUS;
else if( strcasecmp( name, key_name_period ) == 0 )return SDLK_PERIOD;
else if( strcasecmp( name, key_name_slash ) == 0 )return SDLK_SLASH;
else if( strcasecmp( name, key_name_0 ) == 0 )return SDLK_0;
else if( strcasecmp( name, key_name_1 ) == 0 )return SDLK_1;
else if( strcasecmp( name, key_name_2 ) == 0 )return SDLK_2;
else if( strcasecmp( name, key_name_3 ) == 0 )return SDLK_3;
else if( strcasecmp( name, key_name_4 ) == 0 )return SDLK_4;
else if( strcasecmp( name, key_name_5 ) == 0 )return SDLK_5;
else if( strcasecmp( name, key_name_6 ) == 0 )return SDLK_6;
else if( strcasecmp( name, key_name_7 ) == 0 )return SDLK_7;
else if( strcasecmp( name, key_name_8 ) == 0 )return SDLK_8;
else if( strcasecmp( name, key_name_9 ) == 0 )return SDLK_9;
else if( strcasecmp( name, key_name_colon ) == 0 )return SDLK_COLON;
else if( strcasecmp( name, key_name_semicolon ) == 0 )return SDLK_SEMICOLON;
else if( strcasecmp( name, key_name_less ) == 0 )return SDLK_LESS;
else if( strcasecmp( name, key_name_equals ) == 0 )return SDLK_EQUALS;
else if( strcasecmp( name, key_name_greater ) == 0 )return SDLK_GREATER;
else if( strcasecmp( name, key_name_question ) == 0 )return SDLK_QUESTION;
else if( strcasecmp( name, key_name_at ) == 0 )return SDLK_AT;
else if( strcasecmp( name, key_name_leftbracket ) == 0 )return SDLK_LEFTBRACKET;
else if( strcasecmp( name, key_name_backslash ) == 0 )return SDLK_BACKSLASH;
else if( strcasecmp( name, key_name_rightbracket ) == 0 )return SDLK_RIGHTBRACKET;
else if( strcasecmp( name, key_name_caret ) == 0 )return SDLK_CARET;
else if( strcasecmp( name, key_name_underscore ) == 0 )return SDLK_UNDERSCORE;
else if( strcasecmp( name, key_name_backquote ) == 0 )return SDLK_BACKQUOTE;
else if( strcasecmp( name, key_name_a ) == 0 )return SDLK_a;
else if( strcasecmp( name, key_name_b ) == 0 )return SDLK_b;
else if( strcasecmp( name, key_name_c ) == 0 )return SDLK_c;
else if( strcasecmp( name, key_name_d ) == 0 )return SDLK_d;
else if( strcasecmp( name, key_name_e ) == 0 )return SDLK_e;
else if( strcasecmp( name, key_name_f ) == 0 )return SDLK_f;
else if( strcasecmp( name, key_name_g ) == 0 )return SDLK_g;
else if( strcasecmp( name, key_name_h ) == 0 )return SDLK_h;
else if( strcasecmp( name, key_name_i ) == 0 )return SDLK_i;
else if( strcasecmp( name, key_name_j ) == 0 )return SDLK_j;
else if( strcasecmp( name, key_name_k ) == 0 )return SDLK_k;
else if( strcasecmp( name, key_name_l ) == 0 )return SDLK_l;
else if( strcasecmp( name, key_name_m ) == 0 )return SDLK_m;
else if( strcasecmp( name, key_name_n ) == 0 )return SDLK_n;
else if( strcasecmp( name, key_name_o ) == 0 )return SDLK_o;
else if( strcasecmp( name, key_name_p ) == 0 )return SDLK_p;
else if( strcasecmp( name, key_name_q ) == 0 )return SDLK_q;
else if( strcasecmp( name, key_name_r ) == 0 )return SDLK_r;
else if( strcasecmp( name, key_name_s ) == 0 )return SDLK_s;
else if( strcasecmp( name, key_name_t ) == 0 )return SDLK_t;
else if( strcasecmp( name, key_name_u ) == 0 )return SDLK_u;
else if( strcasecmp( name, key_name_v ) == 0 )return SDLK_v;
else if( strcasecmp( name, key_name_w ) == 0 )return SDLK_w;
else if( strcasecmp( name, key_name_x ) == 0 )return SDLK_x;
else if( strcasecmp( name, key_name_y ) == 0 )return SDLK_y;
else if( strcasecmp( name, key_name_z ) == 0 )return SDLK_z;
else if( strcasecmp( name, key_name_delete ) == 0 )return SDLK_DELETE;
else if( strcasecmp( name, key_name_world_0 ) == 0 )return SDLK_WORLD_0;
else if( strcasecmp( name, key_name_world_1 ) == 0 )return SDLK_WORLD_1;
else if( strcasecmp( name, key_name_world_2 ) == 0 )return SDLK_WORLD_2;
else if( strcasecmp( name, key_name_world_3 ) == 0 )return SDLK_WORLD_3;
else if( strcasecmp( name, key_name_world_4 ) == 0 )return SDLK_WORLD_4;
else if( strcasecmp( name, key_name_world_5 ) == 0 )return SDLK_WORLD_5;
else if( strcasecmp( name, key_name_world_6 ) == 0 )return SDLK_WORLD_6;
else if( strcasecmp( name, key_name_world_7 ) == 0 )return SDLK_WORLD_7;
else if( strcasecmp( name, key_name_world_8 ) == 0 )return SDLK_WORLD_8;
else if( strcasecmp( name, key_name_world_9 ) == 0 )return SDLK_WORLD_9;
else if( strcasecmp( name, key_name_world_10 ) == 0 )return SDLK_WORLD_10;
else if( strcasecmp( name, key_name_world_11 ) == 0 )return SDLK_WORLD_11;
else if( strcasecmp( name, key_name_world_12 ) == 0 )return SDLK_WORLD_12;
else if( strcasecmp( name, key_name_world_13 ) == 0 )return SDLK_WORLD_13;
else if( strcasecmp( name, key_name_world_14 ) == 0 )return SDLK_WORLD_14;
else if( strcasecmp( name, key_name_world_15 ) == 0 )return SDLK_WORLD_15;
else if( strcasecmp( name, key_name_world_16 ) == 0 )return SDLK_WORLD_16;
else if( strcasecmp( name, key_name_world_17 ) == 0 )return SDLK_WORLD_17;
else if( strcasecmp( name, key_name_world_18 ) == 0 )return SDLK_WORLD_18;
else if( strcasecmp( name, key_name_world_19 ) == 0 )return SDLK_WORLD_19;
else if( strcasecmp( name, key_name_world_20 ) == 0 )return SDLK_WORLD_20;
else if( strcasecmp( name, key_name_world_21 ) == 0 )return SDLK_WORLD_21;
else if( strcasecmp( name, key_name_world_22 ) == 0 )return SDLK_WORLD_22;
else if( strcasecmp( name, key_name_world_23 ) == 0 )return SDLK_WORLD_23;
else if( strcasecmp( name, key_name_world_24 ) == 0 )return SDLK_WORLD_24;
else if( strcasecmp( name, key_name_world_25 ) == 0 )return SDLK_WORLD_25;
else if( strcasecmp( name, key_name_world_26 ) == 0 )return SDLK_WORLD_26;
else if( strcasecmp( name, key_name_world_27 ) == 0 )return SDLK_WORLD_27;
else if( strcasecmp( name, key_name_world_28 ) == 0 )return SDLK_WORLD_28;
else if( strcasecmp( name, key_name_world_29 ) == 0 )return SDLK_WORLD_29;
else if( strcasecmp( name, key_name_world_30 ) == 0 )return SDLK_WORLD_30;
else if( strcasecmp( name, key_name_world_31 ) == 0 )return SDLK_WORLD_31;
else if( strcasecmp( name, key_name_world_32 ) == 0 )return SDLK_WORLD_32;
else if( strcasecmp( name, key_name_world_33 ) == 0 )return SDLK_WORLD_33;
else if( strcasecmp( name, key_name_world_34 ) == 0 )return SDLK_WORLD_34;
else if( strcasecmp( name, key_name_world_35 ) == 0 )return SDLK_WORLD_35;
else if( strcasecmp( name, key_name_world_36 ) == 0 )return SDLK_WORLD_36;
else if( strcasecmp( name, key_name_world_37 ) == 0 )return SDLK_WORLD_37;
else if( strcasecmp( name, key_name_world_38 ) == 0 )return SDLK_WORLD_38;
else if( strcasecmp( name, key_name_world_39 ) == 0 )return SDLK_WORLD_39;
else if( strcasecmp( name, key_name_world_40 ) == 0 )return SDLK_WORLD_40;
else if( strcasecmp( name, key_name_world_41 ) == 0 )return SDLK_WORLD_41;
else if( strcasecmp( name, key_name_world_42 ) == 0 )return SDLK_WORLD_42;
else if( strcasecmp( name, key_name_world_43 ) == 0 )return SDLK_WORLD_43;
else if( strcasecmp( name, key_name_world_44 ) == 0 )return SDLK_WORLD_44;
else if( strcasecmp( name, key_name_world_45 ) == 0 )return SDLK_WORLD_45;
else if( strcasecmp( name, key_name_world_46 ) == 0 )return SDLK_WORLD_46;
else if( strcasecmp( name, key_name_world_47 ) == 0 )return SDLK_WORLD_47;
else if( strcasecmp( name, key_name_world_48 ) == 0 )return SDLK_WORLD_48;
else if( strcasecmp( name, key_name_world_49 ) == 0 )return SDLK_WORLD_49;
else if( strcasecmp( name, key_name_world_50 ) == 0 )return SDLK_WORLD_50;
else if( strcasecmp( name, key_name_world_51 ) == 0 )return SDLK_WORLD_51;
else if( strcasecmp( name, key_name_world_52 ) == 0 )return SDLK_WORLD_52;
else if( strcasecmp( name, key_name_world_53 ) == 0 )return SDLK_WORLD_53;
else if( strcasecmp( name, key_name_world_54 ) == 0 )return SDLK_WORLD_54;
else if( strcasecmp( name, key_name_world_55 ) == 0 )return SDLK_WORLD_55;
else if( strcasecmp( name, key_name_world_56 ) == 0 )return SDLK_WORLD_56;
else if( strcasecmp( name, key_name_world_57 ) == 0 )return SDLK_WORLD_57;
else if( strcasecmp( name, key_name_world_58 ) == 0 )return SDLK_WORLD_58;
else if( strcasecmp( name, key_name_world_59 ) == 0 )return SDLK_WORLD_59;
else if( strcasecmp( name, key_name_world_60 ) == 0 )return SDLK_WORLD_60;
else if( strcasecmp( name, key_name_world_61 ) == 0 )return SDLK_WORLD_61;
else if( strcasecmp( name, key_name_world_62 ) == 0 )return SDLK_WORLD_62;
else if( strcasecmp( name, key_name_world_63 ) == 0 )return SDLK_WORLD_63;
else if( strcasecmp( name, key_name_world_64 ) == 0 )return SDLK_WORLD_64;
else if( strcasecmp( name, key_name_world_65 ) == 0 )return SDLK_WORLD_65;
else if( strcasecmp( name, key_name_world_66 ) == 0 )return SDLK_WORLD_66;
else if( strcasecmp( name, key_name_world_67 ) == 0 )return SDLK_WORLD_67;
else if( strcasecmp( name, key_name_world_68 ) == 0 )return SDLK_WORLD_68;
else if( strcasecmp( name, key_name_world_69 ) == 0 )return SDLK_WORLD_69;
else if( strcasecmp( name, key_name_world_70 ) == 0 )return SDLK_WORLD_70;
else if( strcasecmp( name, key_name_world_71 ) == 0 )return SDLK_WORLD_71;
else if( strcasecmp( name, key_name_world_72 ) == 0 )return SDLK_WORLD_72;
else if( strcasecmp( name, key_name_world_73 ) == 0 )return SDLK_WORLD_73;
else if( strcasecmp( name, key_name_world_74 ) == 0 )return SDLK_WORLD_74;
else if( strcasecmp( name, key_name_world_75 ) == 0 )return SDLK_WORLD_75;
else if( strcasecmp( name, key_name_world_76 ) == 0 )return SDLK_WORLD_76;
else if( strcasecmp( name, key_name_world_77 ) == 0 )return SDLK_WORLD_77;
else if( strcasecmp( name, key_name_world_78 ) == 0 )return SDLK_WORLD_78;
else if( strcasecmp( name, key_name_world_79 ) == 0 )return SDLK_WORLD_79;
else if( strcasecmp( name, key_name_world_80 ) == 0 )return SDLK_WORLD_80;
else if( strcasecmp( name, key_name_world_81 ) == 0 )return SDLK_WORLD_81;
else if( strcasecmp( name, key_name_world_82 ) == 0 )return SDLK_WORLD_82;
else if( strcasecmp( name, key_name_world_83 ) == 0 )return SDLK_WORLD_83;
else if( strcasecmp( name, key_name_world_84 ) == 0 )return SDLK_WORLD_84;
else if( strcasecmp( name, key_name_world_85 ) == 0 )return SDLK_WORLD_85;
else if( strcasecmp( name, key_name_world_86 ) == 0 )return SDLK_WORLD_86;
else if( strcasecmp( name, key_name_world_87 ) == 0 )return SDLK_WORLD_87;
else if( strcasecmp( name, key_name_world_88 ) == 0 )return SDLK_WORLD_88;
else if( strcasecmp( name, key_name_world_89 ) == 0 )return SDLK_WORLD_89;
else if( strcasecmp( name, key_name_world_90 ) == 0 )return SDLK_WORLD_90;
else if( strcasecmp( name, key_name_world_91 ) == 0 )return SDLK_WORLD_91;
else if( strcasecmp( name, key_name_world_92 ) == 0 )return SDLK_WORLD_92;
else if( strcasecmp( name, key_name_world_93 ) == 0 )return SDLK_WORLD_93;
else if( strcasecmp( name, key_name_world_94 ) == 0 )return SDLK_WORLD_94;
else if( strcasecmp( name, key_name_world_95 ) == 0 )return SDLK_WORLD_95;
else if( strcasecmp( name, key_name_kp0 ) == 0 )return SDLK_KP0;
else if( strcasecmp( name, key_name_kp1 ) == 0 )return SDLK_KP1;
else if( strcasecmp( name, key_name_kp2 ) == 0 )return SDLK_KP2;
else if( strcasecmp( name, key_name_kp3 ) == 0 )return SDLK_KP3;
else if( strcasecmp( name, key_name_kp4 ) == 0 )return SDLK_KP4;
else if( strcasecmp( name, key_name_kp5 ) == 0 )return SDLK_KP5;
else if( strcasecmp( name, key_name_kp6 ) == 0 )return SDLK_KP6;
else if( strcasecmp( name, key_name_kp7 ) == 0 )return SDLK_KP7;
else if( strcasecmp( name, key_name_kp8 ) == 0 )return SDLK_KP8;
else if( strcasecmp( name, key_name_kp9 ) == 0 )return SDLK_KP9;
else if( strcasecmp( name, key_name_kp_period ) == 0 )return SDLK_KP_PERIOD;
else if( strcasecmp( name, key_name_kp_divide ) == 0 )return SDLK_KP_DIVIDE;
else if( strcasecmp( name, key_name_kp_multiply ) == 0 )return SDLK_KP_MULTIPLY;
else if( strcasecmp( name, key_name_kp_minus ) == 0 )return SDLK_KP_MINUS;
else if( strcasecmp( name, key_name_kp_plus ) == 0 )return SDLK_KP_PLUS;
else if( strcasecmp( name, key_name_kp_enter ) == 0 )return SDLK_KP_ENTER;
else if( strcasecmp( name, key_name_kp_equals ) == 0 )return SDLK_KP_EQUALS;
else if( strcasecmp( name, key_name_up ) == 0 )return SDLK_UP;
else if( strcasecmp( name, key_name_down ) == 0 )return SDLK_DOWN;
else if( strcasecmp( name, key_name_right ) == 0 )return SDLK_RIGHT;
else if( strcasecmp( name, key_name_left ) == 0 )return SDLK_LEFT;
else if( strcasecmp( name, key_name_insert ) == 0 )return SDLK_INSERT;
else if( strcasecmp( name, key_name_home ) == 0 )return SDLK_HOME;
else if( strcasecmp( name, key_name_end ) == 0 )return SDLK_END;
else if( strcasecmp( name, key_name_pageup ) == 0 )return SDLK_PAGEUP;
else if( strcasecmp( name, key_name_pagedown ) == 0 )return SDLK_PAGEDOWN;
else if( strcasecmp( name, key_name_f1 ) == 0 )return SDLK_F1;
else if( strcasecmp( name, key_name_f2 ) == 0 )return SDLK_F2;
else if( strcasecmp( name, key_name_f3 ) == 0 )return SDLK_F3;
else if( strcasecmp( name, key_name_f4 ) == 0 )return SDLK_F4;
else if( strcasecmp( name, key_name_f5 ) == 0 )return SDLK_F5;
else if( strcasecmp( name, key_name_f6 ) == 0 )return SDLK_F6;
else if( strcasecmp( name, key_name_f7 ) == 0 )return SDLK_F7;
else if( strcasecmp( name, key_name_f8 ) == 0 )return SDLK_F8;
else if( strcasecmp( name, key_name_f9 ) == 0 )return SDLK_F9;
else if( strcasecmp( name, key_name_f10 ) == 0 )return SDLK_F10;
else if( strcasecmp( name, key_name_f11 ) == 0 )return SDLK_F11;
else if( strcasecmp( name, key_name_f12 ) == 0 )return SDLK_F12;
else if( strcasecmp( name, key_name_f13 ) == 0 )return SDLK_F13;
else if( strcasecmp( name, key_name_f14 ) == 0 )return SDLK_F14;
else if( strcasecmp( name, key_name_f15 ) == 0 )return SDLK_F15;
else if( strcasecmp( name, key_name_numlock ) == 0 )return SDLK_NUMLOCK;
else if( strcasecmp( name, key_name_capslock ) == 0 )return SDLK_CAPSLOCK;
else if( strcasecmp( name, key_name_scrollock ) == 0 )return SDLK_SCROLLOCK;
else if( strcasecmp( name, key_name_rshift ) == 0 )return SDLK_RSHIFT;
else if( strcasecmp( name, key_name_lshift ) == 0 )return SDLK_LSHIFT;
else if( strcasecmp( name, key_name_rctrl ) == 0 )return SDLK_RCTRL;
else if( strcasecmp( name, key_name_lctrl ) == 0 )return SDLK_LCTRL;
else if( strcasecmp( name, key_name_ralt ) == 0 )return SDLK_RALT;
else if( strcasecmp( name, key_name_lalt ) == 0 )return SDLK_LALT;
else if( strcasecmp( name, key_name_rmeta ) == 0 )return SDLK_RMETA;
else if( strcasecmp( name, key_name_lmeta ) == 0 )return SDLK_LMETA;
else if( strcasecmp( name, key_name_lsuper ) == 0 )return SDLK_LSUPER;
else if( strcasecmp( name, key_name_rsuper ) == 0 )return SDLK_RSUPER;
else if( strcasecmp( name, key_name_mode ) == 0 )return SDLK_MODE;
else if( strcasecmp( name, key_name_compose ) == 0 )return SDLK_COMPOSE;
else if( strcasecmp( name, key_name_help ) == 0 )return SDLK_HELP;
else if( strcasecmp( name, key_name_print ) == 0 )return SDLK_PRINT;
else if( strcasecmp( name, key_name_sysreq ) == 0 )return SDLK_SYSREQ;
else if( strcasecmp( name, key_name_break ) == 0 )return SDLK_BREAK;
else if( strcasecmp( name, key_name_menu ) == 0 )return SDLK_MENU;
else if( strcasecmp( name, key_name_power ) == 0 )return SDLK_POWER;
else if( strcasecmp( name, key_name_euro ) == 0 )return SDLK_EURO;
else if( strcasecmp( name, key_name_undo ) == 0 )return SDLK_UNDO;
return 0;
}
const char *key_name( int key ) {
switch( key ) {
case SDLK_BACKSPACE: return key_name_backspace;
case SDLK_TAB: return key_name_tab;
case SDLK_CLEAR: return key_name_clear;
case SDLK_RETURN: return key_name_return;
case SDLK_PAUSE: return key_name_pause;
case SDLK_ESCAPE: return key_name_escape;
case SDLK_SPACE: return key_name_space;
case SDLK_EXCLAIM: return key_name_exclaim;
case SDLK_QUOTEDBL: return key_name_quotedbl;
case SDLK_HASH: return key_name_hash;
case SDLK_DOLLAR: return key_name_dollar;
case SDLK_AMPERSAND: return key_name_ampersand;
case SDLK_QUOTE: return key_name_quote;
case SDLK_LEFTPAREN: return key_name_leftparen;
case SDLK_RIGHTPAREN: return key_name_rightparen;
case SDLK_ASTERISK: return key_name_asterisk;
case SDLK_PLUS: return key_name_plus;
case SDLK_COMMA: return key_name_comma;
case SDLK_MINUS: return key_name_minus;
case SDLK_PERIOD: return key_name_period;
case SDLK_SLASH: return key_name_slash;
case SDLK_0: return key_name_0;
case SDLK_1: return key_name_1;
case SDLK_2: return key_name_2;
case SDLK_3: return key_name_3;
case SDLK_4: return key_name_4;
case SDLK_5: return key_name_5;
case SDLK_6: return key_name_6;
case SDLK_7: return key_name_7;
case SDLK_8: return key_name_8;
case SDLK_9: return key_name_9;
case SDLK_COLON: return key_name_colon;
case SDLK_SEMICOLON: return key_name_semicolon;
case SDLK_LESS: return key_name_less;
case SDLK_EQUALS: return key_name_equals;
case SDLK_GREATER: return key_name_greater;
case SDLK_QUESTION: return key_name_question;
case SDLK_AT: return key_name_at;
case SDLK_LEFTBRACKET: return key_name_leftbracket;
case SDLK_BACKSLASH: return key_name_backslash;
case SDLK_RIGHTBRACKET: return key_name_rightbracket;
case SDLK_CARET: return key_name_caret;
case SDLK_UNDERSCORE: return key_name_underscore;
case SDLK_BACKQUOTE: return key_name_backquote;
case SDLK_a: return key_name_a;
case SDLK_b: return key_name_b;
case SDLK_c: return key_name_c;
case SDLK_d: return key_name_d;
case SDLK_e: return key_name_e;
case SDLK_f: return key_name_f;
case SDLK_g: return key_name_g;
case SDLK_h: return key_name_h;
case SDLK_i: return key_name_i;
case SDLK_j: return key_name_j;
case SDLK_k: return key_name_k;
case SDLK_l: return key_name_l;
case SDLK_m: return key_name_m;
case SDLK_n: return key_name_n;
case SDLK_o: return key_name_o;
case SDLK_p: return key_name_p;
case SDLK_q: return key_name_q;
case SDLK_r: return key_name_r;
case SDLK_s: return key_name_s;
case SDLK_t: return key_name_t;
case SDLK_u: return key_name_u;
case SDLK_v: return key_name_v;
case SDLK_w: return key_name_w;
case SDLK_x: return key_name_x;
case SDLK_y: return key_name_y;
case SDLK_z: return key_name_z;
case SDLK_DELETE: return key_name_delete;
case SDLK_WORLD_0: return key_name_world_0;
case SDLK_WORLD_1: return key_name_world_1;
case SDLK_WORLD_2: return key_name_world_2;
case SDLK_WORLD_3: return key_name_world_3;
case SDLK_WORLD_4: return key_name_world_4;
case SDLK_WORLD_5: return key_name_world_5;
case SDLK_WORLD_6: return key_name_world_6;
case SDLK_WORLD_7: return key_name_world_7;
case SDLK_WORLD_8: return key_name_world_8;
case SDLK_WORLD_9: return key_name_world_9;
case SDLK_WORLD_10: return key_name_world_10;
case SDLK_WORLD_11: return key_name_world_11;
case SDLK_WORLD_12: return key_name_world_12;
case SDLK_WORLD_13: return key_name_world_13;
case SDLK_WORLD_14: return key_name_world_14;
case SDLK_WORLD_15: return key_name_world_15;
case SDLK_WORLD_16: return key_name_world_16;
case SDLK_WORLD_17: return key_name_world_17;
case SDLK_WORLD_18: return key_name_world_18;
case SDLK_WORLD_19: return key_name_world_19;
case SDLK_WORLD_20: return key_name_world_20;
case SDLK_WORLD_21: return key_name_world_21;
case SDLK_WORLD_22: return key_name_world_22;
case SDLK_WORLD_23: return key_name_world_23;
case SDLK_WORLD_24: return key_name_world_24;
case SDLK_WORLD_25: return key_name_world_25;
case SDLK_WORLD_26: return key_name_world_26;
case SDLK_WORLD_27: return key_name_world_27;
case SDLK_WORLD_28: return key_name_world_28;
case SDLK_WORLD_29: return key_name_world_29;
case SDLK_WORLD_30: return key_name_world_30;
case SDLK_WORLD_31: return key_name_world_31;
case SDLK_WORLD_32: return key_name_world_32;
case SDLK_WORLD_33: return key_name_world_33;
case SDLK_WORLD_34: return key_name_world_34;
case SDLK_WORLD_35: return key_name_world_35;
case SDLK_WORLD_36: return key_name_world_36;
case SDLK_WORLD_37: return key_name_world_37;
case SDLK_WORLD_38: return key_name_world_38;
case SDLK_WORLD_39: return key_name_world_39;
case SDLK_WORLD_40: return key_name_world_40;
case SDLK_WORLD_41: return key_name_world_41;
case SDLK_WORLD_42: return key_name_world_42;
case SDLK_WORLD_43: return key_name_world_43;
case SDLK_WORLD_44: return key_name_world_44;
case SDLK_WORLD_45: return key_name_world_45;
case SDLK_WORLD_46: return key_name_world_46;
case SDLK_WORLD_47: return key_name_world_47;
case SDLK_WORLD_48: return key_name_world_48;
case SDLK_WORLD_49: return key_name_world_49;
case SDLK_WORLD_50: return key_name_world_50;
case SDLK_WORLD_51: return key_name_world_51;
case SDLK_WORLD_52: return key_name_world_52;
case SDLK_WORLD_53: return key_name_world_53;
case SDLK_WORLD_54: return key_name_world_54;
case SDLK_WORLD_55: return key_name_world_55;
case SDLK_WORLD_56: return key_name_world_56;
case SDLK_WORLD_57: return key_name_world_57;
case SDLK_WORLD_58: return key_name_world_58;
case SDLK_WORLD_59: return key_name_world_59;
case SDLK_WORLD_60: return key_name_world_60;
case SDLK_WORLD_61: return key_name_world_61;
case SDLK_WORLD_62: return key_name_world_62;
case SDLK_WORLD_63: return key_name_world_63;
case SDLK_WORLD_64: return key_name_world_64;
case SDLK_WORLD_65: return key_name_world_65;
case SDLK_WORLD_66: return key_name_world_66;
case SDLK_WORLD_67: return key_name_world_67;
case SDLK_WORLD_68: return key_name_world_68;
case SDLK_WORLD_69: return key_name_world_69;
case SDLK_WORLD_70: return key_name_world_70;
case SDLK_WORLD_71: return key_name_world_71;
case SDLK_WORLD_72: return key_name_world_72;
case SDLK_WORLD_73: return key_name_world_73;
case SDLK_WORLD_74: return key_name_world_74;
case SDLK_WORLD_75: return key_name_world_75;
case SDLK_WORLD_76: return key_name_world_76;
case SDLK_WORLD_77: return key_name_world_77;
case SDLK_WORLD_78: return key_name_world_78;
case SDLK_WORLD_79: return key_name_world_79;
case SDLK_WORLD_80: return key_name_world_80;
case SDLK_WORLD_81: return key_name_world_81;
case SDLK_WORLD_82: return key_name_world_82;
case SDLK_WORLD_83: return key_name_world_83;
case SDLK_WORLD_84: return key_name_world_84;
case SDLK_WORLD_85: return key_name_world_85;
case SDLK_WORLD_86: return key_name_world_86;
case SDLK_WORLD_87: return key_name_world_87;
case SDLK_WORLD_88: return key_name_world_88;
case SDLK_WORLD_89: return key_name_world_89;
case SDLK_WORLD_90: return key_name_world_90;
case SDLK_WORLD_91: return key_name_world_91;
case SDLK_WORLD_92: return key_name_world_92;
case SDLK_WORLD_93: return key_name_world_93;
case SDLK_WORLD_94: return key_name_world_94;
case SDLK_WORLD_95: return key_name_world_95;
case SDLK_KP0: return key_name_kp0;
case SDLK_KP1: return key_name_kp1;
case SDLK_KP2: return key_name_kp2;
case SDLK_KP3: return key_name_kp3;
case SDLK_KP4: return key_name_kp4;
case SDLK_KP5: return key_name_kp5;
case SDLK_KP6: return key_name_kp6;
case SDLK_KP7: return key_name_kp7;
case SDLK_KP8: return key_name_kp8;
case SDLK_KP9: return key_name_kp9;
case SDLK_KP_PERIOD: return key_name_kp_period;
case SDLK_KP_DIVIDE: return key_name_kp_divide;
case SDLK_KP_MULTIPLY: return key_name_kp_multiply;
case SDLK_KP_MINUS: return key_name_kp_minus;
case SDLK_KP_PLUS: return key_name_kp_plus;
case SDLK_KP_ENTER: return key_name_kp_enter;
case SDLK_KP_EQUALS: return key_name_kp_equals;
case SDLK_UP: return key_name_up;
case SDLK_DOWN: return key_name_down;
case SDLK_RIGHT: return key_name_right;
case SDLK_LEFT: return key_name_left;
case SDLK_INSERT: return key_name_insert;
case SDLK_HOME: return key_name_home;
case SDLK_END: return key_name_end;
case SDLK_PAGEUP: return key_name_pageup;
case SDLK_PAGEDOWN: return key_name_pagedown;
case SDLK_F1: return key_name_f1;
case SDLK_F2: return key_name_f2;
case SDLK_F3: return key_name_f3;
case SDLK_F4: return key_name_f4;
case SDLK_F5: return key_name_f5;
case SDLK_F6: return key_name_f6;
case SDLK_F7: return key_name_f7;
case SDLK_F8: return key_name_f8;
case SDLK_F9: return key_name_f9;
case SDLK_F10: return key_name_f10;
case SDLK_F11: return key_name_f11;
case SDLK_F12: return key_name_f12;
case SDLK_F13: return key_name_f13;
case SDLK_F14: return key_name_f14;
case SDLK_F15: return key_name_f15;
case SDLK_NUMLOCK: return key_name_numlock;
case SDLK_CAPSLOCK: return key_name_capslock;
case SDLK_SCROLLOCK: return key_name_scrollock;
case SDLK_RSHIFT: return key_name_rshift;
case SDLK_LSHIFT: return key_name_lshift;
case SDLK_RCTRL: return key_name_rctrl;
case SDLK_LCTRL: return key_name_lctrl;
case SDLK_RALT: return key_name_ralt;
case SDLK_LALT: return key_name_lalt;
case SDLK_RMETA: return key_name_rmeta;
case SDLK_LMETA: return key_name_lmeta;
case SDLK_LSUPER: return key_name_lsuper;
case SDLK_RSUPER: return key_name_rsuper;
case SDLK_MODE: return key_name_mode;
case SDLK_COMPOSE: return key_name_compose;
case SDLK_HELP: return key_name_help;
case SDLK_PRINT: return key_name_print;
case SDLK_SYSREQ: return key_name_sysreq;
case SDLK_BREAK: return key_name_break;
case SDLK_MENU: return key_name_menu;
case SDLK_POWER: return key_name_power;
case SDLK_EURO: return key_name_euro;
case SDLK_UNDO: return key_name_undo;
}
return NULL;
}