Exemple #1
0
int Stack::push(int elem)
{
   int m = getmax();
   if (top < m)
   {
      put_elem(elem,top++);
      return 0;
   }
   else
      return -1;
}
Exemple #2
0
void	cl_screen_put_img(t_removable *remove, SDL_Rect pos,
			  t_image img, SDL_Surface *texture)
{
  loadAllImages(&img);
  put_elem(remove, &img);
  if (SDL_BlitSurface(texture, NULL, img.screen,
		      &pos) == -1)
    Error("Cannot put image on screen", texture);
  if (SDL_Flip(img.screen) == -1)
    Error("Cannot refresh screen", texture);
}
Exemple #3
0
int main (void) {
  smatrix_t * a, *b, *c;
  int i,j;

  

  /* creazione matrici test operazioni */
  a = new_smat(N,M);  
  b = new_smat(N,M);


  for (i=0; i < N ; i ++) 
    for (j=0; j < M ; j ++) 
      if (i != j)  {
	put_elem(a,i,j,(1.0)) ;
	put_elem(b, i, j ,(2.0)) ;
    
      }

  /* calcolo la trasposta */
  c = transp_smat(b);
  free_smat(&b);
  
  /* stampo le matrici da moltiplicare */
  print_smat(stdout,a);
  print_smat(stdout,c);


  if ( ( b = prod_smat(a,c) ) == NULL ) return EXIT_FAILURE;

  print_smat(stdout,b);
	
	
  
  free_smat(&a);
  free_smat(&b);
  free_smat(&c);

  return EXIT_SUCCESS;

}
Exemple #4
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);
}