Jump to content
  • Advertisement

Archived

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

OGAPO

How to convert DIK_* to char

This topic is 6419 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

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 */

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!