Jump to content
  • Advertisement

Archived

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

Peon

Getting keyboard input w/ DirectX

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

Alright, I understand DI enough to get input from the keyboard. They press ESC I exit the program. Now I want to make it so the user can type a file name to load and I want to use DI. Now I already know how to check for individual keys, but without checking each key specifically, how could I do this? I''m aiming to do something like cin, but more simple. thanks in advance Peon

Share this post


Link to post
Share on other sites
Advertisement
You''ve gotta make your own function that writes chars to a string every time you press a letter. It''ll take a little typing, buty once yo finish it, the rest will be easy.


-Forcas


"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."

Share this post


Link to post
Share on other sites
i would just intercept the WM_CHAR message for typing things in - that way you get the keyboard refresh rates (etc) by default.

Share this post


Link to post
Share on other sites
I think that''s my problem, Forcas. I know how to check keys using an if statement or something, ie:

if (keystate[DIK_A]
{
do...
}

Or whatever. My problem is that I want to get input without going: if (A), if (B), if (C).. You know what I mean? I might just be misunderstanding you, let me know if you have something else in mind

Thanks

Peon

Share this post


Link to post
Share on other sites
You can get DI to Poll/GetDeviceState - which is what you''re probably doing OR you can setup DI for BUFFERED input (which sounds like what you want). Check out the DX-DI function GetDeviceData() or do a search for "Buffered Keyboard Data" in the SDK help files. I think that''s what you''re looking for.

Regards,
Jumpster

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!