]> icculus.org git repositories - taylor/freespace2.git/blob - include/key.h
embed standalone web in executable
[taylor/freespace2.git] / include / key.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Io/Key.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Include file for keyboard reading routines
16  *
17  * $Log$
18  * Revision 1.9  2002/08/04 02:31:00  relnev
19  * make numlock not overlap with pause
20  *
21  * Revision 1.8  2002/06/09 04:41:13  relnev
22  * added copyright header
23  *
24  * Revision 1.7  2002/05/31 03:34:02  theoddone33
25  * Fix Keyboard
26  * Add titlebar
27  *
28  * Revision 1.6  2002/05/30 23:46:29  theoddone33
29  * some minor key changes (not necessarily fixes)
30  *
31  * Revision 1.5  2002/05/30 22:02:30  theoddone33
32  * More gl changes
33  *
34  * Revision 1.4  2002/05/30 16:50:24  theoddone33
35  * Keyboard partially fixed
36  *
37  * Revision 1.3  2002/05/29 23:17:49  theoddone33
38  * Non working text code and fixed keys
39  *
40  * Revision 1.2  2002/05/29 06:25:12  theoddone33
41  * Keyboard input, mouse tracking now work
42  *
43  * Revision 1.1.1.1  2002/05/03 03:28:12  root
44  * Initial import.
45  *
46  * 
47  * 2     10/07/98 10:53a Dave
48  * Initial checkin.
49  * 
50  * 1     10/07/98 10:49a Dave
51  * 
52  * 26    5/19/98 12:28a Mike
53  * Cheat stuff.
54  * 
55  * 25    5/18/98 11:01p Mike
56  * Adding support for cheat system.
57  * 
58  * 24    5/01/98 4:23p Lawrance
59  * Remap the scancode for the UK "\" key
60  * 
61  * 23    1/07/98 6:41p Lawrance
62  * Pass message latency to the keyboard lib.
63  * 
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".
68  * 
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.
72  * 
73  * 20    9/13/97 9:30a Lawrance
74  * added ability to block certain keys from the keyboard
75  * 
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.
79  * 
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
83  * 
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
86  * them.
87  *
88  * $NoKeywords: $
89  */
90
91 #ifndef _KEY_H
92 #define _KEY_H
93
94 #include "pstypes.h"
95
96
97 bool key_pressed(int keycode);
98
99 // O/S level hooks...
100 void key_init();
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 );
105 int key_getch();
106 void key_flush();
107
108 // Routines/data you can access:
109 float key_down_timef(int keycode);
110
111 bool key_is_ascii(int keycode);
112 int key_inkey();
113
114 int key_get_text_input();
115 void key_set_text_input(int ch);
116
117 // global flag that will enable/disable the backspace key from stopping execution
118 //extern int Backspace_debug;
119
120 uint key_get_shift_status();
121 int key_down_count(int keycode);
122 int key_up_count(int keycode);
123 int key_checkch();
124 int key_check(int keycode);
125
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();
129
130 extern int Cheats_enabled;
131 extern int Key_normal_game;
132
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)
139
140 #define KEY_DEBUG_KEY   SDLK_BACKQUOTE          //      KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard)
141
142 #endif
143