4 Copyright (C) 1996-1997 Id Software, Inc.
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.
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.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to:
20 Free Software Foundation, Inc.
21 59 Temple Place - Suite 330
22 Boston, MA 02111-1307, USA
33 // these are the key numbers that should be passed to Key_Event
37 K_TEXT = 1, // used only for unicode character input
43 // normal keys should be passed as lowercased ascii
86 K_KP_DOWNARROW = K_KP_2,
90 K_KP_LEFTARROW = K_KP_4,
93 K_KP_RIGHTARROW = K_KP_6,
97 K_KP_UPARROW = K_KP_8,
101 K_KP_DEL = K_KP_PERIOD,
103 K_KP_SLASH = K_KP_DIVIDE,
112 // mouse buttons generate virtual keys
115 K_OTHERDEVICESBEGIN = K_MOUSE1,
155 // aux keys are for multi-buttoned joysticks to generate so they can use
156 // the normal binding process
191 // Microsoft Xbox 360 Controller For Windows
200 K_X360_LEFT_SHOULDER,
201 K_X360_RIGHT_SHOULDER,
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,
217 // generic joystick emulation for menu
223 K_MIDINOTE0 = 896, // to this, the note number is added
356 typedef enum keydest_e { key_game, key_message, key_menu, key_menu_grabbed, key_console, key_void } keydest_t;
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];
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;
375 void Key_WriteBindings(qfile_t *f);
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);
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);