Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Key.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
00003  *
00004  * All source code herein is the property of Volition, Inc. You may not sell 
00005  * or otherwise commercially exploit the source or things you created based on the 
00006  * source.
00007  *
00008 */ 
00009 
00010 /*
00011  * $Logfile: /Freespace2/code/Io/Key.h $
00012  * $Revision: 2 $
00013  * $Date: 10/07/98 10:53a $
00014  * $Author: Dave $
00015  *
00016  * Include file for keyboard reading routines
00017  *
00018  * $Log: /Freespace2/code/Io/Key.h $
00019  * 
00020  * 2     10/07/98 10:53a Dave
00021  * Initial checkin.
00022  * 
00023  * 1     10/07/98 10:49a Dave
00024  * 
00025  * 26    5/19/98 12:28a Mike
00026  * Cheat stuff.
00027  * 
00028  * 25    5/18/98 11:01p Mike
00029  * Adding support for cheat system.
00030  * 
00031  * 24    5/01/98 4:23p Lawrance
00032  * Remap the scancode for the UK "\" key
00033  * 
00034  * 23    1/07/98 6:41p Lawrance
00035  * Pass message latency to the keyboard lib.
00036  * 
00037  * 22    11/14/97 4:33p Mike
00038  * Change Debug key to backquote (from F11).
00039  * Balance a ton of subsystems in ships.tbl.
00040  * Change "Heavy Laser" to "Disruptor".
00041  * 
00042  * 21    10/21/97 7:18p Hoffoss
00043  * Overhauled the key/joystick control structure and usage throughout the
00044  * entire FreeSpace code.  The whole system is very different now.
00045  * 
00046  * 20    9/13/97 9:30a Lawrance
00047  * added ability to block certain keys from the keyboard
00048  * 
00049  * 19    9/10/97 6:02p Hoffoss
00050  * Added code to check for key-pressed sexp operator in FreeSpace as part
00051  * of training mission stuff.
00052  * 
00053  * 18    4/15/97 3:47p Allender
00054  * moved type selection of list box items into actual UI code.  Made it
00055  * behave more like windows listboxes do
00056  * 
00057  * 17    2/17/97 5:18p John
00058  * Added a bunch of RCS headers to a bunch of old files that don't have
00059  * them.
00060  *
00061  * $NoKeywords: $
00062  */
00063 
00064 #ifndef _KEY_H
00065 #define _KEY_H
00066 
00067 /*
00068 #ifdef __cplusplus
00069 extern "C" {
00070 #endif
00071 */
00072 
00073 #include "pstypes.h"
00074 
00075 #define NUM_KEYS 256
00076 
00077 extern int shifted_ascii_table[];
00078 extern int ascii_table[];
00079 
00080 extern ubyte keyd_pressed[NUM_KEYS];
00081 
00082 // O/S level hooks...
00083 void key_init();
00084 void key_level_init();
00085 void key_lost_focus();
00086 void key_got_focus();
00087 void key_mark( uint code, int state, uint latency );
00088 int key_getch();
00089 void key_flush();
00090 
00091 // Routines/data you can access:
00092 //NOT USED! extern fix key_down_time( uint code );
00093 float key_down_timef( uint code );
00094 
00095 int key_to_ascii(int keycode );
00096 int key_inkey();
00097 
00098 // global flag that will enable/disable the backspace key from stopping execution
00099 //extern int Backspace_debug;
00100 
00101 uint key_get_shift_status();
00102 int key_down_count(int scancode);
00103 int key_up_count(int scancode);
00104 int key_checkch();
00105 int key_check(int key);
00106 
00107 //      Put "key" back in the input buffer.
00108 void key_outkey(int key);
00109 
00110 // used to restrict keys that are read into keyboard buffer
00111 void key_set_filter(int *filter_array, int num);
00112 void key_clear_filter();
00113 
00114 extern int Cheats_enabled;
00115 extern int Key_normal_game;
00116 
00117 #define KEY_SHIFTED     0x1000
00118 #define KEY_ALTED       0x2000
00119 #define KEY_CTRLED      0x4000
00120 #define KEY_DEBUGGED            0x8000
00121 #define KEY_DEBUGGED1   0x0800          //      Cheat bit in release version of game.
00122 #define KEY_MASK                        0x00FF
00123 
00124 #define KEY_DEBUG_KEY   0x29                    //      KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard)
00125 
00126 #define KEY_0           0x0B
00127 #define KEY_1           0x02
00128 #define KEY_2           0x03
00129 #define KEY_3           0x04
00130 #define KEY_4           0x05
00131 #define KEY_5           0x06
00132 #define KEY_6           0x07
00133 #define KEY_7           0x08
00134 #define KEY_8           0x09
00135 #define KEY_9           0x0A
00136 
00137 #define KEY_A           0x1E
00138 #define KEY_B           0x30
00139 #define KEY_C           0x2E
00140 #define KEY_D           0x20
00141 #define KEY_E           0x12
00142 #define KEY_F           0x21
00143 #define KEY_G           0x22
00144 #define KEY_H           0x23
00145 #define KEY_I           0x17
00146 #define KEY_J           0x24
00147 #define KEY_K           0x25
00148 #define KEY_L           0x26
00149 #define KEY_M           0x32
00150 #define KEY_N           0x31
00151 #define KEY_O           0x18
00152 #define KEY_P           0x19
00153 #define KEY_Q           0x10
00154 #define KEY_R           0x13
00155 #define KEY_S           0x1F
00156 #define KEY_T           0x14
00157 #define KEY_U           0x16
00158 #define KEY_V           0x2F
00159 #define KEY_W           0x11
00160 #define KEY_X           0x2D
00161 #define KEY_Y           0x15
00162 #define KEY_Z           0x2C
00163 
00164 #define KEY_MINUS       0x0C
00165 #define KEY_EQUAL       0x0D
00166 #define KEY_DIVIDE      0x35
00167 #define KEY_SLASH       0x2B
00168 #define KEY_SLASH_UK            0x56
00169 #define KEY_COMMA       0x33
00170 #define KEY_PERIOD      0x34
00171 #define KEY_SEMICOL     0x27
00172 
00173 #define KEY_LBRACKET    0x1A
00174 #define KEY_RBRACKET    0x1B
00175 
00176 #define KEY_RAPOSTRO    0x28
00177 #define KEY_LAPOSTRO    0x29
00178 
00179 #define KEY_ESC         0x01
00180 #define KEY_ENTER       0x1C
00181 #define KEY_BACKSP      0x0E
00182 #define KEY_TAB         0x0F
00183 #define KEY_SPACEBAR    0x39
00184 
00185 #define KEY_NUMLOCK     0x45
00186 #define KEY_SCROLLOCK   0x46
00187 #define KEY_CAPSLOCK    0x3A
00188 
00189 #define KEY_LSHIFT      0x2A
00190 #define KEY_RSHIFT      0x36
00191 
00192 #define KEY_LALT        0x38
00193 #define KEY_RALT        0xB8
00194 
00195 #define KEY_LCTRL       0x1D
00196 #define KEY_RCTRL       0x9D
00197 
00198 #define KEY_F1          0x3B
00199 #define KEY_F2          0x3C
00200 #define KEY_F3          0x3D
00201 #define KEY_F4          0x3E
00202 #define KEY_F5          0x3F
00203 #define KEY_F6          0x40
00204 #define KEY_F7          0x41
00205 #define KEY_F8          0x42
00206 #define KEY_F9          0x43
00207 #define KEY_F10         0x44
00208 #define KEY_F11         0x57
00209 #define KEY_F12         0x58
00210 
00211 #define KEY_PAD0        0x52
00212 #define KEY_PAD1        0x4F
00213 #define KEY_PAD2        0x50
00214 #define KEY_PAD3        0x51
00215 #define KEY_PAD4        0x4B
00216 #define KEY_PAD5        0x4C
00217 #define KEY_PAD6        0x4D
00218 #define KEY_PAD7        0x47
00219 #define KEY_PAD8        0x48
00220 #define KEY_PAD9        0x49
00221 #define KEY_PADMINUS    0x4A
00222 #define KEY_PADPLUS     0x4E
00223 #define KEY_PADPERIOD   0x53
00224 #define KEY_PADDIVIDE   0xB5
00225 #define KEY_PADMULTIPLY 0x37
00226 #define KEY_PADENTER    0x9C
00227 
00228 #define KEY_INSERT      0xD2
00229 #define KEY_HOME        0xC7
00230 #define KEY_PAGEUP      0xC9
00231 #define KEY_DELETE      0xd3
00232 #define KEY_END         0xCF
00233 #define KEY_PAGEDOWN    0xD1
00234 #define KEY_UP          0xC8
00235 #define KEY_DOWN        0xD0
00236 #define KEY_LEFT        0xCB
00237 #define KEY_RIGHT       0xCD
00238 
00239 #define KEY_PRINT_SCRN  0xB7
00240 #define KEY_PAUSE                       0x45    //DOS: 0x61
00241 #define KEY_BREAK                       0xc6
00242 
00243 /*
00244 #ifdef __cplusplus
00245 }
00246 #endif
00247 */
00248 
00249 #endif

Generated on Mon Jul 8 11:28:28 2002 for fs2source_released by doxygen1.2.16