1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_tex_weap_init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: water_ma <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:43:55 by water_ma #+# #+# */
/* Updated: 2020/02/14 17:43:56 by water_ma ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <cub3d.h>
#include <mlx.h>
/*
** tweap[] index summary
** ---------------------
** 0: weapon one
** 1: weapon one fire
** 2: weapon two
** 3: weapon two fire
** 4: weapon three
** 5: weapon three 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);
cl->tweap[4].img = mlx_xpm_file_to_image(cl->wlist.wlx,
FT_WEAPON_THREE_PATH, &cl->tweap[4].img_w, &cl->tweap[4].img_h);
cl->tweap[4].ptr = mlx_get_data_addr(cl->tweap[4].img,
&cl->tweap[4].bpp, &cl->tweap[4].sizeline, &cl->tweap[4].endian);
cl->tweap[5].img = mlx_xpm_file_to_image(cl->wlist.wlx,
FT_WEAPON_THREE_FIRE_PATH,
&cl->tweap[5].img_w, &cl->tweap[5].img_h);
cl->tweap[5].ptr = mlx_get_data_addr(cl->tweap[5].img,
&cl->tweap[5].bpp, &cl->tweap[5].sizeline, &cl->tweap[5].endian);
}
|