Getting Input

Started by
4 comments, last by JoHnOnIzEr 20 years, 3 months ago
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
Sidra Headquarters
Game engine is currently at version 0.9.8! Currently Down
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.
_______________________________________Understanding is a three edged sword...Freelance Games - Home of XBLIG Starchonwww.FreelanceGames.com
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
Thanks invader, thats just what I needed. ^-^
Sidra Headquarters
Game engine is currently at version 0.9.8! Currently Down
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.
Why bother writing it with DirectInput when win32 already does it?

This topic is closed to new replies.

Advertisement