doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KeyInput.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #ifndef __KEYINPUT_H__
30 #define __KEYINPUT_H__
31 
32 /*
33 ===============================================================================
34 
35  Key Input
36 
37 ===============================================================================
38 */
39 
40 // these are the key numbers that are used by the key system
41 // normal keys should be passed as lowercased ascii
42 // Some high ascii (> 127) characters that are mapped directly to keys on
43 // western european keyboards are inserted in this table so that those keys
44 // are bindable (otherwise they get bound as one of the special keys in this
45 // table)
46 typedef enum {
47  K_TAB = 9,
48  K_ENTER = 13,
49  K_ESCAPE = 27,
50  K_SPACE = 32,
51 
52  K_BACKSPACE = 127,
53 
54  K_COMMAND = 128,
59 
60  K_UPARROW = 133,
64 
65  // The 3 windows keys
66  K_LWIN = 137,
69 
70  K_ALT = 140,
79 
80  K_F1 = 149,
92  K_INVERTED_EXCLAMATION = 161, // upside down !
96 
97  K_KP_HOME = 165,
110  K_SUPERSCRIPT_TWO = 178, // superscript 2
112  K_ACUTE_ACCENT = 180, // accute accent
117 
119  // K_MOUSE enums must be contiguous (no char codes in the middle)
120  K_MOUSE1 = 187,
128 
131 
132  K_JOY1 = 197,
159  K_GRAVE_A = 224, // lowercase a with grave accent
165 
166  K_AUX1 = 230,
167  K_CEDILLA_C = 231, // lowercase c with Cedilla
168  K_GRAVE_E = 232, // lowercase e with grave accent
172  K_GRAVE_I = 236, // lowercase i with grave accent
177  K_TILDE_N = 241, // lowercase n with tilde
178  K_GRAVE_O = 242, // lowercase o with grave accent
185  K_GRAVE_U = 249, // lowercase u with grave accent
188 
189  K_PRINT_SCR = 252, // SysRq / PrintScr
190  K_RIGHT_ALT = 253, // used by some languages as "Alt-Gr"
191  K_LAST_KEY = 254 // this better be < 256!
192 } keyNum_t;
193 
194 
195 class idKeyInput {
196 public:
197  static void Init( void );
198  static void Shutdown( void );
199 
200  static void ArgCompletion_KeyName( const idCmdArgs &args, void(*callback)( const char *s ) );
201  static void PreliminaryKeyEvent( int keyNum, bool down );
202  static bool IsDown( int keyNum );
203  static int GetUsercmdAction( int keyNum );
204  static bool GetOverstrikeMode( void );
205  static void SetOverstrikeMode( bool state );
206  static void ClearStates( void );
207  static int StringToKeyNum( const char *str );
208  static const char * KeyNumToString( int keyNum, bool localized );
209 
210  static void SetBinding( int keyNum, const char *binding );
211  static const char * GetBinding( int keyNum );
212  static bool UnbindBinding( const char *bind );
213  static int NumBinds( const char *binding );
214  static bool ExecKeyBinding( int keyNum );
215  static const char * KeysFromBinding( const char *bind );
216  static const char * BindingFromKey( const char *key );
217  static bool KeyIsBoundTo( int keyNum, const char *binding );
218  static void WriteBindings( idFile *f );
219 };
220 
221 #endif /* !__KEYINPUT_H__ */
static bool IsDown(int keyNum)
Definition: KeyInput.cpp:271
static int GetUsercmdAction(int keyNum)
Definition: KeyInput.cpp:453
static bool UnbindBinding(const char *bind)
Definition: KeyInput.cpp:648
Definition: KeyInput.h:78
static void Shutdown(void)
Definition: KeyInput.cpp:782
Definition: KeyInput.h:83
Definition: KeyInput.h:82
Definition: KeyInput.h:88
static int StringToKeyNum(const char *str)
Definition: KeyInput.cpp:291
Definition: KeyInput.h:86
Definition: KeyInput.h:74
static void WriteBindings(idFile *f)
Definition: KeyInput.cpp:567
static void ClearStates(void)
Definition: KeyInput.cpp:746
Definition: KeyInput.h:85
prefInfo callback
Definition: KeyInput.h:81
GLdouble s
Definition: glext.h:2935
Definition: KeyInput.h:93
Definition: KeyInput.h:91
Definition: File.h:50
Definition: KeyInput.h:90
Definition: KeyInput.h:80
Definition: KeyInput.h:73
static int NumBinds(const char *binding)
Definition: KeyInput.cpp:668
static bool GetOverstrikeMode(void)
Definition: KeyInput.cpp:253
static const char * BindingFromKey(const char *key)
Definition: KeyInput.cpp:635
Definition: KeyInput.h:94
Definition: KeyInput.h:47
Definition: KeyInput.h:84
static void Init(void)
Definition: KeyInput.cpp:765
Definition: KeyInput.h:87
static const char * KeyNumToString(int keyNum, bool localized)
Definition: KeyInput.cpp:344
static bool ExecKeyBinding(int keyNum)
Definition: KeyInput.cpp:726
static const char * KeysFromBinding(const char *bind)
Definition: KeyInput.cpp:607
static bool KeyIsBoundTo(int keyNum, const char *binding)
Definition: KeyInput.cpp:686
tuple f
Definition: idal.py:89
Definition: KeyInput.h:70
static void ArgCompletion_KeyName(const idCmdArgs &args, void(*callback)(const char *s))
Definition: KeyInput.cpp:235
keyNum_t
Definition: KeyInput.h:46
static void SetBinding(int keyNum, const char *binding)
Definition: KeyInput.cpp:415
static void SetOverstrikeMode(bool state)
Definition: KeyInput.cpp:262
Definition: KeyInput.h:89
Definition: KeyInput.h:95
static const char * GetBinding(int keyNum)
Definition: KeyInput.cpp:440
static void PreliminaryKeyEvent(int keyNum, bool down)
Definition: KeyInput.cpp:701