diff options
Diffstat (limited to 'src/ft_tex_init.c')
-rw-r--r-- | src/ft_tex_init.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index 0290a0c..cae07bd 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -38,18 +38,17 @@ static void ft_next_sprite_init(t_cub *cl) { - uint16_t i; + uint8_t i; - i = 8; - cl->tlist[i].img = mlx_xpm_file_to_image(cl->wlist.wlx, - "./media/img/larry.xpm", &cl->tlist[i].img_w, &cl->tlist[i].img_h); - cl->tlist[i].ptr = mlx_get_data_addr(cl->tlist[i].img, - &cl->tlist[i].bpp, &cl->tlist[i].sizeline, &cl->tlist[i].endian); - i++; - cl->tlist[i].img = mlx_xpm_file_to_image(cl->wlist.wlx, - "./media/img/crapaud.xpm", &cl->tlist[i].img_w, &cl->tlist[i].img_h); - cl->tlist[i].ptr = mlx_get_data_addr(cl->tlist[i].img, - &cl->tlist[i].bpp, &cl->tlist[i].sizeline, &cl->tlist[i].endian); + i = 1; + while (cl->mlist.sprite_path[i][0]) + { + cl->tlist[i + 7].img = mlx_xpm_file_to_image(cl->wlist.wlx, + cl->mlist.sprite_path[i], &cl->tlist[i + 7].img_w, &cl->tlist[i + 7].img_h); + cl->tlist[i + 7].ptr = mlx_get_data_addr(cl->tlist[i + 7].img, + &cl->tlist[i + 7].bpp, &cl->tlist[i + 7].sizeline, &cl->tlist[i + 7].endian); + i++; + } } static void @@ -71,9 +70,9 @@ static void } cl->walltexgood = 1; if (cl->mlist.sprite_var > 1) - { - ft_next_sprite_init(cl); - } + { + ft_next_sprite_init(cl); + } } static void @@ -123,7 +122,7 @@ void cl->tlist[3].ptr = mlx_get_data_addr(cl->tlist[3].img, &cl->tlist[3].bpp, &cl->tlist[3].sizeline, &cl->tlist[3].endian); cl->tlist[4].img = mlx_xpm_file_to_image(cl->wlist.wlx, - cl->mlist.sprite_path, &cl->tlist[4].img_w, &cl->tlist[4].img_h); + cl->mlist.sprite_path[0], &cl->tlist[4].img_w, &cl->tlist[4].img_h); cl->tlist[4].ptr = mlx_get_data_addr(cl->tlist[4].img, &cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian); ft_wall_tex_init_norme(cl); |