How to convert DIK_* to char
Is there a quick way (shory of writing out my own conversion array) to convert the DIK_A - DIK_Z constants into their ascii equivalents? It seems like there should be since i would imagine this would be a routine function. Or am I stuck writing a conversion table ;-)?
Thanks, OGAPO
Brought to you by: O.G.A.P.O.
+----------------------------------------+
| Surgeon General''s Warning - |
| OGAPO can cause serious mental damage |
| if taken in large doses. |
+----------------------------------------+
/* Never underestimate the power of stupid people in large groups */
Brought to you by: [email=ogapo@ithink.net]O.G.A.P.O.[/email] +----------------------------------------+| Surgeon General's Warning - || OGAPO can cause serious mental damage || if taken in large doses. |+----------------------------------------+/* Never underestimate the power of stupid people in large groups */
Well I''m pretty sure DIK_A through DIK_Z have consecutive values, so you should just be able to do something like this (if the DIK_ constant is stored in dikCode):
BYTE asciiCode = dikCode + (''A'' - DIK_A);
This is just for letters though.
-Ironblayde
Aeon Software
Next thing you know, they''ll take my thoughts away.
BYTE asciiCode = dikCode + (''A'' - DIK_A);
This is just for letters though.
-Ironblayde
Aeon Software
Next thing you know, they''ll take my thoughts away.
"Your superior intellect is no match for our puny weapons!"
just do a table, i did one today, no big deal... if you want me to send you mine, e-mail me. david@neonstar.net
--
davidw@heehaw.com
neonstar entertainment
--
davidw@heehaw.com
neonstar entertainment
--david@neonstar.netneonstar entertainment
ironblaydes reply is the easiest way but i recommend doing what neonstar saiz and define your own conervsion routine in doing so u have the freedom to choose your method of polling the keyboard/mouse whatever
http://members.xoom.com/myBollux
Edited by - zedzeek on November 24, 2000 4:22:15 AM
http://members.xoom.com/myBollux
Edited by - zedzeek on November 24, 2000 4:22:15 AM
DIK_A through Z are not consecutive (they corrispond to the keyboard scanning codes or so i've found). For anyone interested I actually ended up finding a GameDev article on it after a few more hours of digging. Thanks for the help though :-)
Here's the article
Edited by - ogapo on November 24, 2000 9:31:43 PM
Here's the article
Edited by - ogapo on November 24, 2000 9:31:43 PM
Brought to you by: [email=ogapo@ithink.net]O.G.A.P.O.[/email] +----------------------------------------+| Surgeon General's Warning - || OGAPO can cause serious mental damage || if taken in large doses. |+----------------------------------------+/* Never underestimate the power of stupid people in large groups */
whoops true i assumed they(a-z) would of been in order but they''re not (looked at the dinput header)
in case anyones interested what i do is the following
if (directinput.Keys[ DIK_RCONTROL ]) keyboard[ KEY_RCONTROL] = PUSHED;
if (directinput.Keys[ DIK_LCONTROL ]) keyboard[ KEY_LCONTROL] = PUSHED;
if (directinput.Keys[ DIK_SPACE ]) keyboard[ KEY_SPACE ] = PUSHED;
here i keep track of what keys are preesed in the keyboard[..] array
http://members.xoom.com/myBollux
in case anyones interested what i do is the following
if (directinput.Keys[ DIK_RCONTROL ]) keyboard[ KEY_RCONTROL] = PUSHED;
if (directinput.Keys[ DIK_LCONTROL ]) keyboard[ KEY_LCONTROL] = PUSHED;
if (directinput.Keys[ DIK_SPACE ]) keyboard[ KEY_SPACE ] = PUSHED;
here i keep track of what keys are preesed in the keyboard[..] array
http://members.xoom.com/myBollux
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement