WaitKey pauses the application until a key is pressed, then returns the relevant ASCII code.
GetKey checks if a key was pressed in the past (since the key buffer was last cleared by such a test), and returns its ASCII code or zero. GetKey does not pause the application, hence the zero option.
KeyHit tests whether a specific key (identified by the scancode parameter) was pressed in the past, returning true or false. It also does not pause the application.
There's also KeyDown, which is like KeyHit but tests whether a key is still being pressed right now.
In general you will want to use KeyHit or KeyDown. GetKey and WaitKey are of extremely limited utility for a realtime game or app, and ASCII codes are a useless way to identify keys anyway (most keys either represent multiple characters, e.g. capital and lowercase, or don't represent a character at all) - scancodes are much better as they are just a UID for each actual button on the keyboard.
|