Esempio n. 1
0
t_texture      		*load_image(const char *file, t_ptr_list **ptr_list)
{
  t_bunny_pixelarray	*tmp;

  if ((tmp = bunny_load_pixelarray(file)) == NULL)
    return (NULL);
  return (pix_array_to_texture(tmp, ptr_list));
}
Esempio n. 2
0
t_bunny_pixelarray	*xloadpic(const char *file)
{
  t_bunny_pixelarray	*tmp;

  if ((tmp = bunny_load_pixelarray(file)) == NULL)
    exit (1);
  return (tmp);
}
Esempio n. 3
0
void	init_lvl2(t_bunny_pixelarray *newpix)
{
  if ((newpix = bunny_load_pixelarray("./pictures/sky.png")) == NULL)
    {
      puts("missing_sky\n");
      exit (EXIT_FAILURE);
    }
  bunny_set_loop_main_function(bunny_vellement);
}
Esempio n. 4
0
static t_scrolling	*init_scroll(int k)
{
  t_bunny_pixelarray	*pix;
  t_scrolling		*scroll;

  if ((scroll = bunny_malloc(sizeof(t_scrolling))) == NULL)
    return (NULL);
  if (k == 0)
    pix = bunny_load_pixelarray(PATH_P "para1.png");
  else if (k == 1)
    pix = bunny_load_pixelarray(PATH_P "para2.png");
  else
    pix = bunny_load_pixelarray(PATH_P "para3.png");
  scroll->vit = 1 * (k + 1);
  scroll->pix = bunny_new_pixelarray(WIDTH, HEIGHT);
  fox_mod_stretch(scroll->pix, pix);
  scroll->pos = 0;
  return (scroll);
}
Esempio n. 5
0
int		apply_plan(t_data *data)
{
  t_plan	*pla;

  pla = data->itfc.obj_selected->datas;
  if (!pla->texture && ((pla->texture =
			 bunny_load_pixelarray
			  ("assets/img/stone3.jpg")) == NULL))
    return (my_puterr("load_datas: invalid plane texture"), 1);
  pla->tex_type = IMAGE;
  data->itfc.past.rad_state = IMG;
  return (0);
}
Esempio n. 6
0
int		apply_sphere(t_data *data)
{
  t_sphere	*sph;

  sph = data->itfc.obj_selected->datas;
  if (!sph->texture && ((sph->texture =
			 bunny_load_pixelarray
			 ("assets/img/stone3.jpg")) == NULL))
    return (my_puterr("load_datas: invalid sphere texture"), 1);
  sph->tex_type = IMAGE;
  data->itfc.past.rad_state = IMG;
  return (0);
}
Esempio n. 7
0
void		init_tek_part_text(t_demo *prog)
{
  static t_bunny_position	pos1 = {10, 10};
  static t_font			*font = NULL;

  if (font == NULL)
    {
      if ((font = bunny_malloc(sizeof(t_font))) == NULL)
	return ;
      font->font = bunny_load_pixelarray(PATH_F "font.png");
      font->scale = 1;
      font->letter = getletterdim(font->font);
    }

  //  pos1.x += 1;
  //pos1.y = (int)((HEIGHT >> 1) + ((HEIGHT >> 1) * (cos(pos1.x * 0.1))) / 2);
  tektext_part(prog->pix, "Keur. <3.", font, &pos1);
}
Esempio n. 8
0
int		extract_planter(t_bunny_ini	*file,
				t_data		*data,
				int		idx,
				const char	*scope)
{
  const char	*str;

  if ((str = bunny_ini_get_field(file, scope, "texture", 0)) == NULL)
    {
      P_PATH = NULL;
      P_TEXTURE = NULL;
    }
  else
    {
      P_PATH = bunny_strdup(str);
      if ((P_TEXTURE = bunny_load_pixelarray(P_PATH)) == NULL)
	return (print_error("The texture was not found!\n"));
    }
  return (0);
}
Esempio n. 9
0
void			scrollfichage(t_demo *prog,
				      int x, int y)
{
  static int			frame= 0;
  static t_bunny_pixelarray	*img = NULL;
  static int			line = 0;
  t_bunny_position		pos[2];

  frame += 1;
  if (img == NULL)
    img = bunny_load_pixelarray(PATH_P "mawio.png");
  pos[0].x = x;
  pos[0].y = y;
  pos[1].x = img->clipable.buffer.width - 1;
  pos[1].y = img->clipable.buffer.height - 1;
  line = aff_scrolling(prog->pix, img, &pos[0], line);
  if (frame == 1)
    {
      line += 1;
      frame = 0;
    }
  line -= 1;
}
Esempio n. 10
0
int		load_screen(t_visu *visu, char *str)
{
  if (str != NULL && my_strcmp(str, "--abel") == 0)
    {
      if (((visu->screen =
	    bunny_load_pixelarray("./ressources/abel_screen.png")) == NULL)
	  || ((visu->room =
	       bunny_load_pixelarray("./ressources/poulet.png")) == NULL)
	  || ((visu->room_end =
	       bunny_load_pixelarray("./ressources/bucket.png")) == NULL))
	return (-1);
    }
  else
    if (((visu->screen =
	  bunny_load_pixelarray("./ressources/lemin_screen.png")) == NULL)
	|| ((visu->room =
	     bunny_load_pixelarray("./ressources/fourmilliere.png")) == NULL)
	|| ((visu->room_end =
	     bunny_load_pixelarray("./ressources/fourmilliere.png")) == NULL))
      return (-1);
  return (0);
}
Esempio n. 11
0
void	get_pix(t_square *square, const char *path)
{
  if ((square->pix = bunny_load_pixelarray(path)) == NULL)
    square->pix = NULL;
  return ;
}