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

📄 !best003.c

📁 supplementary source file 1 for The BESTLibrary
💻 C
📖 第 1 页 / 共 2 页
字号:
  flength = datalength[choice] + BORDERTHICKNESS * 2,
  fheight = height + BORDERTHICKNESS * 2 + INNERYSPACE * 2;
  _16_i_save(bgx, bgy, flength, fheight, bg, FALSE, TRUE);
  if (data[choice][1]) {
    b = bgx - BORDERTHICKNESS * 2;
    _16_i_save(b, bgy, BORDERTHICKNESS, fheight, bg2, FALSE, TRUE);
    for (i = 0; i < BORDERTHICKNESS; i++)
      _16_boxoutline(b + i, bgy + i, flength - i - i + BORDERTHICKNESS, fheight - i - i, BORDERCOLOR, COPY_IMAGE);
    _16_boxfill(b + i, bgy + BORDERTHICKNESS, flength - i, fheight - BORDERTHICKNESS * 2, BLACK, COPY_IMAGE);
    floodfill(b + i, bgy + BORDERTHICKNESS, BORDERCOLOR);
    _16_i_show(b, bgy, bg2, COPY_IMAGE);

    b = barx + barlength + BORDERTHICKNESS + INTERSPACE / 2;
    for (i = 0, ii = 0x0001; i < data[choice][0]; i++, ii = ii << 1) {
      if (ii & (unsigned int)data[choice][2])
        setcolor(TEXTCOLOR);
      else
        setcolor(INACTIVECOLOR);
      outtextxy(b, bary - 1, text[ data[choice][1] + i ]);
      b += textwidth(text[ data[choice][1] + i ]) + INTERSPACE;
    }
  }
  a = barx, bx = barlength;
  if (ms) {
    msdata.pos[0] = msdata.npos[0] = MAXX / 2,
    msdata.pos[1] = msdata.npos[1] = MAXY / 2;
    ms_set(msdata.pos[0], msdata.pos[1]);
  }
 while (TRUE)
 {
  _16_boxfill(barx, bary, barlength, height, BARCOLOR, XOR_IMAGE);
  key.ascii = key.scan = 0;
  if (ms) while (TRUE) {
    if (keyhit()) {
      getchr();
      break;
    }
    ms_stat();
    if (msdata.buts[0] != msdata.nbuts[0]) {
      msdata.buts[0] = msdata.nbuts[0];
      if (!msdata.nbuts[0]) {
        key.ascii = 13;
        break;
      }
    }
    if (msdata.buts[1] != msdata.nbuts[1]) {
      msdata.buts[1] = msdata.nbuts[1];
      if (!msdata.nbuts[1]) { key.ascii = 27; break; }
    }
    if (abs(length = msdata.npos[0] - msdata.pos[0]) > 40) {
      if (length > 0) key.scan = 'M';
      else key.scan = 'K';
      msdata.pos[0] = msdata.npos[0] = MAXX / 2,
      msdata.pos[1] = msdata.npos[1] = MAXY / 2;
      ms_set(msdata.pos[0], msdata.pos[1]);
      break;
    }
    if (abs(length = msdata.npos[1] - msdata.pos[1]) > 10) {
      if (length > 0) key.scan = 'P';
      else key.scan = 'H';
      msdata.pos[0] = msdata.npos[0] = MAXX / 2,
      msdata.pos[1] = msdata.npos[1] = MAXY / 2;
      ms_set(msdata.pos[0], msdata.pos[1]);
      break;
    }
  }
  else
    getchr();
  _16_boxfill(barx, bary, barlength, height, BARCOLOR, XOR_IMAGE);
  if (key.ascii == 9 || key.ascii == 13 || key.ascii == 27) {
    if (key.ascii == 9 || key.ascii == 27)
      choice = -1, choicex = 0;
    break;
  }                          // 'H' = 1, 'K' = 2, 'M' = 3, 'P' = 4
  if (key.scan == 'H') {
    barx = a, barlength = bx, choicex = 0;
    if (--choice < 0) choice = maxmenus - 1, bary = texty + height * (maxmenus - 1);
    else bary -= height;

    for (i = ii = 1; i < choice + 1; i++) ii = ii << 1;
    for (i = 0; ; i++) {
      if (ii & (unsigned int)text[0]) break;
      if (--choice < 0) {
        choice = maxmenus - 1,
        bary = texty + height * choice;
        for (i = ii = 1; i < maxmenus; i++) ii = ii << 1;
        i = 0;
        continue;
      }
      else bary -= height, ii = ii >> 1;
    }
    _16_i_show(bgx, bgy, bg, COPY_IMAGE);
    _16_boxfill(bgx - BORDERTHICKNESS, bgy, BORDERTHICKNESS, fheight, BORDERCOLOR, COPY_IMAGE);
    if (data[choice][1]) {
      bgx = barx + barlength + BORDERTHICKNESS,
      bgy = bary - BORDERTHICKNESS - INNERYSPACE,
      flength = datalength[choice] + BORDERTHICKNESS * 2;
      _16_i_save(bgx, bgy, flength, fheight, bg, FALSE, TRUE);
      b = bgx - BORDERTHICKNESS * 2;
      _16_i_save(b, bgy, BORDERTHICKNESS, fheight, bg2, FALSE, TRUE);
      for (i = 0; i < BORDERTHICKNESS; i++)
        _16_boxoutline(b + i, bgy + i, flength - i - i + BORDERTHICKNESS, fheight - i - i, BORDERCOLOR, COPY_IMAGE);
      _16_boxfill(b + i, bgy + BORDERTHICKNESS, flength - i, fheight - BORDERTHICKNESS * 2, BLACK, COPY_IMAGE);
      floodfill(b + i, bgy + BORDERTHICKNESS, BORDERCOLOR);
      _16_i_show(b, bgy, bg2, COPY_IMAGE);

      b = barx + barlength + BORDERTHICKNESS + INTERSPACE / 2;
      for (i = 0, ii = 0x0001; i < data[choice][0]; i++, ii = ii << 1) {
        if (ii & (unsigned int)data[choice][2])
          setcolor(TEXTCOLOR);
        else
          setcolor(INACTIVECOLOR);
        outtextxy(b, bary - 1, text[ data[choice][1] + i ]);
        b += textwidth(text[ data[choice][1] + i ]) + INTERSPACE;
      }
    }
    choicex = 0;
  }
  else if (key.scan == 'P') {
    barx = a, barlength = bx, choicex = 0;
    if (++choice == maxmenus) choice = 0, bary = texty;
    else bary += height;

    for (i = ii = 1; i < choice + 1; i++) ii = ii << 1;
    for (i = 0; ; i++) {
      if (ii & (unsigned int)text[0]) break;
      if (++choice == maxmenus) {
        choice = 0, bary = texty, ii = 1, i = 0;
        continue;
      }
      else bary += height, ii = ii << 1;
    }
    _16_i_show(bgx, bgy, bg, COPY_IMAGE);
    _16_boxfill(bgx - BORDERTHICKNESS, bgy, BORDERTHICKNESS, fheight, BORDERCOLOR, COPY_IMAGE);
    if (data[choice][1]) {
      bgx = barx + barlength + BORDERTHICKNESS,
      bgy = bary - BORDERTHICKNESS - INNERYSPACE,
      flength = datalength[choice] + BORDERTHICKNESS * 2;
      _16_i_save(bgx, bgy, flength, fheight, bg, FALSE, TRUE);
      b = bgx - BORDERTHICKNESS * 2;
      _16_i_save(b, bgy, BORDERTHICKNESS, fheight, bg2, FALSE, TRUE);
      for (i = 0; i < BORDERTHICKNESS; i++)
        _16_boxoutline(b + i, bgy + i, flength - i - i + BORDERTHICKNESS, fheight - i - i, BORDERCOLOR, COPY_IMAGE);
      _16_boxfill(b + i, bgy + BORDERTHICKNESS, flength - i, fheight - BORDERTHICKNESS * 2, BLACK, COPY_IMAGE);
      floodfill(b + i, bgy + BORDERTHICKNESS, BORDERCOLOR);
      _16_i_show(b, bgy, bg2, COPY_IMAGE);

      b = barx + barlength + BORDERTHICKNESS + INTERSPACE / 2;
      for (i = 0, ii = 0x0001; i < data[choice][0]; i++, ii = ii << 1) {
        if (ii & (unsigned int)data[choice][2])
          setcolor(TEXTCOLOR);
        else
          setcolor(INACTIVECOLOR);
        outtextxy(b, bary - 1, text[ data[choice][1] + i ]);
        b += textwidth(text[ data[choice][1] + i ]) + INTERSPACE;
      }
    }
    choicex = 0;
  }
  else if (key.scan == 'K') { if (data[choice][1]) {
    switch(choicex) {
     case 0:
      _16_boxfill(bgx - BORDERTHICKNESS, bgy, BORDERTHICKNESS, fheight, BORDERCOLOR, COPY_IMAGE);
     case 1:
      choicex = data[choice][0],
      barx = a + bx + BORDERTHICKNESS + datalength[choice] - textwidth(text[ data[choice][1] + choicex - 1 ]) - INTERSPACE;
      break;
     default:
      choicex--,
      barx -= textwidth(text[ data[choice][1] + choicex - 1 ]) + INTERSPACE;
    }
    for (i = ii = 1; i < choicex; i++)
      ii = ii << 1;
    for (b = i = 0; b != data[choice][0]; i++, b++) {
      if (ii & (unsigned int)data[choice][2]) break;
      if (--choicex < 1) {
        choicex = data[choice][0],
        barx = a + bx + BORDERTHICKNESS + datalength[choice] - textwidth(text[ data[choice][1] + choicex - 1 ]) - INTERSPACE;
        for (i = ii = 1; i < data[choice][0]; i++) ii = ii << 1;
        i = 0;
        continue;
      }
      else
        ii = ii >> 1,
        barx -= textwidth(text[ data[choice][1] + choicex - 1 ]) + INTERSPACE;
    }
    if (b == data[choice][0])
      barx = a, barlength = bx, choicex = 0;
    else
      barlength = textwidth(text[ data[choice][1] + choicex - 1 ]) + INTERSPACE;
  } }
  else if (key.scan == 'M') if (data[choice][1]) {
    if (!choicex) {
       _16_boxfill(bgx - BORDERTHICKNESS, bgy, BORDERTHICKNESS, fheight, BORDERCOLOR, COPY_IMAGE);
       choicex = 0, barx = a + bx + BORDERTHICKNESS;
    }
    else if (choicex == data[choice][0])
      choicex = 0, barx = a + bx + BORDERTHICKNESS;
    else
      barx += textwidth(text[ data[choice][1] + choicex - 1 ]) + INTERSPACE;

    for (i = ii = 1; i < choicex + 1; i++)
      ii = ii << 1;
    for (b = i = 0; b != data[choice][0]; i++, b++) {
      if (ii & (unsigned int)data[choice][2]) break;
      if (++choicex == data[choice][0]) {
        choicex = 0, barx = a + bx + BORDERTHICKNESS,
        ii = 0x0001, i = 0;
        continue;
      }
      else
        ii = ii << 1,
        barx += textwidth(text[ data[choice][1] + choicex - 1 ]) + INTERSPACE;
    }
    if (b == data[choice][0])
      barx = a, barlength = bx, choicex = 0;
    else
      barlength = textwidth(text[ data[choice][1] + choicex++ ]) + INTERSPACE;
  }
 }
  _16_i_show(x, y, menubg, COPY_IMAGE);
  _16_i_show(bgx, bgy, bg, COPY_IMAGE);
  free(menubg);
  free(bg2);
  free(bg);
  return(choicex | (++choice << 4));
}

/*==============================  END-OF-FILE  =============================*/

⌨️ 快捷键说明

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