add init textures

This commit is contained in:
hugogogo
2022-05-02 16:11:54 +02:00
parent a6fd2df6d5
commit 628a0c0cad
9 changed files with 113 additions and 75 deletions

15
srcs/init/init_textures.c Normal file
View File

@@ -0,0 +1,15 @@
#include "cube3d.h"
static void init_txtr_img(t_img *img, void *mlx_ptr, char *path)
{
img->ptr = mlx_xpm_file_to_image(mlx_ptr, path, &img->width, &img->height);
img->data = mlx_get_data_addr(img->ptr, &img->bpp, &img->szl, &img->ndn);
}
void init_txtr(t_txt *txt, void *mlx_ptr)
{
init_txtr_img(&txt->img_n, mlx_ptr, txt->txt_north);
init_txtr_img(&txt->img_n, mlx_ptr, txt->txt_south);
init_txtr_img(&txt->img_n, mlx_ptr, txt->txt_east);
init_txtr_img(&txt->img_n, mlx_ptr, txt->txt_west);
}