Reputation: 81
I want to update the window (Delete the previous drawing) and redraw using the new values of x2,y2. I get x2 and y2 from a camera and they are hand coordinates, I want to draw the ellipse based on new values of the hand coordinates. How can i do that?
I tried to call Invalidate(), RedrawWindow() and UpdateWindow(), but none of them seem to work. Following is a chunk of my code.
int x2,y2 // Global Variables (used to store coordinates of the hand)
void GesturePipe()
{
x2=Hand.Coordinate.x;
y2=Hand.Coordinate.y;
// I get x2,y2 from a camera
}
void CLesson1View::OnDraw(CDC* pDC)
{
while(1)
{
GesturePipe();
CLesson1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
COLORREF colorCircle= RGB(255,0,0);
pDC->Ellipse(0,0,(int) x2,(int) y2);
//I intend to draw the skeleton of the hands so i would draw five lines,which will get updated with each frame
Invalidate(TRUE);
UpdateWindow();
}
}
Upvotes: 0
Views: 1411
Reputation: 15355
Maybe you should first read some standard tutorials how Windows Input and drawing works.
Upvotes: 1