Пример #1
0
/****************************************************************************
  Load the introductory graphics.
****************************************************************************/
void load_intro_gfx(void)
{
  /* PORTME */
  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename(tileset));
  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename(tileset));
}
Пример #2
0
void load_intro_gfx(void)
{
  int tot, lin, y, w;
  char s[64];
  XColor face;
  int have_face;
  const char *motto = freeciv_motto();
  XFontSetExtents *exts;

  /* metrics */

  exts = XExtentsOfFontSet(main_font_set);
  lin = exts->max_logical_extent.height;

  /* get colors */

  if(XParseColor(display, cmap, COLOR_MOTTO_FACE, &face) &&
     XAllocColor(display, cmap, &face)) {
    have_face = TRUE;
  } else {
    face.pixel = get_color(tileset, COLOR_OVERVIEW_VIEWRECT)->color.pixel;
    have_face = FALSE;
  }

  /* Main graphic */

  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename(tileset));
  tot = intro_gfx_sprite->width;

  y = intro_gfx_sprite->height - (2 * lin);

  w = XmbTextEscapement(main_font_set, motto, strlen(motto));
  XSetForeground(display, font_gc, face.pixel);
  XmbDrawString(display, intro_gfx_sprite->pixmap,
      		main_font_set, font_gc,
		tot / 2 - w / 2, y,
		motto, strlen(motto));

  /* Minimap graphic */

  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename(tileset));
  tot = radar_gfx_sprite->width;

  y = radar_gfx_sprite->height - (lin +
      1.5 * (exts->max_logical_extent.height + exts->max_logical_extent.y));

  w = XmbTextEscapement(main_font_set, word_version(), strlen(word_version()));
  XSetForeground(display, font_gc,
		 get_color(tileset, COLOR_OVERVIEW_UNKNOWN)->color.pixel);
  XmbDrawString(display, radar_gfx_sprite->pixmap,
		main_font_set, font_gc,
		(tot / 2 - w / 2) + 1, y + 1,
		word_version(), strlen(word_version()));
  XSetForeground(display, font_gc,
		 get_color(tileset, COLOR_OVERVIEW_VIEWRECT)->color.pixel);
  XmbDrawString(display, radar_gfx_sprite->pixmap,
		main_font_set, font_gc,
		tot / 2 - w / 2, y,
		word_version(), strlen(word_version()));

  y += lin;

  fc_snprintf(s, sizeof(s), "%d.%d.%d%s",
	      MAJOR_VERSION, MINOR_VERSION,
	      PATCH_VERSION, VERSION_LABEL);
  w = XmbTextEscapement(main_font_set, s, strlen(s));
  XSetForeground(display, font_gc,
		 get_color(tileset, COLOR_OVERVIEW_UNKNOWN)->color.pixel);
  XmbDrawString(display, radar_gfx_sprite->pixmap,
		main_font_set, font_gc,
		(tot / 2 - w / 2) + 1, y + 1, s, strlen(s));
  XSetForeground(display, font_gc,
		 get_color(tileset, COLOR_OVERVIEW_VIEWRECT)->color.pixel);
  XmbDrawString(display, radar_gfx_sprite->pixmap,
		main_font_set, font_gc,
		tot / 2 - w / 2, y, s, strlen(s));

  /* free colors */

  if (have_face) {
    XFreeColors(display, cmap, &(face.pixel), 1, 0);
  }

  /* done */

  return;
}