Jump to content
  • Advertisement
Sign in to follow this  
SippyCup

Keypresses in C++?

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

I can't seem to find anything that talks about how to detect keypresses in C++. That's probably because it's really easy (I guess), but does anyone have any suggestions? I'm not sure how to go about doing this. Even examples from existing game source codes would be fine. I've done this in assembly, VC++, VB .NET, but never C++.

Share this post


Link to post
Share on other sites
Advertisement
By the way, is there an OS-independent way to do this, so code doesn't have to be duplicated for different OSes?

Share this post


Link to post
Share on other sites
Yes, you could use SDL for keyboard, mouse movements and clicks, creatings windows, and other things. SDL can also do graphics.

www.libsdl.org

Share this post


Link to post
Share on other sites
Quote:
Original post by SippyCup
By the way, is there an OS-independent way to do this, so code doesn't have to be duplicated for different OSes?


You might be interested to know that not all platforms which use C++ necessarily use keyboards, take the X-Box and PS2 for example. These platforms have their own custom built input libraries which have to be learned separately.

DirectInput is another (quite flexible) Windows based input library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!