diff options
Diffstat (limited to 'src/ft_tex_weap_init.c')
-rw-r--r-- | src/ft_tex_weap_init.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ft_tex_weap_init.c b/src/ft_tex_weap_init.c new file mode 100644 index 0000000..ac78de9 --- /dev/null +++ b/src/ft_tex_weap_init.c @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_tex_weap_init.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: fmoenne- <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:43:55 by fmoenne- #+# #+# */ +/* Updated: 2020/02/14 17:43:56 by fmoenne- ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> +#include <stdio.h> +#include <mlx.h> + +/* +** tweap[] index summary +** 0: weapon one +** 1: weapon one fire +** 2: weapon two +** 3: weapon two fire +*/ + +void + ft_weap_tex_init(t_cub *cl) +{ + cl->tweap[0].img = mlx_xpm_file_to_image(cl->wlist.wlx, + FT_WEAPON_ONE_PATH, &cl->tweap[0].img_w, &cl->tweap[0].img_h); + cl->tweap[0].ptr = mlx_get_data_addr(cl->tweap[0].img, + &cl->tweap[0].bpp, &cl->tweap[0].sizeline, &cl->tweap[0].endian); + cl->tweap[1].img = mlx_xpm_file_to_image(cl->wlist.wlx, + FT_WEAPON_ONE_FIRE_PATH, &cl->tweap[1].img_w, &cl->tweap[1].img_h); + cl->tweap[1].ptr = mlx_get_data_addr(cl->tweap[1].img, + &cl->tweap[1].bpp, &cl->tweap[1].sizeline, &cl->tweap[1].endian); + cl->tweap[2].img = mlx_xpm_file_to_image(cl->wlist.wlx, + FT_WEAPON_TWO_PATH, &cl->tweap[2].img_w, &cl->tweap[2].img_h); + cl->tweap[2].ptr = mlx_get_data_addr(cl->tweap[2].img, + &cl->tweap[2].bpp, &cl->tweap[2].sizeline, &cl->tweap[2].endian); + cl->tweap[3].img = mlx_xpm_file_to_image(cl->wlist.wlx, + FT_WEAPON_TWO_FIRE_PATH, &cl->tweap[3].img_w, &cl->tweap[3].img_h); + cl->tweap[3].ptr = mlx_get_data_addr(cl->tweap[3].img, + &cl->tweap[3].bpp, &cl->tweap[3].sizeline, &cl->tweap[3].endian); +} |