예제 #1
0
static void		get_text_sequel(t_v_env *param, void *e)
{
	T4.file = "./textures/4.xpm";
	T4.img = mlx_xpm_file_to_image(e, T4.file, &T4.size_x, &T4.size_y);
	if (T4.img == NULL)
		v_exit("%r#20", 20);
	T4.data = mlx_get_data_addr(T4.img, &T4.bpp, &T4.sizeline, &T4.endian);
	T5.file = "./textures/5.xpm";
	T5.img = mlx_xpm_file_to_image(e, T5.file, &T5.size_x, &T5.size_y);
	if (T5.img == NULL)
		v_exit("%r#20", 20);
	T5.data = mlx_get_data_addr(T5.img, &T5.bpp, &T5.sizeline, &T5.endian);
	T6.file = "./textures/6.xpm";
	T6.img = mlx_xpm_file_to_image(e, T6.file, &T6.size_x, &T6.size_y);
	if (T6.img == NULL)
		v_exit("%r#20", 20);
	T6.data = mlx_get_data_addr(T6.img, &T6.bpp, &T6.sizeline, &T6.endian);
	T7.file = "./textures/7.xpm";
	T7.img = mlx_xpm_file_to_image(e, T7.file, &T7.size_x, &T7.size_y);
	if (T7.img == NULL)
		v_exit("%r#20", 20);
	T7.data = mlx_get_data_addr(T7.img, &T7.bpp, &T7.sizeline, &T7.endian);
	T8.file = "./textures/8.xpm";
	T8.img = mlx_xpm_file_to_image(e, T8.file, &T8.size_x, &T8.size_y);
	if (T8.img == NULL)
		v_exit("%r#20", 20);
	T8.data = mlx_get_data_addr(T8.img, &T8.bpp, &T8.sizeline, &T8.endian);
}
예제 #2
0
파일: texture.c 프로젝트: Tastyep/rt
int	load_write_and_chack(t_param *param)
{
  if ((param->check_ok.img =
       mlx_xpm_file_to_image(param->window.p,
			     "texture/check_ok.xpm",
			     &(param->check_ok.y),
			     &(param->check_ok.x))) == NULL ||
      (param->write.img =
       mlx_xpm_file_to_image(param->window.p,
			     "texture/write.xpm",
			     &(param->write.y),
			     &(param->write.x))) == NULL ||
      (param->hide.img =
       mlx_xpm_file_to_image(param->window.p,
			     "texture/cache.xpm",
			     &(param->hide.y),
			     &(param->hide.x))) == NULL ||
      (param->wrong.img =
       mlx_xpm_file_to_image(param->window.p,
			     "texture/wrong.xpm",
			     &(param->wrong.y),
			     &(param->wrong.x))) == NULL)
    return (0);
  return (1);
}
예제 #3
0
static void	xpm_to_image(t_texture *tex, t_env *env)
{
	int			width;
	int			height;

	tex->text1 = mlx_xpm_file_to_image(env->mlx, "./textures/wall1.xpm",
			&width, &height);
	tex->text2 = mlx_xpm_file_to_image(env->mlx, "./textures/wall2.xpm",
			&width, &height);
	tex->text3 = mlx_xpm_file_to_image(env->mlx, "./textures/wall3.xpm",
			&width, &height);
	tex->text4 = mlx_xpm_file_to_image(env->mlx, "./textures/wall4.xpm",
			&width, &height);
	tex->text5 = mlx_xpm_file_to_image(env->mlx, "./textures/kwiessle.xpm",
			&width, &height);
	tex->text6 = mlx_xpm_file_to_image(env->mlx, "./textures/psyche.xpm",
			&width, &height);
	tex->text7 = mlx_xpm_file_to_image(env->mlx, "./textures/vquesnel.xpm",
			&width, &height);
	tex->textsol = mlx_xpm_file_to_image(env->mlx, "./textures/floor.xpm",
			&width, &height);
	tex->textroof = mlx_xpm_file_to_image(env->mlx, "./textures/neon.xpm",
			&width, &height);
	if (!tex->text1 || !tex->text2 || !tex->text3 || !tex->text4 || !tex->text7
			|| !tex->text5 || !tex->text6 || !tex->textsol || !tex->textroof)
		ft_error("Error when extracting xpm files.");
}
예제 #4
0
static void		ft_load_img(t_display *d)
{
    d->img->entity_img->img_xpm[0] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_1, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[1] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_2, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[2] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_3, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[3] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_4, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[4] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_5, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[5] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_6, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[6] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_7, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
    d->img->entity_img->img_xpm[7] = mlx_xpm_file_to_image(d->mlx->mlx,
                                     IMG_ENTITY_LVL_8, &d->img->entity_img->w,
                                     &d->img->entity_img->h);
}
예제 #5
0
파일: ft_init_im.c 프로젝트: Jolenaz/wolf3d
void	ft_init_dsbimg(t_env *e)
{
	int	w;

	w = 256;
	e->img_wall[25] = mlx_xpm_file_to_image(e->mlx, "images/w25.xpm", &w, &w);
	e->img_door[1] = mlx_xpm_file_to_image(e->mlx, "images/door1.xpm", &w, &w);
	e->img_door[3] = mlx_xpm_file_to_image(e->mlx, "images/door3.xpm", &w, &w);
	e->img_door[4] = mlx_xpm_file_to_image(e->mlx, "images/door4.xpm", &w, &w);
	e->img_door[5] = mlx_xpm_file_to_image(e->mlx, "images/door5.xpm", &w, &w);
	e->img_door[6] = mlx_xpm_file_to_image(e->mlx, "images/door6.xpm", &w, &w);
	e->img_door[7] = mlx_xpm_file_to_image(e->mlx, "images/door7.xpm", &w, &w);
	e->img_door[8] = mlx_xpm_file_to_image(e->mlx, "images/door8.xpm", &w, &w);
	e->img_sb[2] = mlx_xpm_file_to_image(e->mlx, "images/sb2.xpm", &w, &w);
	e->img_sb[3] = mlx_xpm_file_to_image(e->mlx, "images/sb3.xpm", &w, &w);
}
예제 #6
0
파일: textures.c 프로젝트: Es-so/Wolf3D
void			init_textures(t_mega *all)
{
	t_text	*text;
	int		texture_nb;
	int		nb;
	int		i;

	i = 0;
	nb = SKYBOX + 1;
	init_weapon_hud(all);
	getfile2load(all, nb);
	while (i < nb)
	{
		text = &all->text[i];
		text->img.img = mlx_xpm_file_to_image(all->e.mlx, text->filename,
											&text->w, &text->h);
		if (text->img.img == NULL)
			ft_error(4);
		text->img.data = mlx_get_data_addr(text->img.img, &text->img.bpp,
			&text->img.sizeline, &text->img.endian);
		if (!text->img.data)
			ft_error(4);
		free(text->filename);
		i++;
	}
}
예제 #7
0
static void		ft_load_img(t_display *d)
{
	d->img->ground_img->img_xpm = mlx_xpm_file_to_image(d->mlx->mlx,
			IMG_GROUND,
			&d->img->ground_img->w,
			&d->img->ground_img->h);
}
예제 #8
0
파일: texture.c 프로젝트: Adpa18/RayTracer
void		load_texture(t_system *sys)
{
  int		i;

  i = -1;
  while (sys->obj[++i].type != -2)
    {
      if (sys->obj[i].tex.file)
	{
	  my_putstr("Loading ");
	  my_putstr(sys->obj[i].tex.file);
	  my_putstr("\n");
	  sys->obj[i].tex.texture.img =
	    mlx_xpm_file_to_image(sys->mlx,
				  sys->obj[i].tex.file,
				  &(sys->obj[i].tex.w),
				  &(sys->obj[i].tex.h));
	  sys->obj[i].tex.texture.data =
	    mlx_get_data_addr(sys->obj[i].tex.texture.img,
			      &(sys->obj[i].tex.texture.bpp),
			      &(sys->obj[i].tex.texture.sizeline),
			      &(sys->obj[i].tex.texture.endian));
	}
      else
	sys->obj[i].tex.texture.data = NULL;
    }
}
예제 #9
0
파일: get_tex.c 프로젝트: NegMozzie/42
int				get_tex(t_env *env)
{
	t_img		*img;
	int			i;
	char		*tab[10];
	int			x2;
	int			y2;

	tex(tab);
	i = 0;
	while (i < 10)
	{
		x2 = 0;
		y2 = 0;
		env->img[i] = (t_img *)malloc(sizeof(t_img));
		img = env->img[i];
		if (!(img->img = mlx_xpm_file_to_image(env->ptr, tab[i], &x2, &y2)))
			exit(0);
		if (!(img->data = mlx_get_data_addr(img->img, &(img->bpp),
			&(img->sizel), &(img->endian))))
			exit(0);
		i++;
	}
	return (0);
}
예제 #10
0
void		w_set_texture(t_app *app, char *file_name, char num)
{
	t_texture	texture;
	t_obj		*obj;
	int			height;
	int			width;

	obj = NULL;
	ft_bzero(&texture, sizeof(t_texture));
	if ((obj = (t_obj *)ft_memalloc(sizeof(t_obj))) == NULL)
		ft_putstr_fd("Erreur d'allocation de t_obj\n", 2);
	obj->img = mlx_xpm_file_to_image(app->mlx, file_name,
		&width, &height);
	if (obj->img == NULL)
		return ;
	obj->data = mlx_get_data_addr(obj->img,
		&obj->bpp,
		&obj->sizeline,
		&obj->endian);
	texture.num = num;
	texture.x = 0;
	texture.y = 0;
	texture.width = width;
	texture.height = height;
	texture.obj = obj;
	ft_lstpush_front(&app->lst_texture, &texture, sizeof(t_texture));
}
예제 #11
0
파일: ray_tracer.c 프로젝트: NSSX/good
void	ray_tracer(t_env *e)
{
	int x;
	int y;
	int a;
	int b;
	int c;
	int d;

	a = 0;
	b = 0;
	c = 0;
	d = 0;
	e->no = 0;
	e->sky = 0;
	e->img = (t_img *)malloc(sizeof(t_img) * 1);
	e->skybox = (t_img *)malloc(sizeof(t_img) * 1);
	e->sol = (t_img *)malloc(sizeof(t_img) * 1);
	e->img->img_ptr = mlx_new_image(e->mlx, e->width, e->height);
	e->img->data = mlx_get_data_addr(e->img->img_ptr,
					 &e->img->bpp, &e->img->sizeline, &e->img->endian);
	e->skybox->img_ptr = mlx_xpm_file_to_image(e->mlx, "cart.xpm", &(c), &(d));
	e->skybox->data = mlx_get_data_addr(e->skybox->img_ptr,
					    &(e->skybox->bpp), &(e->skybox->sizeline), &(e->skybox->endian));
	e->sol->img_ptr = mlx_xpm_file_to_image(e->mlx, "sol.xpm", &(a), &(b));
	e->sol->data = mlx_get_data_addr(e->sol->img_ptr,
                                            &(e->sol->bpp), &(e->sol->sizeline), &(e->sol->endian));
	y = 0;
	while (y < e->height)
	{
	  e->y = y;
		x = 0;
		while (x < e->width)
		{
		  e->s = 0;
		  e->x = x;
		  e->color = give_color(e, x, y);
		  if(e->no == 0)
		    pixel_put_to_img(e, x, y);
		  e->no = 0;
		  x++;
		}
		y++;
	}
	mlx_put_image_to_window(e->mlx, e->win, e->img->img_ptr, 0, 0);
}
예제 #12
0
static t_img	loadimage(t_mlxdata *data, char *path, int xsize, int ysize)
{
	t_img img;

	img.size.x = xsize;
	img.size.y = ysize;
	img.ptr = (void *)mlx_xpm_file_to_image(data->env.mlx, path,
											&xsize, &ysize);
	return (img);
}
예제 #13
0
파일: init.c 프로젝트: sganon/Wolf3d
int		init_textures(t_env *e)
{
	t_textures	*wall;
	t_textures	*floor;
	t_textures	*ceil;

	wall = &e->wall;
	floor = &e->floor;
	ceil = &e->ceil;
	wall->img_ptr = mlx_xpm_file_to_image(e->mlx, WALL, &wall->x, &wall->y);
	floor->img_ptr = mlx_xpm_file_to_image(e->mlx, FLOOR, &floor->x, &floor->y);
	ceil->img_ptr = mlx_xpm_file_to_image(e->mlx, CEIL, &ceil->x, &ceil->y);
	if (!wall->img_ptr || !floor->img_ptr || !ceil->img_ptr)
		return (0);
	wall->img = MLX_DAT(wall->img_ptr, &wall->bpp, &wall->sl, &wall->end);
	floor->img = MLX_DAT(floor->img_ptr, &floor->bpp, &floor->sl, &floor->end);
	ceil->img = MLX_DAT(ceil->img_ptr, &ceil->bpp, &ceil->sl, &ceil->end);
	return (1);
}
예제 #14
0
파일: texture.c 프로젝트: Tastyep/rt
int	init_texture(t_param *param)
{
  if ((param->tab_texture_menu =
       malloc(sizeof(t_texture) * 24)) == NULL ||
      load_texture(param) == 0 ||
      (param->panel_control.img =
       mlx_xpm_file_to_image(param->window.p,
			     "texture/panel_config.xpm",
			     &(param->panel_control.y),
			     &(param->panel_control.x))) == NULL ||
      (param->textbox.img =
       mlx_xpm_file_to_image(param->window.p,
			     "texture/textbox.xpm",
			     &(param->textbox.y),
			     &(param->textbox.x))) == NULL ||
      load_write_and_chack(param) == 0 ||
      load_texture_form(param) == 0)
    return (0);
  return (1);
}
예제 #15
0
파일: texture.c 프로젝트: Borhink/wolf3d
static void	set_texture(t_env *e, t_texture *t, char *name)
{
	if (!(t->i = mlx_xpm_file_to_image(e->mlx, name, &(t->wth), &(t->hgt))))
	{
		ft_putstr("Texture \"");
		ft_putstr(name);
		ft_putendl("\" not found");
		exit(1);
	}
	t->d = mlx_get_data_addr(t->i, &(t->bpp), &(t->sl), &(t->edn));
}
예제 #16
0
void	ft_set_text(t_env *env, char *line, int nb_line)
{
	env->text[nb_line] = (t_text*)malloc(sizeof(t_text));
	env->text[nb_line]->data = (t_data*)malloc(sizeof(t_data));
	env->text[nb_line]->img = mlx_xpm_file_to_image(env->mlx, line,
		&env->text[nb_line]->width, &env->text[nb_line]->height);
	env->text[nb_line]->data->addr =
		mlx_get_data_addr(env->text[nb_line]->img,
			&env->text[nb_line]->data->bpp,
			&env->text[nb_line]->data->sl,
			&env->text[nb_line]->data->end);
}
예제 #17
0
파일: struct.c 프로젝트: Borhink/wolf3d
int			create_img(t_env *e, t_img *img)
{
	t_texture	*h;

	h = &(e->hand);
	h->i = mlx_xpm_file_to_image(e->mlx, "img/hand.xpm", &(h->wth), &(h->hgt));
	if (!(img->i = mlx_new_image(e->mlx, WIN_W, WIN_H)) || !h->i)
		return (0);
	img->d = mlx_get_data_addr(img->i, &(img->bpp), &(img->sl), &(img->edn));
	h->d = mlx_get_data_addr(h->i, &(h->bpp), &(h->sl), &(h->edn));
	return (1);
}
예제 #18
0
파일: new.c 프로젝트: ItsJimi/42
t_img	*new_xpm(t_mlx *mlx, int w, int h)
{
	t_img	*img;

	if (!(img = (t_img *)malloc(sizeof(*img))))
		str_exit(-1, "new.c : Error line 55", mlx);
	if (!(img->img = mlx_xpm_file_to_image(mlx->mlx, "skybox.xpm", &w, &h)))
		str_exit(-1, "No skybox", mlx);
	img->addr = mlx_get_data_addr(img->img, &(img->bpp), &(img->size_l),
		&(img->endian));
	return (img);
}
예제 #19
0
void			ft_init_textures(t_ba *ba)
{
	ft_init_struct_text(ba);
	ba->eye->x = WD_W;
	ba->eye->y = WD_H;
	ba->eye->img = mlx_xpm_file_to_image(ba->mlx,
		"texture/eye.xpm", &ba->eye->x, &ba->eye->y);
	ba->eye->data = mlx_get_data_addr(ba->eye->img, &ba->eye->bpp,
		&ba->eye->size, &ba->eye->endian);
	ba->mars->x = WD_W;
	ba->mars->y = WD_H;
	ba->mars->img = mlx_xpm_file_to_image(ba->mlx,
		"texture/mars.xpm", &ba->mars->x, &ba->mars->y);
	ba->mars->data = mlx_get_data_addr(ba->mars->img, &ba->mars->bpp,
		&ba->mars->size, &ba->mars->endian);
	ba->doge->x = WD_W;
	ba->doge->y = WD_H;
	ba->doge->img = mlx_xpm_file_to_image(ba->mlx,
		"texture/doge.xpm", &ba->doge->x, &ba->doge->y);
	ba->doge->data = mlx_get_data_addr(ba->doge->img, &ba->doge->bpp,
		&ba->doge->size, &ba->doge->endian);
}
예제 #20
0
void	ft_static_xpm(t_id *s)
{
	int i;
	int j;

	if (s->gun == 1)
		mlx_put_image_to_window(s->mlx, s->win, GU, W_X / 2, DE);
	if (s->map[(int)s->posx][(int)s->posy] == 2)
	{
		s->tp = malloc(sizeof(void*));
		s->tp = mlx_xpm_file_to_image(s->mlx, "Textures/tp.xpm", &i, &j);
		mlx_put_image_to_window(s->mlx, s->win, s->tp, WX2, W_Y / 2 - 100);
	}
}
예제 #21
0
void			get_textures(t_v_env *param, void *e)
{
	T0.file = "./textures/0.xpm";
	T0.img = mlx_xpm_file_to_image(e, T0.file, &T0.size_x, &T0.size_y);
	if (T0.img == NULL)
		v_exit("%r#20", 20);
	T0.data = mlx_get_data_addr(T0.img, &T0.bpp, &T0.sizeline, &T0.endian);
	T1.file = "./textures/1.xpm";
	T1.img = mlx_xpm_file_to_image(e, T1.file, &T1.size_x, &T1.size_y);
	if (T1.img == NULL)
		v_exit("%r#20", 20);
	T1.data = mlx_get_data_addr(T1.img, &T1.bpp, &T1.sizeline, &T1.endian);
	T2.file = "./textures/2.xpm";
	T2.img = mlx_xpm_file_to_image(e, T2.file, &T2.size_x, &T2.size_y);
	if (T2.img == NULL)
		v_exit("%r#20", 20);
	T2.data = mlx_get_data_addr(T2.img, &T2.bpp, &T2.sizeline, &T2.endian);
	T3.file = "./textures/3.xpm";
	T3.img = mlx_xpm_file_to_image(e, T3.file, &T3.size_x, &T3.size_y);
	if (T3.img == NULL)
		v_exit("%r#20", 20);
	T3.data = mlx_get_data_addr(T3.img, &T3.bpp, &T3.sizeline, &T3.endian);
	get_text_sequel(param, e);
}
예제 #22
0
파일: ft_image.c 프로젝트: Kalilo/rtv1
t_img	*ft_load_img(void *mlx, char *src)
{
	t_img	*i;

	if (!src || !(i = (t_img*)malloc(sizeof(t_img))))
		return (NULL);
	if (!(i->img = mlx_xpm_file_to_image(mlx, src, &(i->width), &(i->height))))
		return (NULL);
	i->data = mlx_get_data_addr(i->img, &(i->bpp),
								&(i->sizeline), &(i->endian));
	i->sl_div = i->sizeline / 4;
	i->bpp_div = i->bpp / 8 / 4;
	i->udata = (unsigned int*)i->data;
	return (i);
}
예제 #23
0
int		load_each_texture(t_each_text *texture, char *path,
				  t_data *data)
{
  texture->texture = mlx_xpm_file_to_image(data->windo.mlx_ptr,
					   path,
					   &(texture->size_x),
					   &(texture->size_y));
  if (texture->texture == NULL)
    return (FAIL);
  texture->data = mlx_get_data_addr(texture->texture,
				    &(texture->bpp),
				    &(texture->sizeline),
				    &(texture->endian));
  return (SUCCES);
}
예제 #24
0
static void		level_image(t_env *e)
{
	void	*xpm;
	int		lar;
	int		lon;

	ft_bzero(e->str, LON * LAR * 4);
	mlx_put_image_to_window(e->mlx, e->win, e->img, 0, 0);
	xpm = mlx_xpm_file_to_image (e->mlx, e->stage->lvl, &lar, &lon);
	mlx_put_image_to_window(e->mlx, e->win, xpm, LAR / 2 - lar / 2,
							LON / 2 - lon / 2);
	mlx_put_image_to_window(e->mlx, e->win, xpm, LAR / 2 - lar / 2,
							LON / 2 - lon / 2);
	sleep(1);
}
예제 #25
0
파일: w_img.c 프로젝트: thiefaine/C_WOLF3D
void		create_img(t_env *e, t_coord dim, char *file, t_coord pos)
{
	int		x;
	int		y;

	x = (int)dim.x;
	y = (int)dim.y;
	if (e->img)
	{
		free(e->img);
		e->img = NULL;
	}
	e->img = mlx_new_image(e->mlx, x, y);
	e->img = mlx_xpm_file_to_image(e->mlx, file, &x, &y);
	mlx_put_image_to_window(e->mlx, e->win, e->img, pos.x, pos.y);
}
예제 #26
0
파일: test.c 프로젝트: Wobow/Tek1
int	main()
{
  int	fd;
  void	*img;
  void	*mlx;
  void	*win;
  int	c;
  int	v;

  c = 900;
  v = 800;
  mlx = mlx_init();
  win = mlx_new_window(mlx, 900, 800, "cacac");
  img = mlx_xpm_file_to_image(mlx, "lol.xpm", &c, &v);
  mlx_put_image_to_window(mlx, win, img, 0, 0);
  mlx_loop(mlx);
}
예제 #27
0
파일: texture.c 프로젝트: Tastyep/rt
int	load_texture(t_param *param)
{
  int	indice;

  indice = -1;
  while (++indice < 24)
    if ((param->tab_texture_menu[indice].img =
	 mlx_xpm_file_to_image(param->window.p,
			       get_texture_menu(indice),
			       &(param->tab_texture_menu[indice].y),
			       &(param->tab_texture_menu[indice].x))) == NULL)
      {
	my_putstr("Error load texture : ", 2, -1);
	my_putstr(get_texture_menu(indice), 2, -1);
	my_putstr("\n", 2, -1);
	return (0);
      }
  return (1);
}
예제 #28
0
파일: parsing_func.c 프로젝트: vlize/RTv2
void		rec_texture_file(t_tex *tex, char *ret, void *mlx)
{
	char	*name;
	int		endian;
	int		bpp;
	int		sizeline;

	name = rec_name(ret);
	tex->type = 0;
	if ((tex->img = mlx_xpm_file_to_image(mlx, name, &tex->width,
		&tex->height)) == NULL)
	{
		tex->type = 1;
		tex->proc_type = 0;
	}
	else
		tex->data = mlx_get_data_addr(tex->img, &bpp, &sizeline, &endian);
	if (name != NULL)
		free(name);
}
예제 #29
0
파일: texture.c 프로젝트: phaninho/wolf3d
void	init_texture(t_env *e)
{
	int		i;
printf("llaa init texture\n");
	e->tex = malloc(sizeof(t_image) * 63);
	e->file = malloc(sizeof(char *) * 63);
	init_texture_parser1(e);
	init_texture_parser2(e);
	init_texture_parser3(e);
	i = 0;
	while (++i < 63)
	{
		e->tex[i].i = mlx_xpm_file_to_image(e->mlx, e->file[i],
				&e->tex[i].width, &e->tex[i].height);
		if (e->tex[i].i == NULL)
			texture_error();
		e->tex[i].data = mlx_get_data_addr(e->tex[i].i,
				&e->tex[i].bpp, &e->tex[i].szline,
				&e->tex[i].endian);
	}
}
예제 #30
0
파일: texture.c 프로젝트: Tastyep/rt
int	load_texture_form(t_param *param)
{
  int	indice;

  if ((param->tab_texture_form = malloc(sizeof(t_texture) * 11)) == NULL)
    return (0);
  indice = -1;
  while (++indice < 11)
    if ((param->tab_texture_form[indice].img =
	 mlx_xpm_file_to_image(param->window.p,
			       get_texture_form(indice),
			       &(param->tab_texture_form[indice].y),
			       &(param->tab_texture_form[indice].x))) == NULL)
      {
	my_putstr("Error load texture : ", 2, -1);
	my_putstr(get_texture_form(indice), 2, -1);
	my_putstr("\n", 2, -1);
	return (0);
      }
  return (1);
}