#define LEN 15
#define NAME 2
#include<dos.h>
#include<graphics.h>
#include<conio.h>
main()
{
int oldX,oldY;
union REGS inr,outr;
struct time tim;
int dr=DETECT,gmode;
initgraph(&dr,&gmode,"c:\\TC\\");
setbkcolor(LIGHTBLUE);
inr.x.ax=3;
oldX=0;oldY=0;
setfillstyle(SOLID_FILL,RED);
while(!kbhit())
{
#define NAME 2
#include<dos.h>
#include<graphics.h>
#include<conio.h>
main()
{
int oldX,oldY;
union REGS inr,outr;
struct time tim;
int dr=DETECT,gmode;
initgraph(&dr,&gmode,"c:\\TC\\");
setbkcolor(LIGHTBLUE);
inr.x.ax=3;
oldX=0;oldY=0;
setfillstyle(SOLID_FILL,RED);
while(!kbhit())
{
int86(0x33,&inr,&outr);
gettime(&tim);
if(oldX!=outr.x.cx||oldY!=outr.x.dx)
{
gotoxy(3,2);
printf("the current time:%02d:%02d:%02d",tim.ti_hour,tim.ti_min,tim.ti_sec);
printf(" Made by ujn.lu\n\n");
printf(" %3d,%3d\n",outr.x.cx,outr.x.dx);
if(outr.x.bx==1)
{
bar(outr.x.cx-NAME,outr.x.dx-NAME,outr.x.cx+NAME,outr.x.dx+NAME);
}
if(outr.x.bx==2)
{
setfillstyle(SOLID_FILL,LIGHTBLUE);
bar(outr.x.cx-LEN,outr.x.dx-LEN,outr.x.cx+LEN,outr.x.dx+LEN);
}
}
oldX=outr.x.cx;
oldY=outr.x.dx;
gettime(&tim);
if(oldX!=outr.x.cx||oldY!=outr.x.dx)
{
gotoxy(3,2);
printf("the current time:%02d:%02d:%02d",tim.ti_hour,tim.ti_min,tim.ti_sec);
printf(" Made by ujn.lu\n\n");
printf(" %3d,%3d\n",outr.x.cx,outr.x.dx);
if(outr.x.bx==1)
{
bar(outr.x.cx-NAME,outr.x.dx-NAME,outr.x.cx+NAME,outr.x.dx+NAME);
}
if(outr.x.bx==2)
{
setfillstyle(SOLID_FILL,LIGHTBLUE);
bar(outr.x.cx-LEN,outr.x.dx-LEN,outr.x.cx+LEN,outr.x.dx+LEN);
}
}
oldX=outr.x.cx;
oldY=outr.x.dx;
}
getch();
}
getch();
}