• Advertisement

Archived

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

Getting Input

This topic is 5206 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
Checking for input every frame is pretty standard; are you using Direct Input?

_______________________________________
Understanding is a three edged sword...

Have your independent game reviewed by your peers on the www.FreelanceGames.com review ladder.

Share this post


Link to post
Share on other sites
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