]> git.xonotic.org Git - xonotic/darkplaces.git/blob - keys.h
fix detection of multisampling for ATC
[xonotic/darkplaces.git] / keys.h
1 /*
2         $RCSfile$
3
4         Copyright (C) 1996-1997  Id Software, Inc.
5
6         This program is free software; you can redistribute it and/or
7         modify it under the terms of the GNU General Public License
8         as published by the Free Software Foundation; either version 2
9         of the License, or (at your option) any later version.
10
11         This program is distributed in the hope that it will be useful,
12         but WITHOUT ANY WARRANTY; without even the implied warranty of
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15         See the GNU General Public License for more details.
16
17         You should have received a copy of the GNU General Public License
18         along with this program; if not, write to:
19
20                 Free Software Foundation, Inc.
21                 59 Temple Place - Suite 330
22                 Boston, MA  02111-1307, USA
23
24         $Id$
25 */
26
27 #ifndef __KEYS_H
28 #define __KEYS_H
29
30 #include "qtypes.h"
31
32 //
33 // these are the key numbers that should be passed to Key_Event
34 //
35 typedef enum keynum_e
36 {
37         K_TEXT                  = 1, // used only for unicode character input
38         K_TAB                   = 9,
39         K_ENTER                 = 13,
40         K_ESCAPE                = 27,
41         K_SPACE                 = 32,
42
43         // normal keys should be passed as lowercased ascii
44
45         K_BACKSPACE             = 127,
46         K_UPARROW,
47         K_DOWNARROW,
48         K_LEFTARROW,
49         K_RIGHTARROW,
50
51         K_ALT,
52         K_CTRL,
53         K_SHIFT,
54
55         K_F1,
56         K_F2,
57         K_F3,
58         K_F4,
59         K_F5,
60         K_F6,
61         K_F7,
62         K_F8,
63         K_F9,
64         K_F10,
65         K_F11,
66         K_F12,
67
68         K_INS,
69         K_DEL,
70         K_PGDN,
71         K_PGUP,
72         K_HOME,
73         K_END,
74
75         K_PAUSE,
76
77         K_NUMLOCK,
78         K_CAPSLOCK,
79         K_SCROLLOCK,
80
81         K_KP_0,
82         K_KP_INS = K_KP_0,
83         K_KP_1,
84         K_KP_END = K_KP_1,
85         K_KP_2,
86         K_KP_DOWNARROW = K_KP_2,
87         K_KP_3,
88         K_KP_PGDN = K_KP_3,
89         K_KP_4,
90         K_KP_LEFTARROW = K_KP_4,
91         K_KP_5,
92         K_KP_6,
93         K_KP_RIGHTARROW = K_KP_6,
94         K_KP_7,
95         K_KP_HOME = K_KP_7,
96         K_KP_8,
97         K_KP_UPARROW = K_KP_8,
98         K_KP_9,
99         K_KP_PGUP = K_KP_9,
100         K_KP_PERIOD,
101         K_KP_DEL = K_KP_PERIOD,
102         K_KP_DIVIDE,
103         K_KP_SLASH = K_KP_DIVIDE,
104         K_KP_MULTIPLY,
105         K_KP_MINUS,
106         K_KP_PLUS,
107         K_KP_ENTER,
108         K_KP_EQUALS,
109
110         K_PRINTSCREEN,
111
112         // mouse buttons generate virtual keys
113
114         K_MOUSE1 = 512,
115         K_OTHERDEVICESBEGIN = K_MOUSE1,
116         K_MOUSE2,
117         K_MOUSE3,
118         K_MWHEELUP,
119         K_MWHEELDOWN,
120         K_MOUSE4,
121         K_MOUSE5,
122         K_MOUSE6,
123         K_MOUSE7,
124         K_MOUSE8,
125         K_MOUSE9,
126         K_MOUSE10,
127         K_MOUSE11,
128         K_MOUSE12,
129         K_MOUSE13,
130         K_MOUSE14,
131         K_MOUSE15,
132         K_MOUSE16,
133
134 //
135 // joystick buttons
136 //
137         K_JOY1 = 768,
138         K_JOY2,
139         K_JOY3,
140         K_JOY4,
141         K_JOY5,
142         K_JOY6,
143         K_JOY7,
144         K_JOY8,
145         K_JOY9,
146         K_JOY10,
147         K_JOY11,
148         K_JOY12,
149         K_JOY13,
150         K_JOY14,
151         K_JOY15,
152         K_JOY16,
153
154 //
155 // aux keys are for multi-buttoned joysticks to generate so they can use
156 // the normal binding process
157 //
158         K_AUX1,
159         K_AUX2,
160         K_AUX3,
161         K_AUX4,
162         K_AUX5,
163         K_AUX6,
164         K_AUX7,
165         K_AUX8,
166         K_AUX9,
167         K_AUX10,
168         K_AUX11,
169         K_AUX12,
170         K_AUX13,
171         K_AUX14,
172         K_AUX15,
173         K_AUX16,
174         K_AUX17,
175         K_AUX18,
176         K_AUX19,
177         K_AUX20,
178         K_AUX21,
179         K_AUX22,
180         K_AUX23,
181         K_AUX24,
182         K_AUX25,
183         K_AUX26,
184         K_AUX27,
185         K_AUX28,
186         K_AUX29,
187         K_AUX30,
188         K_AUX31,
189         K_AUX32,
190
191         // Microsoft Xbox 360 Controller For Windows
192         K_X360_DPAD_UP,
193         K_X360_DPAD_DOWN,
194         K_X360_DPAD_LEFT,
195         K_X360_DPAD_RIGHT,
196         K_X360_START,
197         K_X360_BACK,
198         K_X360_LEFT_THUMB,
199         K_X360_RIGHT_THUMB,
200         K_X360_LEFT_SHOULDER,
201         K_X360_RIGHT_SHOULDER,
202         K_X360_A,
203         K_X360_B,
204         K_X360_X,
205         K_X360_Y,
206         K_X360_LEFT_TRIGGER,
207         K_X360_RIGHT_TRIGGER,
208         K_X360_LEFT_THUMB_UP,
209         K_X360_LEFT_THUMB_DOWN,
210         K_X360_LEFT_THUMB_LEFT,
211         K_X360_LEFT_THUMB_RIGHT,
212         K_X360_RIGHT_THUMB_UP,
213         K_X360_RIGHT_THUMB_DOWN,
214         K_X360_RIGHT_THUMB_LEFT,
215         K_X360_RIGHT_THUMB_RIGHT,
216
217         // generic joystick emulation for menu
218         K_JOY_UP,
219         K_JOY_DOWN,
220         K_JOY_LEFT,
221         K_JOY_RIGHT,
222
223         K_MIDINOTE0 = 896, // to this, the note number is added
224         K_MIDINOTE1,
225         K_MIDINOTE2,
226         K_MIDINOTE3,
227         K_MIDINOTE4,
228         K_MIDINOTE5,
229         K_MIDINOTE6,
230         K_MIDINOTE7,
231         K_MIDINOTE8,
232         K_MIDINOTE9,
233         K_MIDINOTE10,
234         K_MIDINOTE11,
235         K_MIDINOTE12,
236         K_MIDINOTE13,
237         K_MIDINOTE14,
238         K_MIDINOTE15,
239         K_MIDINOTE16,
240         K_MIDINOTE17,
241         K_MIDINOTE18,
242         K_MIDINOTE19,
243         K_MIDINOTE20,
244         K_MIDINOTE21,
245         K_MIDINOTE22,
246         K_MIDINOTE23,
247         K_MIDINOTE24,
248         K_MIDINOTE25,
249         K_MIDINOTE26,
250         K_MIDINOTE27,
251         K_MIDINOTE28,
252         K_MIDINOTE29,
253         K_MIDINOTE30,
254         K_MIDINOTE31,
255         K_MIDINOTE32,
256         K_MIDINOTE33,
257         K_MIDINOTE34,
258         K_MIDINOTE35,
259         K_MIDINOTE36,
260         K_MIDINOTE37,
261         K_MIDINOTE38,
262         K_MIDINOTE39,
263         K_MIDINOTE40,
264         K_MIDINOTE41,
265         K_MIDINOTE42,
266         K_MIDINOTE43,
267         K_MIDINOTE44,
268         K_MIDINOTE45,
269         K_MIDINOTE46,
270         K_MIDINOTE47,
271         K_MIDINOTE48,
272         K_MIDINOTE49,
273         K_MIDINOTE50,
274         K_MIDINOTE51,
275         K_MIDINOTE52,
276         K_MIDINOTE53,
277         K_MIDINOTE54,
278         K_MIDINOTE55,
279         K_MIDINOTE56,
280         K_MIDINOTE57,
281         K_MIDINOTE58,
282         K_MIDINOTE59,
283         K_MIDINOTE60,
284         K_MIDINOTE61,
285         K_MIDINOTE62,
286         K_MIDINOTE63,
287         K_MIDINOTE64,
288         K_MIDINOTE65,
289         K_MIDINOTE66,
290         K_MIDINOTE67,
291         K_MIDINOTE68,
292         K_MIDINOTE69,
293         K_MIDINOTE70,
294         K_MIDINOTE71,
295         K_MIDINOTE72,
296         K_MIDINOTE73,
297         K_MIDINOTE74,
298         K_MIDINOTE75,
299         K_MIDINOTE76,
300         K_MIDINOTE77,
301         K_MIDINOTE78,
302         K_MIDINOTE79,
303         K_MIDINOTE80,
304         K_MIDINOTE81,
305         K_MIDINOTE82,
306         K_MIDINOTE83,
307         K_MIDINOTE84,
308         K_MIDINOTE85,
309         K_MIDINOTE86,
310         K_MIDINOTE87,
311         K_MIDINOTE88,
312         K_MIDINOTE89,
313         K_MIDINOTE90,
314         K_MIDINOTE91,
315         K_MIDINOTE92,
316         K_MIDINOTE93,
317         K_MIDINOTE94,
318         K_MIDINOTE95,
319         K_MIDINOTE96,
320         K_MIDINOTE97,
321         K_MIDINOTE98,
322         K_MIDINOTE99,
323         K_MIDINOTE100,
324         K_MIDINOTE101,
325         K_MIDINOTE102,
326         K_MIDINOTE103,
327         K_MIDINOTE104,
328         K_MIDINOTE105,
329         K_MIDINOTE106,
330         K_MIDINOTE107,
331         K_MIDINOTE108,
332         K_MIDINOTE109,
333         K_MIDINOTE110,
334         K_MIDINOTE111,
335         K_MIDINOTE112,
336         K_MIDINOTE113,
337         K_MIDINOTE114,
338         K_MIDINOTE115,
339         K_MIDINOTE116,
340         K_MIDINOTE117,
341         K_MIDINOTE118,
342         K_MIDINOTE119,
343         K_MIDINOTE120,
344         K_MIDINOTE121,
345         K_MIDINOTE122,
346         K_MIDINOTE123,
347         K_MIDINOTE124,
348         K_MIDINOTE125,
349         K_MIDINOTE126,
350         K_MIDINOTE127,
351
352         MAX_KEYS
353 }
354 keynum_t;
355
356 typedef enum keydest_e { key_game, key_message, key_menu, key_menu_grabbed, key_console, key_void } keydest_t;
357
358 extern  char            key_line[MAX_INPUTLINE];
359 extern  int                     key_linepos;
360 extern  qboolean        key_insert;     // insert key toggle (for editing)
361 extern  keydest_t       key_dest;
362 // key_consoleactive bits
363 // user wants console (halfscreen)
364 #define KEY_CONSOLEACTIVE_USER 1
365 // console forced because there's nothing else active (fullscreen)
366 #define KEY_CONSOLEACTIVE_FORCED 4
367 extern  int                     key_consoleactive;
368 extern  char            *keybindings[MAX_BINDMAPS][MAX_KEYS];
369
370 extern void Key_ClearEditLine(int edit_line);
371 extern int chat_mode; // 0 for say, 1 for say_team, -1 for command
372 extern char chat_buffer[MAX_INPUTLINE];
373 extern unsigned int chat_bufferlen;
374
375 void Key_WriteBindings(qfile_t *f);
376 void Key_Init(void);
377 void Key_Shutdown(void);
378 void Key_Init_Cvars(void);
379 void Key_Event(int key, int ascii, qboolean down);
380 void Key_ClearStates (void);
381 void Key_EventQueue_Block(void);
382 void Key_EventQueue_Unblock(void);
383
384 qboolean Key_SetBinding (int keynum, int bindmap, const char *binding);
385 const char *Key_GetBind (int key, int bindmap);
386 void Key_FindKeysForCommand (const char *command, int *keys, int numkeys, int bindmap);
387 qboolean Key_SetBindMap(int fg, int bg);
388 void Key_GetBindMap(int *fg, int *bg);
389
390 #endif // __KEYS_H
391