Jump to content
  • Advertisement

Archived

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

JoHnOnIzEr

Getting Input

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

How many times a second should you check for input in a 2d tile-based game? Currently ive been checking every frame but now that im working on getting text input, checking every frame doesn''t work too well ;x

Share this post


Link to post
Share on other sites
Advertisement
When I was playing with DirectInput and I wanted to create a control to get text input I made sure to remember the current state of the keys and the last state of the keys. Using this I can act on both keydown and keyup events:

Keydown:
Execute if the key''s current state is down AND if the last state was up

Keyup:
Execute if the key''s current state is up AND if the last state was down

Or, if you prefer only on a change in the key''s state:
Execute if the key''s current state != the last state


Colin Jeanne | Invader''s Realm

Share this post


Link to post
Share on other sites
IMO, using Windows messages for text input like that is easier than DirectInput. I haven''t tried buffered input though, that might work just as well for you.

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!