2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
14 * $Source: /cvs/cvsroot/d2x/arch/win32/include/key.h,v $
16 * $Author: schaffner $
17 * $Date: 2004-08-28 23:17:45 $
19 * Header for keyboard functions
21 * $Log: not supported by cvs2svn $
22 * Revision 1.1.1.1 2001/01/19 03:30:15 bradleyb
25 * Revision 1.1.1.1 1999/06/14 22:01:23 donut
26 * Import of d1x 1.37 source.
35 #include <ctype.h> // For 'toupper'
37 //==========================================================================
38 // This installs the int9 vector and initializes the keyboard in buffered
39 // ASCII mode. key_close simply undoes that.
40 extern void key_init();
41 extern void key_close();
43 //==========================================================================
44 // These are configuration parameters to setup how the buffer works.
45 // set keyd_buffer_type to 0 for no key buffering.
46 // set it to 1 and it will buffer scancodes.
47 extern unsigned char keyd_buffer_type;
48 extern unsigned char keyd_repeat; // 1=allow repeating, 0=dont allow repeat
50 // keyd_editor_mode... 0=game mode, 1=editor mode.
51 // Editor mode makes key_down_time always return 0 if modifiers are down.
52 extern unsigned char keyd_editor_mode;
54 // Time in seconds when last key was pressed...
55 extern volatile int keyd_time_when_last_pressed;
57 //==========================================================================
58 // These are the "buffered" keypress routines. Use them by setting the
59 // "keyd_buffer_type" variable.
61 extern void key_flush(); // Clears the 256 char buffer
62 extern int key_checkch(); // Returns 1 if a char is waiting
63 extern int key_getch(); // Gets key if one waiting other waits for one.
64 extern int key_inkey(); // Gets key if one, other returns 0.
65 extern int key_inkey_time(fix *time); // Same as inkey, but returns the time the key was pressed down.
66 extern int key_peekkey(); // Same as inkey, but doesn't remove key from buffer.
68 extern unsigned char key_to_ascii(int keycode );
69 extern char *key_name(int keycode); // Convert keycode to the name of the key
71 extern void key_debug(); // Does an INT3
73 //==========================================================================
74 // These are the unbuffered routines. Index by the keyboard scancode.
76 // Set to 1 if the key is currently down, else 0
77 extern volatile unsigned char keyd_pressed[];
78 extern volatile unsigned char keyd_last_pressed;
79 extern volatile unsigned char keyd_last_released;
81 // Returns the seconds this key has been down since last call.
82 extern fix key_down_time(int scancode);
84 // Returns number of times key has went from up to down since last call.
85 extern unsigned int key_down_count(int scancode);
87 // Returns number of times key has went from down to up since last call.
88 extern unsigned int key_up_count(int scancode);
90 // Clears the times & counts used by the above functions
91 // Took out... use key_flush();
92 //void key_clear_times();
93 //void key_clear_counts();
95 extern char * key_text[256];
97 #define KEY_SHIFTED 0x100
98 #define KEY_ALTED 0x200
99 #define KEY_CTRLED 0x400
100 #define KEY_DEBUGGED 0x800
142 #define KEY_DIVIDE 43
145 #define KEY_PERIOD 52
146 #define KEY_SEMICOL 39
148 #define KEY_LBRACKET 26
149 #define KEY_RBRACKET 27
151 #define KEY_RAPOSTRO 40
152 #define KEY_LAPOSTRO 41
156 #define KEY_BACKSP 14
158 #define KEY_SPACEBAR 57
160 #define KEY_NUMLOCK 69
161 #define KEY_SCROLLOCK 70
162 #define KEY_CAPSLOCK 58
164 #define KEY_LSHIFT 42
165 #define KEY_RSHIFT 54
171 #define KEY_RCTRL 157
196 #define KEY_PADMINUS 74
197 #define KEY_PADPLUS 78
198 #define KEY_PADPERIOD 83
199 #define KEY_PADDIVIDE 81
200 #define KEY_PADMULTIPLY 55
201 #define KEY_PADENTER 156
203 #define KEY_INSERT 210
205 #define KEY_PAGEUP 221
206 #define KEY_DELETE 211
208 #define KEY_PAGEDOWN 219
212 #define KEY_RIGHT 205
214 #define KEY_PRINT_SCREEN 165
215 #define KEY_PAUSE 143