MFC Help

Started by
1 comment, last by BooyaCS 19 years, 6 months ago
I have a little test MFC application that I need some help with. What i am trying to do is render 3 rectangles on the screen at the same location. They are of 3 different sizes. My question is how do i put these rectangles on a "timer" where I alternate between them 1 every second and then repeat after the first one? Everytime i try it seems to die and not work right.
Advertisement
There are many ways to do this. One would be for example, to let the whole program run in an "endless" (till the program terminates) loop and use the current frame count as a timer for the rotation, as an angel for example. To alter between the Rectangles, you could for example store when the certain rectangle was rotated the last time and simply check each frame if it is time again to rotate that one :)

Do you have the code for your program? maybe posting it here might help solve this issue
-----------------Live for the LordRide for the Lordwww.sturmnacht.de.vu
Right now the code i am using is

while(true)
{
pDC->SelectStockObject(GRAY_BRUSH);
pDC->Rectangle(CRect(30, 50, 200, 100));
pDC->Rectangle(CRect(30, 50, 400, 100));
pDC->Rectangle(CRect(30, 50, 300, 100));
pDC->SelectStockObject(GRAY_BRUSH);
}

and that dies because it rewrites over each rectangle. I need to draw a rectangle, delete it, draw a new one delete it and repeat.

i was thinking a switch statement but I am stumped on that part

This topic is closed to new replies.

Advertisement