Getting Input
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
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...
Have your independent game reviewed by your peers on the www.FreelanceGames.com review ladder.
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement