Original Post
I want to add the option for players to remap their keys in my game. So basically, the user presses a key, i get the scan code for it and then i want the name of that key to appear on the screen. I already know how to convert scan codes into text, but thats not exactly what i want. If the user presses the space bar for example, i want "SPACE" to appear on screen not " ".
So essentially i need the opposite of this:
#define DIK_ESCAPE 0x01
#define DIK_1 0x02
#define DIK_2 0x03
#define DIK_3 0x04
#define DIK_4 0x05
#define DIK_5 0x06
etc...
i.e.
void GetKeyName(BYTE ScanCode, char szKeyName[])
{
switch (ScanCode)
{
case 0x01: strcpy(szKeyName, "Escape"); break;
case 0x02: strcpy(szKeyName, "1"); break;
case 0x03: strcpy(szKeyName, "2"); break;
}
}
sure, i could define them all manually... but there are 256 keys, thats a bit of a drag. There must be some kind of function to do this, right?
[edited by - SpaceDude on May 1, 2004 10:09:55 PM]