Jump to content
  • Advertisement
Sign in to follow this  
QuackCoder

Writing an Input class

This topic is 2636 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!