My problem is that the game reacts so damn fast to my input, rotating the pieces so I can barely see them.
My attempt to correct it is the little if statement / counter you see in the begining - which i can probably tune to work fine....but then it wont work the same ways on other systems, that run faster or slower....
Any advice on how to handle input to make it...less....responsive? :P
btw, the inputDevice is a DInput device.

Now Sleep(1) does not guarantee a delay of 1ms so you might want to look at doing something else to slow it down but i would recommend slow though because it means if the USER is running any other programs that need resources the CPU is available.

Now this is important for sum1 running winamp in the background or stuff like that :-)

Share this post

Link to post

Share on other sites

Original post by Red_falconDo you use timer? Secondly, you decide how fast to render/animate the rotation. Check your routines

Consider the GAME MECHANICS of rotation and the RENDERING seperate, where once the button is pressed in GAME MECHANICS the object is rotated immediately(obviously the correct checks have been done) and then when rendering simple integrate it like this.

// Where RotateT is a float between 0 -- 1.0 where 1.0 is 100% to target

Share this post

Link to post

Share on other sites

There's no need to limit fps, you should just have a Input class which handle the keyboard state buffer, then define a KeyDown () function, which checks to see if user just pressed the button down. The code is similar to this:

* Assume you're using GetKeyboardState (), if you're using Windows messages, the following is still applicable:

Share this post

Link to post

Share on other sites

Are you doing what Skeleton_V@T is suggesting, and checking to see if the key has just been pressed?

If you hold down the rotate button, does the block keep rotating? Or do you have to let go of the button and press it again to rotate the block a 2nd time?

You probably want it to work like that. So when the rotate button key is pressed down, set a flag to mark it as being pressed. Every frame, check if its still down. If it's not, then remove the flag. If it IS down and the flag is not marked, don't do anything....otherwise, set the flag and rotate again.