Archived

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

Negitivefrags

Direct Input: Buffered Data

Recommended Posts

Untill this point I have been using GetDeviceState to get the keyboard state and checking against any of the device constants that Direct Input surplys. But now I want to get the user to input some actual text so I thought I would switch to Buffered input for this phase. It is easy enough to get how it works, but there is one thing I still dont get. How can you turn the information you get from the buffer into a char without cheacking manualy against every single keyboard device constant? There Must be a way! But I cant work it out, or there is somthing I am missing here.

Share this post


Link to post
Share on other sites
To handle text input, I just rely on WM_CHAR messages. It's not like the user needs to type the text blinding fast ala DirectInput. I tried making an input class that used DirectInput, but fell back on WM_* messages when it wasn't installed, but.. it didn't work very well. I couldn't figure out how to translate the DIK_* constants to VK_* constants. There were all these articles about using several windows functions to map them, but I never understood them.

EDIT: found the link: DirectInput: Converting Scan Codes to ASCII

[edited by - psykr on August 13, 2003 6:46:26 PM]

Share this post


Link to post
Share on other sites
So you are saying that when it gets to the point where the user needs to input text I should unaquire the keyboard and then re-acquire it afterwards.. hmm.. It doesnt sound like the most elegant solution though. Im shure there must a be a reasonably simple way of converting that char[256] buffer down into a single valid char...

Share this post


Link to post
Share on other sites