How can I save the first coordinate oldx & oldy, while I'm still
moving around with the mouse.
I need to hold down the left button and then drag the mousecursor to another point, and when I release the left button I should draw a line from the first point I was at, to the last point.
Where the cursor is now...
Gugge
-----------------------------------code:
case ST_DRAW_LINE:
while(1)
{
while(popMouseEvent(p, &event, &button, &x, &y, &xcount, &ycount))
{
int oldx = x; int oldy = y;
if((button & 0x01) == 0x01)
{
setcolor(YELLOW);
line(oldx,oldy,x,y);
}
if(event == 4)
{
outtextxy (50,35, "LINE: Left button up");
line(oldx,oldy,x,y);
goto out2;
}
}
}
out2:
menustate = ST_INACTIVE;
break;