Jump to content
  • Advertisement
Sign in to follow this  
BooyaCS

MFC Help

This topic is 5403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!