Пример #1
0
static void box(int filled, int x, int y, int wid, int hei, W_Color color)
{
  if (wid == 0)
    return;

  if (filled)
    {
      /* XFIX */
      W_FillArea(statwin, x, y, wid + 1, hei + 1, color);
      return;
    }

  W_MakeLine(statwin, x, y, x + wid, y, color);
  W_MakeLine(statwin, x + wid, y, x + wid, y + hei, color);
  W_MakeLine(statwin, x + wid, y + hei, x, y + hei, color);
  W_MakeLine(statwin, x, y + hei, x, y, color);
}
Пример #2
0
void
drawIcon(void)
{
    if (!iconified) {
	me_messages = 0;
	team_messages = 0;
	all_messages = 0;
    }
	iconified = 1;
    if (!infoIcon) {
        W_DrawImageNoClip(iconWin, 0, 0, 0, getImage(I_ICON), W_White);
    } else {			/* code for information icon 1/15 [BDyess] */
	int     side, bottom, top, digits, x, i;
	char    buf[50];
	W_Image *iconimage = getImage(I_ICON);

	W_ClearWindow(iconWin);
	side = iconimage->width / number_of_teams;
	bottom = 0 + side;
	top = 0;
	W_MakeLine(iconWin, 0, bottom, iconimage->width,bottom,W_White);
	for (i = 0; i <= number_of_teams; i++) {	/* draw the vertical
							   lines */
	    x = i * side;
	    x = (x > iconimage->width) ? iconimage->width : x;
	    W_MakeLine(iconWin, x, bottom, x, top, W_White);
	}
	for (i = 0; i < number_of_teams; i++) {
	    sprintf(buf, "%d", numShips(i));
	    digits = strlen(buf);
	    W_WriteText(iconWin, i * side + side / 2 - digits * W_Textwidth / 2,
			bottom - side / 2 - W_Textheight / 2,
			shipCol[i + 1], buf, digits, W_RegularFont);
	}
	if (me->p_status == PALIVE) {
#define TOP iconimage->height-10
	    if (me->p_flags & PFGREEN)
		W_FillArea(iconWin, 0, TOP, iconimage->width,
			   iconimage->height, W_Green);
	    else if (me->p_flags & PFYELLOW)
		W_FillArea(iconWin, 0, TOP,
			   iconimage->width, iconimage->height,
			   W_Yellow);
	    else if (me->p_flags & PFRED)
		W_FillArea(iconWin, 0, TOP,
			   iconimage->width, iconimage->height,
			   W_Red);
	}
	if (me_messages) {
	    sprintf(buf, "Personal: %d", me_messages);
	    W_WriteText(iconWin, 1, bottom + 2, W_White, buf, strlen(buf),
			W_RegularFont);
	}
	if (team_messages) {
	    sprintf(buf, "Team:     %d", team_messages);
	    W_WriteText(iconWin, 1, bottom + 2 + W_Textheight, W_White, buf,
			strlen(buf), W_RegularFont);
	}
	if (all_messages) {
	    sprintf(buf, "All:      %d", all_messages);
	    W_WriteText(iconWin, 1, bottom + 2 + 2 * W_Textheight, W_White, buf,
			strlen(buf), W_RegularFont);
	}
	if (me->p_status == POUTFIT) {
	    sprintf(buf, "Time left: %d", autoQuit - elapsed);
	    W_WriteText(iconWin, 1, bottom + 2 + W_Textheight, W_White, buf,
			strlen(buf), W_RegularFont);
	}
    }
}
Пример #3
0
static void
        db_bar(char *l, int x, int y, int w, int h, int m, int t, int v, int b)
{
  int     i, hgt, val_pix, tmax_pix, yellow_pix, red_pix;
  int     label_len;
  char    label[32];


  W_ClearArea(tstatw, x, y, w, h);

  if (b)
    {
      val_pix = (w * v) / m;
    }
  else
    {
      val_pix = (w * (m - v)) / m;
    }

  tmax_pix = (w * t) / m;
  yellow_pix = w / 3;
  red_pix = (2 * w) / 3;

  if ((t < 0) ||
      (t > m) ||
      (v < 0) ||
      (v > m))
    {
      W_FillArea(tstatw, x, y, w, h, W_Red);

      W_MaskText(tstatw,
     x + w - (3 * W_Textwidth) - 2,
     y + h - W_Textheight - 2,
     W_White, l, 3, W_BoldFont);

      label_len = db_itoa(label, v);

      W_MaskText(tstatw,
     x, y,
     W_White, label, label_len, W_BoldFont);

      label_len = db_itoa(label, t);

      if (t == m)
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_Grey, label, label_len, W_RegularFont);
  }
      else
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_White, label, label_len, W_RegularFont);
  }
    }
  else
    {
      for (i = 0; i < w; i++)
  {
    hgt = h - ((h * i) / w);

    if ((i >= tmax_pix) && (i % 2))
      {
        W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Grey);
      }
    else if (i <= val_pix)
      {
        if (i < yellow_pix)
    {
      W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Green);
    }
        else if (i < red_pix)
    {
      W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Yellow);
    }
        else
    {
      W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Red);
    }
      }
  }

      if (b ? (v > (m / 2)) : (v < (m / 2)))
  {
    W_MaskText(tstatw,
         x + w - (3 * W_Textwidth) - 2,
         y + h - W_Textheight - 2,
         W_White, l, 3, W_RegularFont);
  }
      else
  {
    W_MaskText(tstatw,
         x + w - (3 * W_Textwidth) - 2,
         y + h - W_Textheight - 2,
         W_Grey, l, 3, W_RegularFont);
  }

      label_len = db_itoa(label, v);

      if (b ? (v > (m / 2)) : (v < (m / 2)))
  {
    W_MaskText(tstatw,
         x, y,
         W_White, label, label_len, W_BoldFont);
  }
      else
  {
    W_MaskText(tstatw,
         x, y,
         W_Grey, label, label_len, W_BoldFont);
  }

      label_len = db_itoa(label, t);

      if (t == m)
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_Grey, label, label_len, W_RegularFont);
  }
      else
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_White, label, label_len, W_RegularFont);
  }
    }

  W_MakeLine(tstatw, x, y + h, x + w, y + h, W_Grey);
  W_MakeLine(tstatw, x + w, y, x + w, y + h, W_Grey);
}