Archived

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

JoHnOnIzEr

Getting Input

Recommended Posts

JoHnOnIzEr    146
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
Colin Jeanne    1114
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
psykr    295
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