Word.h
上传用户:kf1822
上传日期:2021-06-02
资源大小:2156k
文件大小:9k
源码类别:

游戏

开发平台:

Java

  1. #include <graphics.h>
  2. char shi32H[]={
  3. /* 以下是 '是' 的 32点阵黑体 字模,128 byte */
  4.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  5.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  6.   0x01,0xFF,0xFF,0x80,0x01,0x80,0x01,0x80,
  7.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  8.   0x01,0xFF,0xFF,0x80,0x01,0x80,0x01,0x80,
  9.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  10.   0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80,
  11.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  12.   0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,
  13.   0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
  14.   0x00,0x01,0x80,0x00,0x00,0x81,0x80,0x00,
  15.   0x01,0x81,0xFF,0xC0,0x01,0x81,0x80,0x00,
  16.   0x01,0xC1,0x80,0x00,0x03,0x21,0x80,0x00,
  17.   0x02,0x19,0x80,0x00,0x06,0x07,0x80,0x00,
  18.   0x0C,0x01,0xFF,0xF8,0x18,0x00,0x0F,0xF8,
  19.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  20. };
  21. char jiu32H[]={
  22. /* 以下是 '就' 的 32点阵黑体 字模,128 byte */
  23.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  24.   0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,
  25.   0x00,0xC0,0x0C,0x00,0x00,0x40,0x0C,0x40,
  26.   0x00,0x00,0x0C,0x60,0x00,0x00,0x0C,0x30,
  27.   0x3F,0xFF,0x0C,0x00,0x00,0x00,0x0C,0x00,
  28.   0x00,0x00,0x0C,0x00,0x00,0x00,0x7F,0xFC,
  29.   0x0F,0xFC,0x0D,0x80,0x0F,0xFC,0x0D,0x80,
  30.   0x0C,0x04,0x09,0x80,0x0C,0x04,0x09,0x80,
  31.   0x0C,0x04,0x09,0x80,0x0F,0xFC,0x09,0x80,
  32.   0x0F,0xFC,0x09,0x80,0x00,0x40,0x19,0x80,
  33.   0x00,0x40,0x19,0x80,0x00,0x44,0x11,0x80,
  34.   0x04,0x44,0x11,0x80,0x0C,0x42,0x31,0x80,
  35.   0x08,0x42,0x21,0x80,0x18,0x40,0x61,0x80,
  36.   0x10,0x40,0x41,0x8C,0x00,0x40,0xC1,0x8C,
  37.   0x00,0x41,0x80,0xF8,0x01,0xC1,0x00,0x70,
  38.   0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  39. };
  40. char xia32H[]={
  41. /* 以下是 '下' 的 32点阵黑体 字模,128 byte */
  42.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  43.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  44.   0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xF8,
  45.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  46.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  47.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  48.   0x00,0x03,0x00,0x00,0x00,0x03,0x1C,0x00,
  49.   0x00,0x03,0x0E,0x00,0x00,0x03,0x07,0x00,
  50.   0x00,0x03,0x03,0x80,0x00,0x03,0x01,0xC0,
  51.   0x00,0x03,0x00,0xE0,0x00,0x03,0x00,0x60,
  52.   0x00,0x03,0x00,0x40,0x00,0x03,0x00,0x00,
  53.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  54.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  55.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  56.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  57.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  58. };
  59. char yi32H[]={
  60. /* 以下是 '一' 的 32点阵黑体 字模,128 byte */
  61.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  62.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  63.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  64.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  65.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  66.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  67.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  68.   0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFC,
  69.   0x1F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,
  70.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  71.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  72.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  73.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  74.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  75.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  76.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  77. };
  78. char bai32H[]={
  79. /* 以下是 '百' 的 32点阵黑体 字模,128 byte */
  80.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  81.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  82.   0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,
  83.   0x3F,0xFF,0xFF,0xFC,0x00,0x01,0x80,0x00,
  84.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  85.   0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
  86.   0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80,
  87.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  88.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  89.   0x01,0x80,0x01,0x80,0x01,0xFF,0xFF,0x80,
  90.   0x01,0xFF,0xFF,0x80,0x01,0x80,0x01,0x80,
  91.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  92.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  93.   0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80,
  94.   0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
  95.   0x01,0x80,0x01,0x80,0x00,0x00,0x00,0x00,
  96. };
  97. char ceng32H[]={
  98. /* 以下是 '层' 的 32点阵黑体 字模,128 byte */
  99.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  100.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  101.   0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,
  102.   0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,
  103.   0x02,0x00,0x00,0x20,0x02,0x00,0x00,0x20,
  104.   0x03,0xFF,0xFF,0xE0,0x03,0xFF,0xFF,0xE0,
  105.   0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
  106.   0x02,0x00,0x00,0x00,0x02,0x1F,0xFF,0xE0,
  107.   0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
  108.   0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
  109.   0x06,0x7F,0xFF,0xFC,0x06,0x00,0xC0,0x00,
  110.   0x04,0x00,0x80,0x00,0x04,0x01,0x80,0x00,
  111.   0x0C,0x03,0x03,0x00,0x08,0x06,0x01,0x80,
  112.   0x08,0x0C,0x00,0x80,0x18,0x1C,0x00,0xC0,
  113.   0x30,0x3F,0xFF,0xE0,0x00,0x10,0x00,0x20,
  114.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  115. };
  116. char di24H[]={
  117. /* 以下是 '地' 的 24点阵华文行楷 字模,72 byte */
  118.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  119.   0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,
  120.   0x06,0x00,0x0E,0x04,0x00,0x06,0x04,0x40,
  121.   0x07,0x04,0x60,0x07,0x0C,0xC0,0x1E,0x34,
  122.   0xC0,0x3E,0x24,0xC0,0x1C,0x57,0x80,0x0C,
  123.   0x49,0x00,0x0F,0x48,0x00,0x0C,0x40,0x00,
  124.   0x38,0x00,0x0C,0x00,0x0F,0xE0,0x00,0x00,
  125.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  126.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  127. };
  128. char xia24H[]={
  129. /* 以下是 '下' 的 24点阵华文行楷 字模,72 byte */
  130.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  131.   0x00,0x00,0x00,0xC0,0x00,0x07,0xF0,0x00,
  132.   0x3F,0xE0,0x01,0xF8,0x00,0x0F,0xD8,0x00,
  133.   0x0F,0x18,0x00,0x02,0x1B,0x80,0x00,0x19,
  134.   0xC0,0x00,0x19,0x80,0x00,0x18,0x00,0x00,
  135.   0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,
  136.   0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,
  137.   0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
  138.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  139. };
  140. char ceng24H[]={
  141. /* 以下是 '层' 的 24点阵华文行楷 字模,72 byte */
  142.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
  143.   0x80,0x00,0x3F,0xC0,0x00,0x21,0x80,0x00,
  144.   0x01,0x00,0x00,0x03,0x00,0x00,0x08,0x00,
  145.   0x00,0x40,0x00,0x00,0x03,0x00,0x00,0x0E,
  146.   0x00,0x00,0x88,0x00,0x00,0x00,0xE0,0x00,
  147.   0x07,0x80,0x01,0xF2,0x00,0x00,0x44,0x80,
  148.   0x02,0x08,0x60,0x00,0x3F,0x60,0x00,0x30,
  149.   0x20,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
  150.   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  151. };
  152. void drawmat(char *mat,int matsize,int x,int y,int color)
  153. /*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
  154. {
  155.   int i, j, k, n;
  156.   n = (matsize - 1) / 8 + 1;
  157.   for(j = 0; j < matsize; j++)
  158.     for(i = 0; i < n; i++)
  159.       for(k = 0;k < 8; k++)
  160.         if(mat[j * n + i] & (0x80 >> k))  /*测试为1的位则显示*/
  161.           putpixel(x + i * 8 + k, y + j, color);
  162. }
  163. void drawMainBoard()     /* 游戏开始画面的所有字 */
  164. {
  165.     drawmat(shi32H,32,128,100,LIGHTCYAN);
  166.     drawmat(jiu32H,32,282,100,LIGHTCYAN);
  167.     drawmat(xia32H,32,330,100,LIGHTCYAN);
  168.     drawmat(yi32H,32,378,100,LIGHTCYAN);
  169.     drawmat(bai32H,32,426,100,LIGHTCYAN);
  170.     drawmat(ceng32H,32,474,100,LIGHTCYAN);
  171.     settextstyle(DEFAULT_FONT,0,4);
  172.     setcolor(LIGHTRED);
  173.     outtextxy(176,102,"Man");
  174.     settextstyle(DEFAULT_FONT,0,1);
  175.     setcolor(WHITE);
  176.     outtextxy(215,230,"Start               Exit");
  177. }
  178. void beginBack(int color[],int n)  /* 游戏开始画面的上下彩带 */
  179. {
  180.     int i;
  181.     for(i=0;i<62;i++)
  182.     {
  183.         if(i%2==1)
  184.         {
  185.             setfillstyle(1,color[n]);
  186.             bar(10+i*10,10,19+10*i,19);
  187.             setfillstyle(1,color[n-1]);
  188.             bar(10+i*10,330,19+10*i,339);
  189.         }
  190.         else
  191.         {
  192.             setfillstyle(1,color[n-1]);
  193.             bar(10+i*10,10,19+10*i,19);
  194.             setfillstyle(1,color[n]);
  195.             bar(10+i*10,330,19+10*i,339);
  196.         }
  197.     }
  198. }
  199. void changeColor(int color[],int n)    /* 彩带的颜色转换 */
  200. {
  201.     int temp;
  202.     temp=color[n];
  203.     color[n]=color[n-1];
  204.     color[n-1]=temp;
  205. }
  206. void endBoard()                /* 描绘游戏结束画面 */
  207. {
  208.     settextstyle(DEFAULT_FONT,0,2);
  209.     setcolor(LIGHTRED);
  210.     outtextxy(226,80,"Game Over !");
  211.     settextstyle(DEFAULT_FONT,0,1);
  212.     setcolor(LIGHTGREEN);
  213.     outtextxy(255,150,"One More Try ?");
  214.     settextstyle(DEFAULT_FONT,0,1);
  215.     setcolor(WHITE);
  216.     outtextxy(215,230,"Start               Exit");
  217. }
  218. void drawPrBoard(int pr) /* 记分牌 */
  219. {
  220.     char buf[10];
  221.     setfillstyle(1,GREEN);
  222.     bar(81,13,246,32);
  223.     setcolor(RED);
  224.     rectangle(81,2,246,43);
  225.     drawmat(di24H,24,97,12,BLACK);
  226.     drawmat(xia24H,24,128,12,BLACK);
  227.     drawmat(ceng24H,24,215,12,BLACK);
  228.     sprintf(buf,"%d",pr);
  229.     setcolor(RED);
  230.     settextstyle(DEFAULT_FONT,0,2);
  231.     outtextxy(160,16,buf);
  232. }
  233. void drawSpBoard()/* 生命牌 */
  234. {
  235.     char buf[11];
  236.     setfillstyle(1,GREEN);
  237.     bar(249,13,416,32);
  238.     setcolor(RED);
  239.     rectangle(249,2,416,43);
  240.     outtextxy(310,15,"Life:");
  241. }
  242. void drawLife(int live)
  243. {
  244.     int i;
  245.     setfillstyle(1,GREEN);
  246.     bar(249,13,416,32);
  247.     setcolor(RED);
  248.     rectangle(249,2,416,43);
  249.     settextstyle(DEFAULT_FONT,0,0);
  250.     outtextxy(310,15,"Life:");
  251.     for(i=0;i<live;i++)
  252.     {
  253.         setfillstyle(1,MAGENTA);
  254.         bar(253+i*17,26,253+(i+1)*16,31);
  255.     }
  256.     for(i=0;i<10;i++)
  257.     {
  258.         setcolor(DARKGRAY);
  259.         rectangle(253+i*17,26,253+(i+1)*16,31);
  260.     }
  261. }