array of 256 keys?

Started by
10 comments, last by AndreTheGiant 20 years ago
f and F are the same key on your keyboard (I''m assuming, they are on mine). What''s the confusion?

Assuming you are using Windows, look in WINUSER.H for the entire list of keyboard key constants.

If you are using DirectInput you should look in INPUT.H for the DirectInput equivalents (the numbers will be the same even though the constants are different).

When you are processing that message you are processing a key state, NOT A CHARACTER. The f KEY was hit. If you meant the ''F'' CHARACTER you will need to check if the one of the shift keys is also down.

There is the WM_CHAR message that does distinguish between f and F as characters.

BTW, you can get the keyboard state without saving the array by using the command GetAsyncKeyState() for the keys you care about (Windows is storing this array for you anyways).
Advertisement
The GetAsyncKeyState() bypasses the windows message loop, and should therfor not be used (if not specific reasons for bypassing the message loop exists), since your application will detect keypresses even if the window isn''t active (i.e. when you alt-tab to some other window to write emails, answer IM or whatever)

This topic is closed to new replies.

Advertisement