aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_tex_weap_init.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 13:28:52 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 13:28:52 +0100
commitf57f187a59840d07cd47058022c44d464ad76522 (patch)
tree22d7e5be602a8dbd21999e43760a1fc0d0b0fdb7 /src/ft_tex_weap_init.c
parentINTENSE mapping (diff)
download42-cub3d-f57f187a59840d07cd47058022c44d464ad76522.tar.gz
42-cub3d-f57f187a59840d07cd47058022c44d464ad76522.tar.bz2
42-cub3d-f57f187a59840d07cd47058022c44d464ad76522.tar.xz
42-cub3d-f57f187a59840d07cd47058022c44d464ad76522.tar.zst
42-cub3d-f57f187a59840d07cd47058022c44d464ad76522.zip
Loaded weapon images needs to memory
Diffstat (limited to '')
-rw-r--r--src/ft_tex_weap_init.c46
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);
+}