]> icculus.org git repositories - divverent/darkplaces.git/blob - keys.h
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[divverent/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 extern enum {
36         K_TAB                   = 9,
37         K_ENTER                 = 13,
38         K_ESCAPE                = 27,
39         K_SPACE                 = 32,
40
41         // normal keys should be passed as lowercased ascii
42
43         K_BACKSPACE             = 127,
44         K_UPARROW,
45         K_DOWNARROW,
46         K_LEFTARROW,
47         K_RIGHTARROW,
48
49         K_ALT,
50         K_CTRL,
51         K_SHIFT,
52         K_F1,
53         K_F2,
54         K_F3,
55         K_F4,
56         K_F5,
57         K_F6,
58         K_F7,
59         K_F8,
60         K_F9,
61         K_F10,
62         K_F11,
63         K_F12,
64         K_INS,
65         K_DEL,
66         K_PGDN,
67         K_PGUP,
68         K_HOME,
69         K_END,
70
71         K_PAUSE,
72
73         K_NUMLOCK,
74         K_CAPSLOCK,
75         K_SCROLLOCK,
76
77         K_KP_0,
78         K_KP_INS = K_KP_0,
79         K_KP_1,
80         K_KP_END = K_KP_1,
81         K_KP_2,
82         K_KP_DOWNARROW = K_KP_2,
83         K_KP_3,
84         K_KP_PGDN = K_KP_3,
85         K_KP_4,
86         K_KP_LEFTARROW = K_KP_4,
87         K_KP_5,
88         K_KP_6,
89         K_KP_RIGHTARROW = K_KP_6,
90         K_KP_7,
91         K_KP_HOME = K_KP_7,
92         K_KP_8,
93         K_KP_UPARROW = K_KP_8,
94         K_KP_9,
95         K_KP_PGUP = K_KP_9,
96         K_KP_PERIOD,
97         K_KP_DEL = K_KP_PERIOD,
98         K_KP_DIVIDE,
99         K_KP_SLASH = K_KP_DIVIDE,
100         K_KP_MULTIPLY,
101         K_KP_MINUS,
102         K_KP_PLUS,
103         K_KP_ENTER,
104         K_KP_EQUALS,
105
106         // mouse buttons generate virtual keys
107
108         K_MOUSE1 = 512,
109         K_MOUSE2,
110         K_MOUSE3,
111         K_MOUSE4,
112         K_MWHEELUP              = K_MOUSE4,
113         K_MOUSE5,
114         K_MWHEELDOWN    = K_MOUSE5,
115         K_MOUSE6,
116         K_MOUSE7,
117         K_MOUSE8,
118         K_MOUSE9,
119         K_MOUSE10,
120         K_MOUSE11,
121         K_MOUSE12,
122         K_MOUSE13,
123         K_MOUSE14,
124         K_MOUSE15,
125         K_MOUSE16,
126
127 //
128 // joystick buttons
129 //
130         K_JOY1 = 768,
131         K_JOY2,
132         K_JOY3,
133         K_JOY4,
134         K_JOY5,
135         K_JOY6,
136         K_JOY7,
137         K_JOY8,
138         K_JOY9,
139         K_JOY10,
140         K_JOY11,
141         K_JOY12,
142         K_JOY13,
143         K_JOY14,
144         K_JOY15,
145         K_JOY16,
146
147 //
148 // aux keys are for multi-buttoned joysticks to generate so they can use
149 // the normal binding process
150 //
151         K_AUX1,
152         K_AUX2,
153         K_AUX3,
154         K_AUX4,
155         K_AUX5,
156         K_AUX6,
157         K_AUX7,
158         K_AUX8,
159         K_AUX9,
160         K_AUX10,
161         K_AUX11,
162         K_AUX12,
163         K_AUX13,
164         K_AUX14,
165         K_AUX15,
166         K_AUX16,
167         K_AUX17,
168         K_AUX18,
169         K_AUX19,
170         K_AUX20,
171         K_AUX21,
172         K_AUX22,
173         K_AUX23,
174         K_AUX24,
175         K_AUX25,
176         K_AUX26,
177         K_AUX27,
178         K_AUX28,
179         K_AUX29,
180         K_AUX30,
181         K_AUX31,
182         K_AUX32,
183
184 } keynum_t;
185
186 typedef enum { key_game, key_message, key_menu } keydest_t;
187
188 #define MAX_INPUTLINES 32
189 #define MAX_INPUTLINE 256
190 #define MAX_BINDMAPS 8
191 #define MAX_KEYS 1024
192 extern  int                     edit_line;
193 extern  int                     history_line;
194 extern  char            key_lines[MAX_INPUTLINES][MAX_INPUTLINE];
195 extern  int                     key_linepos;
196 extern  qboolean        key_insert;     // insert key toggle (for editing)
197 extern  keydest_t       key_dest;
198 // key_consoleactive bits
199 // user wants console (halfscreen)
200 #define KEY_CONSOLEACTIVE_USER 1
201 // console forced because there's nothing else active (fullscreen)
202 #define KEY_CONSOLEACTIVE_FORCED 4
203 extern  int                     key_consoleactive;
204 extern  char            *keybindings[MAX_BINDMAPS][MAX_KEYS];
205
206 extern void Key_ClearEditLine(int edit_line);
207 extern qboolean chat_team;
208 extern char chat_buffer[256];
209 extern unsigned int chat_bufferlen;
210
211 void Key_WriteBindings(qfile_t *f);
212 void Key_Init(void);
213 void Key_Init_Cvars(void);
214 void Key_Event(int key, char ascii, qboolean down);
215 void Key_ClearStates (void);
216 void Key_SetBinding (int keynum, int bindmap, const char *binding);
217
218 #endif // __KEYS_H
219