コード例 #1
0
ファイル: ai.cpp プロジェクト: ArtBears/wesnoth
bool ai_composite::add_stage(const config &cfg)
{
	std::vector< stage_ptr > stages;
	create_stage(stages,cfg);
	int j=0;
	for (stage_ptr b : stages) {
		stages_.push_back(b);
		j++;
	}
	return (j>0);
}
コード例 #2
0
int
main (int argc, char *argv[])
{
  guchar *buffer;
  gchar *file_name;
  guint width, height;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return -1;

  signal (SIGINT, quit);

  if (argc < 2)
    {
      g_print ("Usage: %s DEPTH_FILE [COLOR_STRING POINT_X POINT_Y]\n",
               argv[0]);
      return 0;
    }

  width = 640;
  height = 480;

  file_name = argv[1];
  create_stage (width, height);
  set_info_text (file_name);

  buffer = load_image (file_name, width, height);
  if (buffer == NULL)
    return -1;

  if (argc > 2)
    {
      if ((argc - 2) % 3 == 0)
        {
          guint i;
          for (i = 2; i < argc; i+=3)
            {
              gchar *color;
              guint x, y;
              color = argv[i];
              x = g_ascii_strtod (argv[i + 1], NULL);
              y = g_ascii_strtod (argv[i + 2], NULL);
              if (errno == 0)
                {
                  draw_point (buffer, width, height, color, x, y);
                }
            }
        }
      else
        {
          g_print ("Wrong number of arguments...\n");
        }
    }

  if (!paint_texture (buffer, width, height))
    {
      return -1;
    }
  clutter_main ();

  return 0;
}