aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_init.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_tex_init.c62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index 5c0bed3..5e445ce 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -41,12 +41,52 @@
*/
static void
- ft_init_number(t_img *tnum, const char *path, t_cub *cl)
+ ft_init_numbers(t_cub *cl)
{
- tnum->img = mlx_xpm_file_to_image(cl->wlist.wlx,
- path, &tnum->img_w, &tnum->img_h);
- tnum->ptr = mlx_get_data_addr(tnum->img,
- &tnum->bpp, &tnum->sizeline, &tnum->endian);
+ cl->tnum[0].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_ZER_PATH, &cl->tnum[0].img_w, &cl->tnum[0].img_h);
+ cl->tnum[0].ptr = mlx_get_data_addr(cl->tnum[0].img,
+ &cl->tnum[0].bpp, &cl->tnum[0].sizeline, &cl->tnum[0].endian);
+ cl->tnum[1].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_ONE_PATH, &cl->tnum[1].img_w, &cl->tnum[1].img_h);
+ cl->tnum[1].ptr = mlx_get_data_addr(cl->tnum[1].img,
+ &cl->tnum[1].bpp, &cl->tnum[1].sizeline, &cl->tnum[1].endian);
+ cl->tnum[2].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_TWO_PATH, &cl->tnum[2].img_w, &cl->tnum[2].img_h);
+ cl->tnum[2].ptr = mlx_get_data_addr(cl->tnum[2].img,
+ &cl->tnum[2].bpp, &cl->tnum[2].sizeline, &cl->tnum[2].endian);
+ cl->tnum[3].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_THR_PATH, &cl->tnum[3].img_w, &cl->tnum[3].img_h);
+ cl->tnum[3].ptr = mlx_get_data_addr(cl->tnum[3].img,
+ &cl->tnum[3].bpp, &cl->tnum[3].sizeline, &cl->tnum[3].endian);
+ cl->tnum[4].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_FOU_PATH, &cl->tnum[4].img_w, &cl->tnum[4].img_h);
+ cl->tnum[4].ptr = mlx_get_data_addr(cl->tnum[4].img,
+ &cl->tnum[4].bpp, &cl->tnum[4].sizeline, &cl->tnum[4].endian);
+ cl->tnum[5].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_FIV_PATH, &cl->tnum[5].img_w, &cl->tnum[5].img_h);
+ cl->tnum[5].ptr = mlx_get_data_addr(cl->tnum[5].img,
+ &cl->tnum[5].bpp, &cl->tnum[5].sizeline, &cl->tnum[5].endian);
+ cl->tnum[6].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_SIX_PATH, &cl->tnum[6].img_w, &cl->tnum[6].img_h);
+ cl->tnum[6].ptr = mlx_get_data_addr(cl->tnum[6].img,
+ &cl->tnum[6].bpp, &cl->tnum[6].sizeline, &cl->tnum[6].endian);
+ cl->tnum[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_SEV_PATH, &cl->tnum[7].img_w, &cl->tnum[7].img_h);
+ cl->tnum[7].ptr = mlx_get_data_addr(cl->tnum[7].img,
+ &cl->tnum[7].bpp, &cl->tnum[7].sizeline, &cl->tnum[7].endian);
+ cl->tnum[8].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_EIG_PATH, &cl->tnum[8].img_w, &cl->tnum[8].img_h);
+ cl->tnum[8].ptr = mlx_get_data_addr(cl->tnum[8].img,
+ &cl->tnum[8].bpp, &cl->tnum[8].sizeline, &cl->tnum[8].endian);
+ cl->tnum[9].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_NIN_PATH, &cl->tnum[9].img_w, &cl->tnum[9].img_h);
+ cl->tnum[9].ptr = mlx_get_data_addr(cl->tnum[9].img,
+ &cl->tnum[9].bpp, &cl->tnum[9].sizeline, &cl->tnum[9].endian);
+ cl->tnum[10].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ FT_PER_PATH, &cl->tnum[10].img_w, &cl->tnum[10].img_h);
+ cl->tnum[10].ptr = mlx_get_data_addr(cl->tnum[10].img,
+ &cl->tnum[10].bpp, &cl->tnum[10].sizeline, &cl->tnum[10].endian);
}
static void
@@ -96,17 +136,7 @@ static void
FT_WEAPON_TWO_SPR_PATH, &cl->tlist[19].img_w, &cl->tlist[19].img_h);
cl->tlist[19].ptr = mlx_get_data_addr(cl->tlist[19].img,
&cl->tlist[19].bpp, &cl->tlist[19].sizeline, &cl->tlist[19].endian);
- ft_init_number(&cl->tnum[0], FT_ZER_PATH, cl);
- ft_init_number(&cl->tnum[1], FT_ONE_PATH, cl);
- ft_init_number(&cl->tnum[2], FT_TWO_PATH, cl);
- ft_init_number(&cl->tnum[3], FT_THR_PATH, cl);
- ft_init_number(&cl->tnum[4], FT_FOU_PATH, cl);
- ft_init_number(&cl->tnum[5], FT_FIV_PATH, cl);
- ft_init_number(&cl->tnum[6], FT_SIX_PATH, cl);
- ft_init_number(&cl->tnum[7], FT_SEV_PATH, cl);
- ft_init_number(&cl->tnum[8], FT_EIG_PATH, cl);
- ft_init_number(&cl->tnum[9], FT_NIN_PATH, cl);
- ft_init_number(&cl->tnum[10], FT_PER_PATH, cl);
+ ft_init_numbers(cl);
cl->walltexgood = 1;
if (cl->mlist.sprite_var > 1)
ft_next_sprite_init(cl);