1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 
19 */
20 
21 //
22 // these are the key numbers that should be passed to Key_Event
23 //
24 enum QKEYS {
25 	K_TAB			= 9,
26 	K_ENTER			= 13,
27 	K_ESCAPE		= 27,
28 	K_SPACE			= 32,
29 
30 // normal keys should be passed as lowercased ascii
31 
32 	K_BACKSPACE		= 127,
33 	K_UPARROW		= 128,
34 	K_DOWNARROW		= 129,
35 	K_LEFTARROW		= 130,
36 	K_RIGHTARROW		= 131,
37 
38 	K_ALT			= 132,
39 	K_CTRL			= 133,
40 	K_SHIFT			= 134,
41 	K_F1			= 135,
42 	K_F2			= 136,
43 	K_F3			= 137,
44 	K_F4			= 138,
45 	K_F5			= 139,
46 	K_F6			= 140,
47 	K_F7			= 141,
48 	K_F8			= 142,
49 	K_F9			= 143,
50 	K_F10			= 144,
51 	K_F11			= 145,
52 	K_F12			= 146,
53 	K_INS			= 147,
54 	K_DEL			= 148,
55 	K_PGDN			= 149,
56 	K_PGUP			= 150,
57 	K_HOME			= 151,
58 	K_END			= 152,
59 
60 	K_KP_HOME		= 160,
61 	K_KP_UPARROW		= 161,
62 	K_KP_PGUP		= 162,
63 	K_KP_LEFTARROW		= 163,
64 	K_KP_5			= 164,
65 	K_KP_RIGHTARROW		= 165,
66 	K_KP_END		= 166,
67 	K_KP_DOWNARROW		= 167,
68 	K_KP_PGDN		= 168,
69 	K_KP_ENTER		= 169,
70 	K_KP_INS		= 170,
71 	K_KP_DEL		= 171,
72 	K_KP_SLASH		= 172,
73 	K_KP_MINUS		= 173,
74 	K_KP_PLUS		= 174,
75 
76 //
77 // mouse buttons generate virtual keys
78 //
79 	K_MOUSE1		= 200,
80 	K_MOUSE2		= 201,
81 	K_MOUSE3		= 202,
82 	K_MOUSE4		= 241,
83 	K_MOUSE5		= 242,
84 
85 //
86 // joystick buttons
87 //
88 	K_JOY1			= 203,
89 	K_JOY2			= 204,
90 	K_JOY3			= 205,
91 	K_JOY4			= 206,
92 
93 //
94 // aux keys are for multi-buttoned joysticks to generate so they can use
95 // the normal binding process
96 //
97 	K_AUX1			= 207,
98 	K_AUX2			= 208,
99 	K_AUX3			= 209,
100 	K_AUX4			= 210,
101 	K_AUX5			= 211,
102 	K_AUX6			= 212,
103 	K_AUX7			= 213,
104 	K_AUX8			= 214,
105 	K_AUX9			= 215,
106 	K_AUX10			= 216,
107 	K_AUX11			= 217,
108 	K_AUX12			= 218,
109 	K_AUX13			= 219,
110 	K_AUX14			= 220,
111 	K_AUX15			= 221,
112 	K_AUX16			= 222,
113 	K_AUX17			= 223,
114 	K_AUX18			= 224,
115 	K_AUX19			= 225,
116 	K_AUX20			= 226,
117 	K_AUX21			= 227,
118 	K_AUX22			= 228,
119 	K_AUX23			= 229,
120 	K_AUX24			= 230,
121 	K_AUX25			= 231,
122 	K_AUX26			= 232,
123 	K_AUX27			= 233,
124 	K_AUX28			= 234,
125 	K_AUX29			= 235,
126 	K_AUX30			= 236,
127 	K_AUX31			= 237,
128 	K_AUX32			= 238,
129 
130 	K_MWHEELDOWN		= 239,
131 	K_MWHEELUP		= 240,
132 
133 	K_PAUSE			= 255,
134 
135 	K_LAST
136 };
137 
138 extern char		*keybindings[K_LAST];
139 extern	int		key_repeats[K_LAST];
140 
141 extern	int	anykeydown;
142 extern char chat_buffer[];
143 extern	int chat_bufferlen;
144 extern	qboolean	chat_team;
145 
146 void Key_Event (int key, qboolean down, unsigned time);
147 void Key_Init (void);
148 void Key_WriteBindings (FILE *f);
149 void Key_SetBinding (int keynum, char *binding);
150 void Key_ClearStates (void);
151 int Key_GetKey (void);
152 
153