p[i][0]=pt.x;
p[i][1]=pt.y;
setcolor(4);
line(p[i-1][0],p[i-1][1],pt.x,pt.y);
setcolor(color);
}
setcolor(4);
line(pt.x,pt.y,p[0][0],p[0][1]);
setcolor(color);
getch();
closegraph();
}
/*initgraphics*/
void initgr(void)
{int driver=DETECT,mode=0;
initgraph(&driver,&mode,"");
setbkcolor(bkcolor);
setcolor(color);
setlinestyle(linetype,0,linewidth);
mx=getmaxx();
my=getmaxy();
}
/*Draw lines*/
struct get_point cursor(int tag)
{static int step=1;
unsigned key=13;
setwritemode(1);
line(0,cy,mx,cy);
line(cx,0,cx,my);
if(tag==1) line(pt.x,pt.y,cx,cy);
key=getch();
while(key!=ENTER)
{switch(key)
{case DOWN:line(0,cy,mx,cy);
if (tag==1) line(pt.x,pt.y,cx,cy);
cy+=step;
if (cy>my) cy=my;
line(0,cy,mx,cy);
if(tag==1) line(pt.x,pt.y,cx,cy);
break;
case UP: line(0,cy,mx,cy);
if (tag==1) line(pt.x,pt.y,cx,cy);
cy-=step;
if (cy<0) cy=0;
评论0
最新资源