1 /*
2 Copyright (c) 2017-2019 Timur Gafarov
3 
4 Boost Software License - Version 1.0 - August 17th, 2003
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 */
27 
28 module dagon.core.keycodes;
29 
30 import dagon.core.bindings;
31 
32 enum
33 {
34     KEY_UNKNOWN = 0,
35 
36     KEY_A = 4,
37     KEY_B = 5,
38     KEY_C = 6,
39     KEY_D = 7,
40     KEY_E = 8,
41     KEY_F = 9,
42     KEY_G = 10,
43     KEY_H = 11,
44     KEY_I = 12,
45     KEY_J = 13,
46     KEY_K = 14,
47     KEY_L = 15,
48     KEY_M = 16,
49     KEY_N = 17,
50     KEY_O = 18,
51     KEY_P = 19,
52     KEY_Q = 20,
53     KEY_R = 21,
54     KEY_S = 22,
55     KEY_T = 23,
56     KEY_U = 24,
57     KEY_V = 25,
58     KEY_W = 26,
59     KEY_X = 27,
60     KEY_Y = 28,
61     KEY_Z = 29,
62 
63     KEY_1 = 30,
64     KEY_2 = 31,
65     KEY_3 = 32,
66     KEY_4 = 33,
67     KEY_5 = 34,
68     KEY_6 = 35,
69     KEY_7 = 36,
70     KEY_8 = 37,
71     KEY_9 = 38,
72     KEY_0 = 39,
73 
74     KEY_RETURN = 40,
75     KEY_ESCAPE = 41,
76     KEY_BACKSPACE = 42,
77     KEY_TAB = 43,
78     KEY_SPACE = 44,
79 
80     KEY_MINUS = 45,
81     KEY_EQUALS = 46,
82     KEY_LEFTBRACKET = 47,
83     KEY_RIGHTBRACKET = 48,
84     KEY_BACKSLASH = 49,
85     KEY_NONUSHASH = 50,
86     KEY_SEMICOLON = 51,
87     KEY_APOSTROPHE = 52,
88     KEY_GRAVE = 53,
89     KEY_COMMA = 54,
90     KEY_PERIOD = 55,
91     KEY_SLASH = 56,
92 
93     KEY_CAPSLOCK = 57,
94 
95     KEY_F1 = 58,
96     KEY_F2 = 59,
97     KEY_F3 = 60,
98     KEY_F4 = 61,
99     KEY_F5 = 62,
100     KEY_F6 = 63,
101     KEY_F7 = 64,
102     KEY_F8 = 65,
103     KEY_F9 = 66,
104     KEY_F10 = 67,
105     KEY_F11 = 68,
106     KEY_F12 = 69,
107 
108     KEY_PRINTSCREEN = 70,
109     KEY_SCROLLLOCK = 71,
110     KEY_PAUSE = 72,
111     KEY_INSERT = 73,
112     KEY_HOME = 74,
113     KEY_PAGEUP = 75,
114     KEY_DELETE = 76,
115     KEY_END = 77,
116     KEY_PAGEDOWN = 78,
117     KEY_RIGHT = 79,
118     KEY_LEFT = 80,
119     KEY_DOWN = 81,
120     KEY_UP = 82,
121 
122     KEY_NUMLOCKCLEAR = 83,
123     KEY_KP_DIVIDE = 84,
124     KEY_KP_MULTIPLY = 85,
125     KEY_KP_MINUS = 86,
126     KEY_KP_PLUS = 87,
127     KEY_KP_ENTER = 88,
128     KEY_KP_1 = 89,
129     KEY_KP_2 = 90,
130     KEY_KP_3 = 91,
131     KEY_KP_4 = 92,
132     KEY_KP_5 = 93,
133     KEY_KP_6 = 94,
134     KEY_KP_7 = 95,
135     KEY_KP_8 = 96,
136     KEY_KP_9 = 97,
137     KEY_KP_0 = 98,
138     KEY_KP_PERIOD = 99,
139 
140     KEY_NONUSBACKSLASH = 100,
141     KEY_APPLICATION = 101,
142     KEY_POWER = 102,
143     KEY_KP_EQUALS = 103,
144     KEY_F13 = 104,
145     KEY_F14 = 105,
146     KEY_F15 = 106,
147     KEY_F16 = 107,
148     KEY_F17 = 108,
149     KEY_F18 = 109,
150     KEY_F19 = 110,
151     KEY_F20 = 111,
152     KEY_F21 = 112,
153     KEY_F22 = 113,
154     KEY_F23 = 114,
155     KEY_F24 = 115,
156     KEY_EXECUTE = 116,
157     KEY_HELP = 117,
158     KEY_MENU = 118,
159     KEY_SELECT = 119,
160     KEY_STOP = 120,
161     KEY_AGAIN = 121,
162     KEY_UNDO = 122,
163     KEY_CUT = 123,
164     KEY_COPY = 124,
165     KEY_PASTE = 125,
166     KEY_FIND = 126,
167     KEY_MUTE = 127,
168     KEY_VOLUMEUP = 128,
169     KEY_VOLUMEDOWN = 129,
170     KEY_KP_COMMA = 133,
171     KEY_KP_EQUALSAS400 = 134,
172 
173     KEY_INTERNATIONAL1 = 135,
174     KEY_INTERNATIONAL2 = 136,
175     KEY_INTERNATIONAL3 = 137,
176     KEY_INTERNATIONAL4 = 138,
177     KEY_INTERNATIONAL5 = 139,
178     KEY_INTERNATIONAL6 = 140,
179     KEY_INTERNATIONAL7 = 141,
180     KEY_INTERNATIONAL8 = 142,
181     KEY_INTERNATIONAL9 = 143,
182     KEY_LANG1 = 144,
183     KEY_LANG2 = 145,
184     KEY_LANG3 = 146,
185     KEY_LANG4 = 147,
186     KEY_LANG5 = 148,
187     KEY_LANG6 = 149,
188     KEY_LANG7 = 150,
189     KEY_LANG8 = 151,
190     KEY_LANG9 = 152,
191 
192     KEY_ALTERASE = 153,
193     KEY_SYSREQ = 154,
194     KEY_CANCEL = 155,
195     KEY_CLEAR = 156,
196     KEY_PRIOR = 157,
197     KEY_RETURN2 = 158,
198     KEY_SEPARATOR = 159,
199     KEY_OUT = 160,
200     KEY_OPER = 161,
201     KEY_CLEARAGAIN = 162,
202     KEY_CRSEL = 163,
203     KEY_EXSEL = 164,
204 
205     KEY_KP_00 = 176,
206     KEY_KP_000 = 177,
207     KEY_THOUSANDSSEPARATOR = 178,
208     KEY_DECIMALSEPARATOR = 179,
209     KEY_CURRENCYUNIT = 180,
210     KEY_CURRENCYSUBUNIT = 181,
211     KEY_KP_LEFTPAREN = 182,
212     KEY_KP_RIGHTPAREN = 183,
213     KEY_KP_LEFTBRACE = 184,
214     KEY_KP_RIGHTBRACE = 185,
215     KEY_KP_TAB = 186,
216     KEY_KP_BACKSPACE = 187,
217     KEY_KP_A = 188,
218     KEY_KP_B = 189,
219     KEY_KP_C = 190,
220     KEY_KP_D = 191,
221     KEY_KP_E = 192,
222     KEY_KP_F = 193,
223     KEY_KP_XOR = 194,
224     KEY_KP_POWER = 195,
225     KEY_KP_PERCENT = 196,
226     KEY_KP_LESS = 197,
227     KEY_KP_GREATER = 198,
228     KEY_KP_AMPERSAND = 199,
229     KEY_KP_DBLAMPERSAND = 200,
230     KEY_KP_VERTICALBAR = 201,
231     KEY_KP_DBLVERTICALBAR = 202,
232     KEY_KP_COLON = 203,
233     KEY_KP_HASH = 204,
234     KEY_KP_SPACE = 205,
235     KEY_KP_AT = 206,
236     KEY_KP_EXCLAM = 207,
237     KEY_KP_MEMSTORE = 208,
238     KEY_KP_MEMRECALL = 209,
239     KEY_KP_MEMCLEAR = 210,
240     KEY_KP_MEMADD = 211,
241     KEY_KP_MEMSUBTRACT = 212,
242     KEY_KP_MEMMULTIPLY = 213,
243     KEY_KP_MEMDIVIDE = 214,
244     KEY_KP_PLUSMINUS = 215,
245     KEY_KP_CLEAR = 216,
246     KEY_KP_CLEARENTRY = 217,
247     KEY_KP_BINARY = 218,
248     KEY_KP_OCTAL = 219,
249     KEY_KP_DECIMAL = 220,
250     KEY_KP_HEXADECIMAL = 221,
251 
252     KEY_LCTRL = 224,
253     KEY_LSHIFT = 225,
254     KEY_LALT = 226,
255     KEY_LGUI = 227,
256     KEY_RCTRL = 228,
257     KEY_RSHIFT = 229,
258     KEY_RALT = 230,
259     KEY_RGUI = 231,
260 
261     KEY_MODE = 257,
262 
263     KEY_AUDIONEXT = 258,
264     KEY_AUDIOPREV = 259,
265     KEY_AUDIOSTOP = 260,
266     KEY_AUDIOPLAY = 261,
267     KEY_AUDIOMUTE = 262,
268     KEY_MEDIASELECT = 263,
269     KEY_WWW = 264,
270     KEY_MAIL = 265,
271     KEY_CALCULATOR = 266,
272     KEY_COMPUTER = 267,
273     KEY_AC_SEARCH = 268,
274     KEY_AC_HOME = 269,
275     KEY_AC_BACK = 270,
276     KEY_AC_FORWARD = 271,
277     KEY_AC_STOP = 272,
278     KEY_AC_REFRESH = 273,
279     KEY_AC_BOOKMARKS = 274,
280 
281     KEY_BRIGHTNESSDOWN = 275,
282     KEY_BRIGHTNESSUP = 276,
283     KEY_DISPLAYSWITCH = 277,
284     KEY_KBDILLUMTOGGLE = 278,
285     KEY_KBDILLUMDOWN = 279,
286     KEY_KBDILLUMUP = 280,
287     KEY_EJECT = 281,
288     KEY_SLEEP = 282,
289 
290     KEY_APP1 = 283,
291     KEY_APP2 = 284,
292 
293     NUM_KEYCODES = 512
294 }
295 
296 enum: ubyte
297 {
298     MB_LEFT = 1,
299     MB_MIDDLE = 2,
300     MB_RIGHT = 3,
301     MB_X1 = 4,
302     MB_X2 = 5,
303     MB_LMASK = SDL_BUTTON!MB_LEFT,
304     MB_MMASK = SDL_BUTTON!MB_MIDDLE,
305     MB_RMASK = SDL_BUTTON!MB_RIGHT,
306     MB_X1MASK = SDL_BUTTON!MB_X1,
307     MB_X2MASK = SDL_BUTTON!MB_X2,
308 }