Advertisement Jump to content


This topic is now archived and is closed to further replies.


Scan Codes to Characters?

This topic is 7012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

We discuessed this a couple weeks ago, but here is the summary:

1) Use WM_CHAR messages (assuming not in exclusive keyboard mode) and ignore DirectInput scan codes for purpose of text.

2) Calculate a conversion array with the scan code as the index and the ASCII code as the result. Also, caluclate a "shifted" array for when the SHIFT or CAPS LOCK keys are down.

In other words, no real simple way. I prefer the second way because I program for portability and my input layer is already abstracted out, so this just lies on top and is not affected by what platform I am on.

- Splat

Share this post

Link to post
Share on other sites
Does anybody know a good way to convert from a characters scan code to the character itself ie. I have the scan code DIK_A how can I get the character 'a' from it besides using a huge switch statement or something like that?

Share this post

Link to post
Share on other sites
Perhaps, if you tied this DI subject into writing your own DirectX console
(e.g. typing out a message for network players), making a game load/save menu
where you have to type the name of the file to save it, or creating a top
score list where you type in your name, I would love to read. The last one on
quake-like consoles was not very helpful, (not to me anyway ) since it was
written in Visual Basic and did not use a DI scan codes to ascii codes method.


[This message has been edited by Reaver (edited November 12, 1999).]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!