Scan Codes to Characters?

Started by
2 comments, last by Ranok 24 years, 5 months ago
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

Advertisement
There will be a short featured article up later today covering method of doing this.
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?
---Ranok---
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.

Reaver

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

This topic is closed to new replies.

Advertisement