Trouble with animation using Sleep
Okay, this is a function which is supposed to read through a list of transformations, and step through each one, with a delay of pauseTime. TransformPolygon() handles the transformations.
Actually drawing the polygon is done in WM_PAINT, and I haven't had any other problems with using InvalidateRect like this to do so.
When I test this, what happens is I have a delay (the delay is the number of transformations x pauseTime). At the end of the delay, the polygon appears where it should at the end of the animation. However, I don't see any of the intermediate steps of the animation, just the end.
I would really appreciate any insight on how to make this work. I am using DevC. Code:
void PlayMoves (int pauseTime, HWND hWnd)
{
int i;
for (i = 0; i < MoveIndex; i++)
{
TransformPolygon();
InvalidateRect (hWnd, NULL, TRUE);
Sleep(pauseTime);
}
return;
}