Jump to content
  • Advertisement
Sign in to follow this  
QuackCoder

Writing an Input class

This topic is 2578 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 don't know about others but game inputs are making me confused.

My thoughts of such a class...Keyboard:
1. A property to hold the key being pressed.
2. A method which should be invoked on onKeyDown event and set the above property.
3. A method which should be invoked on onKeyUp event and unset the above property.

But is this right? Do I need more property/methods?

Share this post


Link to post
Share on other sites
Advertisement
Some suggestions:

- You could move both methods into one. SetKey(bool) should fit fine.

- Of course you at least need a method to check if the key-state is actually being set. However, you could need more than that: Most games will need a method to check if a key is hold down, but also if it is just pressed (quicktime-events for example), etc.

I hope this helps you get on thinking. It depends on the game you are making, but keep in mind that pushing and hplding a
button for example are different thimgs (jist as mouse-click and mouse-drag)..

Share this post


Link to post
Share on other sites
This article may be useful: http://www.gamedev.net/blog/355/entry-2250186-designing-a-robust-input-handling-system-for-games/

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!