From d4f37d1afee5b22213b0841ed20cb2f74e027d1b Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 17 Feb 2020 16:54:55 +0100 Subject: Norme --- src/ft_tex_init.c | 68 ++++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) (limited to 'src/ft_tex_init.c') diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index fc0a9dd..166f431 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -13,54 +13,46 @@ #include #include #include -#include #include /* - * 0 : no - * 1 : so - * 2 : ea - * 3 : we - * 4 : sprite - **/ +** 0 : no +** 1 : so +** 2 : ea +** 3 : we +** 4 : sprite +*/ -void ft_puttex(t_cub *clist) +void ft_puttex(t_cub *cl) { int i; i = 0; - while (i < clist->tlist[0].img_w) - { - printf("no : img : %p data : %s, height : %d i : %d\n", clist->tlist[0].img, clist->tlist[0].ptr + i, clist->tlist[0].img_w, i / 4); + while (i < cl->tlist[0].img_w) i += 4; - } - printf("%d\n", clist->w_side); - /*printf("so : img : %p data : %x, height : %d\n", clist->tlist[1].img, (unsigned int)clist->tlist[1].ptr, clist->tlist[1].img_w);*/ - /*printf("ea : img : %p data : %x, height : %d\n", clist->tlist[2].img, (unsigned int)clist->tlist[2].ptr, clist->tlist[2].img_w);*/ - /*printf("we : img : %p data : %x, height : %d\n", clist->tlist[3].img, (unsigned int)clist->tlist[3].ptr, clist->tlist[3].img_w);*/ } -void ft_wall_tex_init(t_cub *clist) +void ft_wall_tex_init(t_cub *cl) { - clist->tlist[0].img = mlx_xpm_file_to_image(clist->wlist->wlx, - clist->mlist->no_tex_path, &clist->tlist[0].img_w, &clist->tlist[0].img_h); - clist->tlist[0].ptr = mlx_get_data_addr(clist->tlist[0].img, - &clist->tlist[0].bpp, &clist->tlist[0].sizeline, &clist->tlist[0].endian); - clist->tlist[1].img = mlx_xpm_file_to_image(clist->wlist->wlx, - clist->mlist->so_tex_path, &clist->tlist[1].img_w, &clist->tlist[1].img_h); - clist->tlist[1].ptr = mlx_get_data_addr(clist->tlist[1].img, - &clist->tlist[1].bpp, &clist->tlist[1].sizeline, &clist->tlist[1].endian); - clist->tlist[2].img = mlx_xpm_file_to_image(clist->wlist->wlx, - clist->mlist->ea_tex_path, &clist->tlist[2].img_w, &clist->tlist[2].img_h); - clist->tlist[2].ptr = mlx_get_data_addr(clist->tlist[2].img, - &clist->tlist[2].bpp, &clist->tlist[2].sizeline, &clist->tlist[2].endian); - clist->tlist[3].img = mlx_xpm_file_to_image(clist->wlist->wlx, - clist->mlist->we_tex_path, &clist->tlist[3].img_w, &clist->tlist[3].img_h); - clist->tlist[3].ptr = mlx_get_data_addr(clist->tlist[3].img, - &clist->tlist[3].bpp, &clist->tlist[3].sizeline, &clist->tlist[3].endian); - clist->tlist[4].img = mlx_xpm_file_to_image(clist->wlist->wlx, - clist->mlist->sprite_path, &clist->tlist[4].img_w, &clist->tlist[4].img_h); - clist->tlist[4].ptr = mlx_get_data_addr(clist->tlist[4].img, - &clist->tlist[4].bpp, &clist->tlist[4].sizeline, &clist->tlist[4].endian); - ft_puttex(clist); + cl->tlist[0].img = mlx_xpm_file_to_image(cl->wlist->wlx, + cl->mlist->no_tex_path, &cl->tlist[0].img_w, &cl->tlist[0].img_h); + cl->tlist[0].ptr = mlx_get_data_addr(cl->tlist[0].img, + &cl->tlist[0].bpp, &cl->tlist[0].sizeline, &cl->tlist[0].endian); + cl->tlist[1].img = mlx_xpm_file_to_image(cl->wlist->wlx, + cl->mlist->so_tex_path, &cl->tlist[1].img_w, &cl->tlist[1].img_h); + cl->tlist[1].ptr = mlx_get_data_addr(cl->tlist[1].img, + &cl->tlist[1].bpp, &cl->tlist[1].sizeline, &cl->tlist[1].endian); + cl->tlist[2].img = mlx_xpm_file_to_image(cl->wlist->wlx, + cl->mlist->ea_tex_path, &cl->tlist[2].img_w, &cl->tlist[2].img_h); + cl->tlist[2].ptr = mlx_get_data_addr(cl->tlist[2].img, + &cl->tlist[2].bpp, &cl->tlist[2].sizeline, &cl->tlist[2].endian); + cl->tlist[3].img = mlx_xpm_file_to_image(cl->wlist->wlx, + cl->mlist->we_tex_path, &cl->tlist[3].img_w, &cl->tlist[3].img_h); + 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->tlist[4].ptr = mlx_get_data_addr(cl->tlist[4].img, + &cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian); + ft_puttex(cl); } -- cgit v1.2.3