Low-Level Keyboard HandlerFastgraph includes a low-level keyboard handler that is especially well suited to game development because it increases keyboard responsiveness in high-speed action games. Unlike Fastgraph for DOS, you do not need to explicitly enable the low-level keyboard handler in Fastgraph for Windows because it is always available. The fg_kbtest() function checks if certain keys are currently pressed or released. You specify the keys through scan codes. If the corresponding key is pressed, fg_kbtest() returns 1; if it is released, it returns zero. The fg_kbtest() function can test if any key is pressed if you pass it the value 0 instead of a specific scan code. The following table lists the scan codes corresponding to the keys on a standard PC keyboard.
There are actually more scan codes defined for PC keyboards than listed in this table. Such scan codes are generated when a key is pressed as a combination of one or more keys, such as when the shift and slash keys are pressed together to produce a question mark (?) character. The low-level keyboard handler is designed to report the pressing or releasing of keys themselves, as opposed to reporting the actual characters so produced. It is thus not possible for the keyboard handler to report the scan code for a multi-key character. If needed, such characters can be identified by the scan codes generated for each key in the sequence. For example, a question mark character would be reported as a forward slash (scan code 53) generated while pressing the left shift (42) or right shift (54) keys.
|
 
copyright 2001 Ted Gruber Software, Inc.