c++ gdi animation problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ramilol
    New Member
    • Aug 2010
    • 14

    #1

    c++ gdi animation problem

    ok so i have problem using gdi to create a animation
    i have this code but it creates that creates a circle than it update its location so if like x = 1 it will be x = 2... that works file but when i try to clear what was painted and repaint it that doesn't work so it creates mroe than one circle with different locations(x).
    here is the code for that creates the cricle
    Code:
    VOID onPaint(HDC hdc)
    {
       Graphics graphics(hdc);
       Pen      pen(Color(255, 0, 0, 255));
       graphics.DrawEllipse(&pen,sf , 0, 50, 50);//sf is globale varabile
    }
    and here is the update code
    Code:
    		while(sd==1)
    		{
    			sf++;
    			onPaint(hdc);
    			InvalidateRect (hWnd, NULL, TRUE);
    		}
    i thought that InvalidateRect would earse/delete everything that was painted and repaint what should be paint but it didn't please help me thanks in adavance
Working...