My programm is to fast...help :)

I write a little tetris clone…(i wanted to make something new )…i use the openGL api and the MS vc++6 compiler.
The problem: My programm is way to fast, when i hit the downkey the block i falling down instantly… so, how do i get my programm to make what i want

thx

Well, you have to make the image content time-dependant, not frame-number-dependant. If you are developing in Win32 try looking into QueryPerformanceCounter or the like. Then, say, any block would move a certain way in a second. This will make the blocks always move at the same speed, even if others will have another frame rate.

Or simply insert this between frames …

{
unsigned long timeDelay = 1000; // msecs
Sleep(timeDelay);
}

Methinks the call to sleep is the best solution

//init timer
long timer = GetTickCount();

your loop:

if (GetTickCount() - timer >= 1000) // 1 sec delay
{
// do your funky code
timer = GetTickCount(); //reset timer for next run
}

simple but works, this can be inacurate at times there is a higher resolution timer you may want to look into.

Dont use Sleep(); as that will halt the entire process at that point.