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

📄 hzktype.h

📁 C语言游戏编程
💻 H
字号:
void outctextxy(x_size,y_size,color,x,y,s)
int  x_size,y_size,color,x,y;
char *s;
{char mat[32];
 char *cads;
 FILE *fp;
 unsigned char qh,wh;
 unsigned long offset;
 unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
 int startx,x0,starty,y0,i,j,k,d,o,pos;
 if((fp=fopen("HZK16","rb"))==0)
 {clrscr();
  printf("The hzk16 isn't exist or can't open it!");
  exit(1);
 }
 startx=x;starty=y;cads=s;
 while(*cads!=0)
 {d=0;
  while((d<6)&&(*cads!=0))
  {qh=*cads-0xa0;
   wh=*(cads+1)-0xa0;
   offset=(94*(qh-1)+(wh-1))*32l;
	//计算字在字库中的地址
   fseek(fp,offset,SEEK_SET);
   fread(mat,32,1,fp);
   y0=starty;
   for(i=0;i<16;i++)
    for(o=0;o<y_size;o++)
    {pos=2*i;
     x0=startx;
     for(j=0;j<16;j++)
      for(k=0;k<x_size;k++)
      {if(mask[j%8]&mat[pos+j/8])
		video_buffer[((y0<<8)+(y0<<6))+x0]=color;
       x0++;
      }
     y0++;
    }
   startx+=24*x_size;
   cads+=2;
   d++;
  }
  startx=x;
  starty+=20*x_size;
 }
 fclose(fp);
}
void Coutctextxy(x_size,y_size,x,y,s)
int  x_size,y_size,x,y;
char *s;
{char mat[32];
 char *cads;
 FILE *fp;
 unsigned char qh,wh;
 unsigned long offset;
 unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
 int startx,x0,starty,y0,i,j,k,d,o,pos;
 if((fp=fopen("HZK16","rb"))==0)
 {clrscr();
  printf("The hzk16 isn't exist or can't open it!");
  exit(1);
 }
 startx=x;starty=y;cads=s;
 while(*cads!=0)
 {d=0;
  while((d<6)&&(*cads!=0))
  {qh=*cads-0xa0;
   wh=*(cads+1)-0xa0;
   offset=(94*(qh-1)+(wh-1))*32l;
	//计算字在字库中的地址
   fseek(fp,offset,SEEK_SET);
   fread(mat,32,1,fp);
   y0=starty;
   for(i=0;i<16;i++)
    for(o=0;o<y_size;o++)
    {pos=2*i;
     x0=startx;
     for(j=0;j<16;j++)
      for(k=0;k<x_size;k++)
      {if(mask[j%8]&mat[pos+j/8])
		video_buffer[((y0<<8)+(y0<<6))+x0]=rand()%100;
       x0++;
      }
     y0++;
    }
   startx+=24*x_size;
   cads+=2;
   d++;
  }
  startx=x;
  starty+=20*x_size;
 }
 fclose(fp);
}

void Ioutctextxy(x_size,y_size,color,x,y,s)
int  x_size,y_size,color,x,y;
char *s;
{char mat[32];
 char *cads;
 FILE *fp;
 unsigned char qh,wh;
 unsigned long offset;
 unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
 int startx,x0,starty,y0,i,j,k,d,o,pos;
 if((fp=fopen("HZK16","rb"))==0)
 {clrscr();
  printf("The hzk16 isn't exist or can't open it!");
  exit(1);
 }
 startx=x;starty=y;cads=s;
 while(*cads!=0)
 {d=0;
  while((d<6)&&(*cads!=0))
  {qh=*cads-0xa0;
   wh=*(cads+1)-0xa0;
   offset=(94*(qh-1)+(wh-1))*32l;
	//计算字在字库中的地址
   fseek(fp,offset,SEEK_SET);
   fread(mat,32,1,fp);
   y0=starty;
   for(i=0;i<16;i++)
    for(o=0;o<y_size;o++)
    {pos=2*i;
     x0=startx;
     for(j=0;j<16;j++)
      for(k=0;k<x_size;k++)
      {if(mask[j%8]&mat[pos+j/8])
		video_buffer[((y0<<8)+(y0<<6))+x0+16-i]=color;
       x0++;
      }
     y0++;
    }
   startx+=24*x_size;
   cads+=2;
   d++;
  }
  startx=x;
  starty+=20*x_size;
 }
 fclose(fp);
}


void Boutctextxy(x_size,y_size,color,x,y,s)
int  x_size,y_size,color,x,y;
char *s;
{char mat[32];
 char *cads;
 FILE *fp;
 unsigned char qh,wh;
 unsigned long offset;
 unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
 int startx,x0,starty,y0,i,j,k,d,o,pos;
 if((fp=fopen("HZK16","rb"))==0)
 {clrscr();
  printf("The hzk16 isn't exist or can't open it!");
  exit(1);
 }
 startx=x;starty=y;cads=s;
 while(*cads!=0)
 {d=0;
  while((d<6)&&(*cads!=0))
  {qh=*cads-0xa0;
   wh=*(cads+1)-0xa0;
   offset=(94*(qh-1)+(wh-1))*32l;
	//计算字在字库中的地址
   fseek(fp,offset,SEEK_SET);
   fread(mat,32,1,fp);
   y0=starty;
   for(i=0;i<16;i++)
    for(o=0;o<y_size;o++)
    {pos=2*i;
     x0=startx;
     for(j=0;j<16;j++)
      for(k=0;k<x_size;k++)
      {if(mask[j%8]&mat[pos+j/8])
      {
		video_buffer[((y0<<8)+(y0<<6))+x0]=color;
		video_buffer[((y0<<8)+(y0<<6))+x0+1]=color;
      }
       x0++;
      }
     y0++;
    }
   startx+=24*x_size;
   cads+=2;
   d++;
  }
  startx=x;
  starty+=20*x_size;
 }
 fclose(fp);
}

⌨️ 快捷键说明

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