diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-02 02:29:21 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-02 02:29:21 +0100 |
commit | ee87f5ee4aa1c79d1dedf95994a392282aa4bd16 (patch) | |
tree | d438d5e46a10aa4d11dd670f9e0469ce257f426a | |
parent | OSEF again (diff) | |
download | 42-cub3d-ee87f5ee4aa1c79d1dedf95994a392282aa4bd16.tar.gz 42-cub3d-ee87f5ee4aa1c79d1dedf95994a392282aa4bd16.tar.bz2 42-cub3d-ee87f5ee4aa1c79d1dedf95994a392282aa4bd16.tar.xz 42-cub3d-ee87f5ee4aa1c79d1dedf95994a392282aa4bd16.tar.zst 42-cub3d-ee87f5ee4aa1c79d1dedf95994a392282aa4bd16.zip |
Music is bav but can't kill
Diffstat (limited to '')
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 2 | ||||
-rw-r--r-- | src/ft_exit.c | 2 | ||||
-rw-r--r-- | src/ft_treat_args.c | 6 |
4 files changed, 5 insertions, 7 deletions
@@ -147,7 +147,7 @@ ifeq (${OS}, Darwin) ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm -framework OpenGL \ -framework AppKit else - ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd -lpthread + ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd -pthread endif #--------------------------------------------------------------------------------------------------# all: ${NAME} diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 2026a27..0ad986c 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -15,6 +15,7 @@ #include <stddef.h> #include <stdint.h> +#include <pthread.h> typedef struct s_win { @@ -138,6 +139,7 @@ typedef struct s_cub uint16_t i; char errmsg[64]; int32_t key_input[5]; + pthread_t tid; int (*key_ptr[6])(struct s_cub*); int8_t (*get_ptr[11])(char**, struct s_cub*); struct s_win *wlist; diff --git a/src/ft_exit.c b/src/ft_exit.c index 423350d..493e00f 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -53,7 +53,7 @@ int mlx_destroy_image(clist->wlist->wlx, clist->tlist[3].img); if (clist->tlist[4].img) mlx_destroy_image(clist->wlist->wlx, clist->tlist[4].img); - if (clist->mlist->isnlvl && clist->tlist[5].img) + if (clist->tlist[5].img && clist->mlist->isnlvl) mlx_destroy_image(clist->wlist->wlx, clist->tlist[5].img); } if (clist->wlist->inited) diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c index 338b54f..dab29ac 100644 --- a/src/ft_treat_args.c +++ b/src/ft_treat_args.c @@ -32,8 +32,6 @@ uint8_t uint8_t ft_use_args(int argc, const char *argv[], t_cub *clist) { - pthread_t tid; - if (argc < 3) { if (ft_init_winptr(clist) < 0) @@ -41,9 +39,7 @@ uint8_t ft_draw_scene(clist); if (clist->mlist->ismusic) { - pthread_create(&tid, NULL, ft_music_thread, clist); - /* pthread_join(tid, NULL); */ - + pthread_create(&clist->tid, NULL, ft_music_thread, clist); } ft_hooks_and_loops(clist->wlist, clist); } |