예제 #1
0
파일: mapContainer.cpp 프로젝트: gkhara/hw
void HWMapContainer::askForGeneratedPreview()
{
    pMap = new HWMap(this);
    connect(pMap, SIGNAL(ImageReceived(QPixmap)), this, SLOT(setImage(QPixmap)));
    connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
    connect(pMap, SIGNAL(destroyed(QObject *)), this, SLOT(onPreviewMapDestroyed(QObject *)));
    pMap->getImage(m_seed,
                   getTemplateFilter(),
                   get_mapgen(),
                   getMazeSize(),
                   getDrawnMapData(),
                   m_script
                  );

    setHHLimit(0);

    const QPixmap waitIcon(":/res/iconTime.png");

    QPixmap waitImage(m_previewSize);
    QPainter p(&waitImage);

    p.fillRect(waitImage.rect(), linearGrad);
    int x = (waitImage.width() - waitIcon.width()) / 2;
    int y = (waitImage.height() - waitIcon.height()) / 2;
    p.drawPixmap(QPoint(x, y), waitIcon);

    addInfoToPreview(waitImage);

    cType->setEnabled(false);
}
예제 #2
0
int		main(int ac, char** av)
{
  SDL_Surface	*screen;
  SDL_Surface	*life_back;
  char		**map;
  char		*life;
  int		i;
  int		size_line;
  int		size_column;

  if (ac == 2)
    {
      map = loadMap(av[1]);
      size_line = check_map(map, &size_column);      
      life = constr_life(size_line, life);
      x_SDL_Init(SDL_INIT_VIDEO);
      screen = SDL_SetVideoMode(size_line*SIZE_IMAGE , size_column*SIZE_IMAGE
+ SIZE_IMAGE, 32, SDL_RESIZABLE | SDL_DOUBLEBUF);

      SDL_WM_SetCaption("Epikong", "KONG");
            
      loadAllImages(map, screen);
      life_back = SDL_CreateRGBSurface(SDL_HWSURFACE, SIZE_IMAGE, SIZE_IMAGE, 32, 0, 0, 0, 0);
      loadImagelife(screen, life, 0);
      
      /* 3 vies */
      loadImagelife(screen, life, 1);
      loadImagelife(screen, life, 1);
      loadImagelife(screen, life, 1);

      x_SDL_Flip(screen);
      x_SDL_Flip(life_back);
      waitImage();
      i = -1;
      while (map[++i] != NULL)
	free(map[i]);
      free(map);
      SDL_Quit();
    }
  else
    {
      printf("Format : %s filemap\n", av[0]);
      exitError("[ERROR] : Bad parameters\n");
    }
  return (EXIT_SUCCESS);
}
예제 #3
0
void		loadFile(t_image* img, char *filemap)
{
  t_removable	remove;

  img->map = loadMap(filemap);
  check_map(img);
  if (img->sizeX != SCREEN_X || img->sizeY != SCREEN_Y)
    {
      fprintf(stderr, "[ERROR] : The map have to have dimension of %d by %d\n",
	      SCREEN_X, SCREEN_Y);
      exitError("");
    }
  loadAllImages(img);
  x_SDL_Flip(img->screen);
  remove.monster = catch_monster(img->map);
  remove.item = catch_item(img->map, &remove);
  put_elem(&remove, img);
  x_SDL_Flip(img->screen);
  key(&remove, *img);
  x_SDL_Flip(img->screen);
  waitImage();
  freeMap(img->map);
}