ra4king
According to a game programming framework algorithm book that I read, it uses a class named as KeyRepeater to control the occurrence of inputs and delay from first key input to the next consecutive key repeats (holding the key). It would sleep for a time between an input to another. The main game loop thread sleeps for a fixed time like 20 millisec.
I implemented this key repeater class to my code, but it wouldn’t match with my main game loop. The code I have right now is doing what you said. I added some counter variables and if’s to implement key delay from first input.
philfrei
I was wondering if synchronization was what I was missing. I definitely have to read into that.
Eli Delventhal
Thanks for sharing a code. I did that with Queue.
Everyone, thanks for comments.