diff options
Diffstat (limited to '')
-rw-r--r-- | ft_draw_textures.c | 16 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 6 | ||||
-rw-r--r-- | src/ft_tex_init.c | 46 |
3 files changed, 68 insertions, 0 deletions
diff --git a/ft_draw_textures.c b/ft_draw_textures.c new file mode 100644 index 0000000..5002daa --- /dev/null +++ b/ft_draw_textures.c @@ -0,0 +1,16 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_basic_keys.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 <cub3d.h> +#include <stdint.h> + +void ft_draw_wall(on est al) diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index eee6188..1bf2bca 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -34,6 +34,11 @@ typedef struct s_img int bpp; int sizeline; int endian; + int img_w; + int img_h; + int tex_x; + int tex_y; + } t_img; typedef struct s_rgb @@ -111,6 +116,7 @@ typedef struct s_cub struct s_img img; struct s_rgb f_rgb; struct s_rgb c_rgb; + struct s_img tlist[5]; } t_cub; # endif diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c new file mode 100644 index 0000000..7bc74f6 --- /dev/null +++ b/src/ft_tex_init.c @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_basic_keys.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 <cub3d.h> +#include <stdint.h> + +/* + * 0 : no + * 1 : so + * 2 : ea + * 3 : we + * 4 : sprite + **/ + +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].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].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].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].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].bpp, &clist->tlist[4].sizeline, &clist->tlist[4].endian); +} |