-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeyboard.js
145 lines (145 loc) · 2.74 KB
/
keyboard.js
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
exports.sdl_keysym_to_scancode = function(sym) // from halfix
{
switch (sym) {
case SDLK_0:
case SDLK_1:
case SDLK_2:
case SDLK_3:
case SDLK_4:
case SDLK_5:
case SDLK_6:
case SDLK_7:
case SDLK_8:
case SDLK_9:
var n = sym - SDLK_0;
if (!n)
n = 10;
return n + 1;
case SDLK_ESCAPE:
return 0x01;
case SDLK_EQUALS:
return 0x0D;
case SDLK_RETURN:
return 0x1C;
case SDLK_a:
return 0x1E;
case SDLK_b:
return 0x30;
case SDLK_c:
return 0x2E;
case SDLK_d:
return 0x20;
case SDLK_e:
return 0x12;
case SDLK_f:
return 0x21;
case SDLK_g:
return 0x22;
case SDLK_h:
return 0x23;
case SDLK_i:
return 0x17;
case SDLK_j:
return 0x24;
case SDLK_k:
return 0x25;
case SDLK_l:
return 0x26;
case SDLK_m:
return 0x32;
case SDLK_n:
return 0x31;
case SDLK_o:
return 0x18;
case SDLK_p:
return 0x19;
case SDLK_q:
return 0x10;
case SDLK_r:
return 0x13;
case SDLK_s:
return 0x1F;
case SDLK_t:
return 0x14;
case SDLK_u:
return 0x16;
case SDLK_v:
return 0x2F;
case SDLK_w:
return 0x11;
case SDLK_x:
return 0x2D;
case SDLK_y:
return 0x15;
case SDLK_z:
return 0x2C;
case SDLK_BACKSPACE:
return 0x0E;
case SDLK_LEFT:
return 0xE04B;
case SDLK_DOWN:
return 0xE050;
case SDLK_RIGHT:
return 0xE04D;
case SDLK_UP:
return 0xE048;
case SDLK_SPACE:
return 0x39;
case SDLK_PAGEUP:
return 0xE04F;
case SDLK_PAGEDOWN:
return 0xE051;
case SDLK_DELETE:
return 0xE053;
case SDLK_F12:
return 0x58;
case SDLK_F1:
case SDLK_F2:
case SDLK_F3:
case SDLK_F4:
case SDLK_F5:
case SDLK_F6:
case SDLK_F7:
case SDLK_F8:
case SDLK_F9:
case SDLK_F10:
case SDLK_F11:
return 0x3B + (sym - SDLK_F1);
case SDLK_SLASH:
return 0x35;
case SDLK_LALT:
return 0x38;
case SDLK_LCTRL:
return 0x1D;
case SDLK_LSHIFT:
return 0x2A;
case SDLK_RSHIFT:
return 0x36;
case SDLK_SEMICOLON:
return 0x27;
case SDLK_BACKSLASH:
return 0x2B;
case SDLK_COMMA:
return 0x33;
case SDLK_PERIOD:
return 0x34;
case SDLK_MINUS:
return 0x0C;
case SDLK_RIGHTBRACKET:
return 0x1A;
case SDLK_LEFTBRACKET:
return 0x1B;
case SDLK_QUOTE:
return 0x28;
//case SDLK_BACKQUOTE:
// return 0x29;
case SDLK_TAB:
return 0x0F;
case 311: // Left Win
return 0xE05B;
case 312: // Right Win
return 0xE05B;
default:
return 0x00;
}
}