2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Io/Key.h $
15 * Include file for keyboard reading routines
18 * Revision 1.9 2002/08/04 02:31:00 relnev
19 * make numlock not overlap with pause
21 * Revision 1.8 2002/06/09 04:41:13 relnev
22 * added copyright header
24 * Revision 1.7 2002/05/31 03:34:02 theoddone33
28 * Revision 1.6 2002/05/30 23:46:29 theoddone33
29 * some minor key changes (not necessarily fixes)
31 * Revision 1.5 2002/05/30 22:02:30 theoddone33
34 * Revision 1.4 2002/05/30 16:50:24 theoddone33
35 * Keyboard partially fixed
37 * Revision 1.3 2002/05/29 23:17:49 theoddone33
38 * Non working text code and fixed keys
40 * Revision 1.2 2002/05/29 06:25:12 theoddone33
41 * Keyboard input, mouse tracking now work
43 * Revision 1.1.1.1 2002/05/03 03:28:12 root
47 * 2 10/07/98 10:53a Dave
50 * 1 10/07/98 10:49a Dave
52 * 26 5/19/98 12:28a Mike
55 * 25 5/18/98 11:01p Mike
56 * Adding support for cheat system.
58 * 24 5/01/98 4:23p Lawrance
59 * Remap the scancode for the UK "\" key
61 * 23 1/07/98 6:41p Lawrance
62 * Pass message latency to the keyboard lib.
64 * 22 11/14/97 4:33p Mike
65 * Change Debug key to backquote (from F11).
66 * Balance a ton of subsystems in ships.tbl.
67 * Change "Heavy Laser" to "Disruptor".
69 * 21 10/21/97 7:18p Hoffoss
70 * Overhauled the key/joystick control structure and usage throughout the
71 * entire FreeSpace code. The whole system is very different now.
73 * 20 9/13/97 9:30a Lawrance
74 * added ability to block certain keys from the keyboard
76 * 19 9/10/97 6:02p Hoffoss
77 * Added code to check for key-pressed sexp operator in FreeSpace as part
78 * of training mission stuff.
80 * 18 4/15/97 3:47p Allender
81 * moved type selection of list box items into actual UI code. Made it
82 * behave more like windows listboxes do
84 * 17 2/17/97 5:18p John
85 * Added a bunch of RCS headers to a bunch of old files that don't have
97 bool key_pressed(int keycode);
101 void key_level_init();
102 void key_lost_focus();
103 void key_got_focus();
104 void key_mark(SDL_Scancode scancode, int state, ushort kmod, uint latency );
108 // Routines/data you can access:
109 float key_down_timef(int keycode);
111 bool key_is_ascii(int keycode);
114 int key_get_text_input();
115 void key_set_text_input(int ch);
117 // global flag that will enable/disable the backspace key from stopping execution
118 //extern int Backspace_debug;
120 uint key_get_shift_status();
121 int key_down_count(int keycode);
122 int key_up_count(int keycode);
124 int key_check(int keycode);
126 // used to restrict keys that are read into keyboard buffer
127 void key_set_filter(int *filter_array, int num);
128 void key_clear_filter();
130 extern int Cheats_enabled;
131 extern int Key_normal_game;
133 #define KEY_SHIFTED 0x1000
134 #define KEY_ALTED 0x2000
135 #define KEY_CTRLED 0x4000
136 #define KEY_DEBUGGED 0x8000
137 #define KEY_DEBUGGED1 0x0800 // Cheat bit in release version of game.
138 #define KEY_MASK (SDLK_SCANCODE_MASK|0x01FF)
140 #define KEY_DEBUG_KEY SDLK_BACKQUOTE // KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard)