⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mouse.h

📁 仙剑演示版源代码
💻 H
字号:
# define MOUSE         0x33
# define ARROWCOLOR    15
# define BACKCOLOR     135

/* The shape of the arrow */
BYTE arrow[20][20]=
         {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
          0,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,
          0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
/*
BYTE arrow[20][20]=
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
          0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,
          0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,
          0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,
          0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,
          0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,
          0,0,1,0,1,0,1,1,1,1,1,1,1,1,0,1,0,1,0,0,
          0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,
          0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
          0,0,1,0,0,0,4,0,0,0,0,0,0,4,0,0,0,1,0,0,
          0,1,0,0,0,4,4,4,0,0,0,0,4,4,4,0,0,0,1,0,
          0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
          0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,
          0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,
          0,1,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,1,0,
          0,0,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,1,0,
          0,0,0,1,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,
          0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
          0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0};
*/
void hline(int start_x,int end_x,int y,unsigned char color)
{
  int x;
  for (x=start_x;x<end_x+1;x++) pset(x,y,color);
}
void vline(int start_y,int end_y,int x,unsigned char color)
{
  int y;
  for (y=start_y;y<end_y+1;y++) pset(x,y,color);
}
void drawbar(int left,int top,int right,int bottom,unsigned char color)
{
  hline(left,right,top,color);
  hline(left,right,bottom,color);
  vline(top,bottom,left,color);
  vline(top,bottom,right,color);
}
void fill(int left,int top,int right,int bottom,unsigned char color)
{
  int x,y;
  for (y=top;y<bottom+1;y++)
      hline(left,right,y,color);
}
void drawarrow(int x,int y,BYTE color)
{
  int xx,yy;
  for (yy=0;yy<20;yy++)
     for (xx=0;xx<20;xx++)
        if (arrow[yy][xx]) pset(x+xx,y+yy,color);
}
void getpic(int x,int y,BYTE *buf)
{
  int xx,yy;
  for(yy=0;yy<20;yy++)
     for(xx=0;xx<20;xx++)
        *(buf++)=point(x+xx,y+yy);
}
void putpic(int x,int y,BYTE *buf)
{
  int xx,yy;
  for(yy=0;yy<20;yy++)
     for(xx=0;xx<20;xx++)
        pset(x+xx,y+yy,*(buf++));
}
/* Hide the mouse arrow */
void hide()
{
  putpic(nowx,nowy,*buf);
}
/* Show the mouse arrow */
void show()
{
  getpic(nowx,nowy,*buf);
  drawarrow(nowx,nowy,10);
}

int MouseState()
{
  union REGS regs;
  regs.x.ax = 3;
  int86(MOUSE, &regs, &regs);
  return(regs.x.bx);
}
void Set_Range(int start_x,int start_y,int end_x,int end_y)
{
  union REGS r;
  r.x.ax=7;
  r.x.cx=start_x;
  r.x.dx=end_x;
  int86(0x33,&r,&r);
  r.x.ax=8;
  r.x.cx=start_y;
  r.x.dx=end_y;
  int86(MOUSE,&r,&r);
}
void Mouse_Reset()
{
  union REGS regs;
  regs.x.ax = 0;
  int86(MOUSE, &regs, &regs);
  if (! regs.x.ax)
  {
     printf("Mousedriver not installed.");
     exit(0);
  }
  Set_Range(0,0,319,199);
}
void Get_XY(int *x,int *y)
{
  union REGS ireg,oreg;
  ireg.x.ax=3;
  int86(MOUSE,&ireg,&oreg);
  *x=oreg.x.cx;
  *y=oreg.x.dx;
}
void Set_XY(int x,int y)
{
  union REGS ireg;
  ireg.x.ax=4;
  ireg.x.cx=x;
  ireg.x.dx=y;
  int86(MOUSE,&ireg,&ireg);
}

/* Waiting for releasing the mouse button */
void waitmouse()
{
  while(MouseState());
  Set_XY(nowx,nowy);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -