#include <stdio.h>
#include <dos.h>
#include <graphics.h>
union REGS regs;
int init();
int read();
void cursor(),newxy(),draw();
int xmin,xmax,ymin,ymax,x_max=639,y_max=479;
main()
{
int buttons,xm,ym,x0,y0,x,y;
char str[100];
int driver=VGA;
int mode=VGAHI;
initgraph(&driver,&mode,"D:\\tc");
rectangle(0,0,x_max,y_max);
setfillstyle(SOLID_FILL,BLUE);
bar(1,1,x_max-1,y_max-1);
outtextxy(3,15,"move mouse using any button.");
setfillstyle(1, RED);
bar(280, 12, 330, 33);
outtextxy(285,15,"quit");
bar(340, 12, 390, 33);
setfillstyle(SOLID_FILL,BLUE);
outtextxy(345,15,"clear");
xmin=2;
xmax=x_max-1;
ymin=8;
ymax=y_max-2;
setwritemode(XOR_PUT);
if(init(xmin,xmax,ymin,ymax)==0 )
{
printf("Mouse or Mouse Driver Absent,P1ease install!");
delay(5000);
exit(1);
}
x=320;
y=240;
cursor(x,y);
for(;;)
{
newxy(&x,&y,&buttons);
if(x>=280&& x<=330 &&y>=12&&y<=33&& buttons)
{
cleardevice();
exit(0);
}
if(x>=340 && x<=390 && y>=12 && y<=33 && buttons)
{
rectangle(0,0,x_max,y_max);
setfillstyle(SOLID_FILL,BLUE);
bar(1,1,x_max-1,y_max-1);
outtextxy(3,15,"move mouse using any button.");
setfillstyle(1, RED);
bar(280, 12, 330, 33);
outtextxy(285,15,"quit");
bar(340, 12, 390, 33);
outtextxy(345,15,"clear");
setfillstyle(SOLID_FILL,BLUE);
xmin=2;
xmax=x_max-1;
ymin=8;
ymax=y_max-2;
setwritemode(XOR_PUT);
if(init(xmin,xmax,ymin,ymax)==0 )
{
printf("Mouse or Mouse Driver Absent,P1ease install!");
delay(5000);
exit(1);
}
x=320;
y=240;
cursor(x,y);
}
}
}