From f57f187a59840d07cd47058022c44d464ad76522 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 19 Mar 2020 13:28:52 +0100 Subject: Loaded weapon images needs to memory --- src/ft_tex_weap_init.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/ft_tex_weap_init.c (limited to 'src/ft_tex_weap_init.c') 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- +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:43:55 by fmoenne- #+# #+# */ +/* Updated: 2020/02/14 17:43:56 by fmoenne- ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include +#include + +/* +** 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); +} -- cgit v1.2.3