aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-02-15 13:40:06 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-02-15 13:40:06 +0100
commitacc6558cbcd580392ca481e12b4f145f7995a0ea (patch)
tree6609226de205bf55227eba0117229421c96ed974
parentasdasd (diff)
download42-cub3d-acc6558cbcd580392ca481e12b4f145f7995a0ea.tar.gz
42-cub3d-acc6558cbcd580392ca481e12b4f145f7995a0ea.tar.bz2
42-cub3d-acc6558cbcd580392ca481e12b4f145f7995a0ea.tar.xz
42-cub3d-acc6558cbcd580392ca481e12b4f145f7995a0ea.tar.zst
42-cub3d-acc6558cbcd580392ca481e12b4f145f7995a0ea.zip
swap east and west, add texture init function
-rw-r--r--Makefile1
-rw-r--r--map/map_one.cub4
-rw-r--r--src/ft_get_player_spawn.c4
-rw-r--r--src/ft_tex_init.c31
4 files changed, 21 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 3f90942..21177eb 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,7 @@ SRCS_NAME += ft_rgb_to_hex.c
SRCS_NAME += ft_raycasting.c
SRCS_NAME += ft_init_s_ray.c
SRCS_NAME += ft_init_map.c
+SRCS_NAME += ft_tex_init.c
SRCS_NAME += ft_detect.c
#--------------------------------------------------------------------------------------------------#
SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME})
diff --git a/map/map_one.cub b/map/map_one.cub
index a74d6c1..1a8de2b 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -16,10 +16,10 @@ F 150,150,145
1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1
1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 0 1
1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1
-1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1
+1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 E 0 1
1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 1 0 0 0 1
1 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1
-1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 N 0 1
+1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 0 0 1
1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c
index 4e392e8..fa99fdf 100644
--- a/src/ft_get_player_spawn.c
+++ b/src/ft_get_player_spawn.c
@@ -61,11 +61,11 @@ static void
ft_get_start_side(char c, t_player *pl)
{
if (c == 'E')
- ft_get_e_dir(pl);
+ ft_get_w_dir(pl);
else if (c == 'S')
ft_get_s_dir(pl);
else if (c == 'W')
- ft_get_w_dir(pl);
+ ft_get_e_dir(pl);
}
void
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index 7bc74f6..aba5338 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -12,6 +12,7 @@
#include <cub3d.h>
#include <stdint.h>
+#include <mlx.h>
/*
* 0 : no
@@ -23,24 +24,24 @@
void ft_wall_tex_init(t_cub *clist)
{
- clist->tlist[0].img = mlx_xpm_file_to_image(clist->wlx,
- clist->mlist->no_tex_path, &clist->tlist[0].xhud, &clist->tlist[0].yhud);
- clist->tlist[0].ptr = mlx_get_data_address(clist->tlist[0].img,
+ clist->tlist[0].img = mlx_xpm_file_to_image(clist->wlist->wlx,
+ clist->mlist->no_tex_path, &clist->tlist[0].img_w, &clist->tlist[0].img_h);
+ clist->tlist[0].ptr = mlx_get_data_addr(clist->tlist[0].img,
&clist->tlist[0].bpp, &clist->tlist[0].sizeline, &clist->tlist[0].endian);
- clist->tlist[1].img = mlx_xpm_file_to_image(clist->wlx,
- clist->mlist->so_tex_path, &clist->tlist[1].xhud, &clist->tlist[1].yhud);
- clist->tlist[1].ptr = mlx_get_data_address(clist->tlist[1].img,
+ clist->tlist[1].img = mlx_xpm_file_to_image(clist->wlist->wlx,
+ clist->mlist->so_tex_path, &clist->tlist[1].img_w, &clist->tlist[1].img_h);
+ clist->tlist[1].ptr = mlx_get_data_addr(clist->tlist[1].img,
&clist->tlist[1].bpp, &clist->tlist[1].sizeline, &clist->tlist[1].endian);
- clist->tlist[2].img = mlx_xpm_file_to_image(clist->wlx,
- clist->mlist->ea_tex_path, &clist->tlist[2].xhud, &clist->tlist[2].yhud);
- clist->tlist[2].ptr = mlx_get_data_address(clist->tlist[2].img,
+ clist->tlist[2].img = mlx_xpm_file_to_image(clist->wlist->wlx,
+ clist->mlist->ea_tex_path, &clist->tlist[2].img_w, &clist->tlist[2].img_h);
+ clist->tlist[2].ptr = mlx_get_data_addr(clist->tlist[2].img,
&clist->tlist[2].bpp, &clist->tlist[2].sizeline, &clist->tlist[2].endian);
- clist->tlist[3].img = mlx_xpm_file_to_image(clist->wlx,
- clist->mlist->we_tex_path, &clist->tlist[3].xhud, &clist->tlist[3].yhud);
- clist->tlist[3].ptr = mlx_get_data_address(clist->tlist[3].img,
+ clist->tlist[3].img = mlx_xpm_file_to_image(clist->wlist->wlx,
+ clist->mlist->we_tex_path, &clist->tlist[3].img_w, &clist->tlist[3].img_h);
+ clist->tlist[3].ptr = mlx_get_data_addr(clist->tlist[3].img,
&clist->tlist[3].bpp, &clist->tlist[3].sizeline, &clist->tlist[3].endian);
- clist->tlist[4].img = mlx_xpm_file_to_image(clist->wlx,
- clist->mlist->sprite_path, &clist->tlist[4].xhud, &clist->tlist[4].yhud);
- clist->tlist[4].ptr = mlx_get_data_address(clist->tlist[4].img,
+ clist->tlist[4].img = mlx_xpm_file_to_image(clist->wlist->wlx,
+ clist->mlist->sprite_path, &clist->tlist[4].img_w, &clist->tlist[4].img_h);
+ clist->tlist[4].ptr = mlx_get_data_addr(clist->tlist[4].img,
&clist->tlist[4].bpp, &clist->tlist[4].sizeline, &clist->tlist[4].endian);
}