diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | inc/cub3d.h | 1 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 2 | ||||
-rw-r--r-- | src/ft_draw_hud.c | 13 | ||||
-rw-r--r-- | src/ft_draw_scene.c | 4 | ||||
-rw-r--r-- | src/ft_extra_keys.c | 8 | ||||
-rw-r--r-- | src/ft_init_lists.c | 2 |
7 files changed, 23 insertions, 8 deletions
@@ -58,6 +58,7 @@ SRCS_NAME += ft_draw_textures.c SRCS_NAME += ft_key_release.c SRCS_NAME += ft_convert_keycode.c SRCS_NAME += ft_key_loop.c +SRCS_NAME += ft_draw_hud.c #--------------------------------------------------------------------------------------------------# SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME}) #--------------------------------------------------------------------------------------------------# diff --git a/inc/cub3d.h b/inc/cub3d.h index 09ea32e..7ebf492 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -84,5 +84,6 @@ void ft_draw_circle(int32_t a, int32_t b, void ft_draw_texture(t_cub *cl, int x, int y, int tex_y); int8_t ft_check_not_found(const char *path); void ft_calc_tex(t_cub *clist); +void ft_draw_hud(t_cub *clist); # endif diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 823a21b..639de11 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -114,7 +114,7 @@ typedef struct s_map typedef struct s_cub { uint8_t w_side; - uint8_t minimap; + uint8_t ishud; char errmsg[40]; int32_t key_input[5]; int (*key_ptr[6])(struct s_cub*); diff --git a/src/ft_draw_hud.c b/src/ft_draw_hud.c index 6c05f31..1564e2e 100644 --- a/src/ft_draw_hud.c +++ b/src/ft_draw_hud.c @@ -10,4 +10,17 @@ /* */ /* ************************************************************************** */ +#include <cub3d.h> +#include <mlx.h> +static void +ft_draw_hud_back(t_win *wl, t_cub *cl) +{ +} + +void + ft_draw_hud(t_cub *clist) +{ + ft_draw_hud_back(clist->wlist, clist); + ft_draw_map(clist->mlist->map, clist); +} diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 3bf453a..b5f2283 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -23,8 +23,8 @@ void clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, &clist->img.sizeline, &clist->img.endian); ft_castray(clist); - if (clist->minimap) - ft_draw_map(clist->mlist->map, clist); + if (clist->ishud) + ft_draw_hud(clist); mlx_put_image_to_window(clist->wlist->wlx, clist->wlist->winptr, clist->img.img, 0, 0); mlx_destroy_image(clist->wlist->wlx, clist->img.img); diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c index 39a297b..507f808 100644 --- a/src/ft_extra_keys.c +++ b/src/ft_extra_keys.c @@ -53,14 +53,14 @@ int int ft_f1_key(t_cub *clist) { - if (clist->minimap == 0) + if (clist->ishud == 0) { - clist->minimap = 1; + clist->ishud = 1; ft_draw_scene(clist); } - else if (clist->minimap == 1) + else if (clist->ishud == 1) { - clist->minimap = 0; + clist->ishud = 0; ft_draw_scene(clist); } return (0); diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index 0fa4ba2..5592358 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -81,7 +81,7 @@ static t_cub i = -1; while (++i < 5) clist->key_input[i] = -1; - clist->minimap = 0; + clist->ishud = 0; clist->f_rgb = ft_init_rgb(); clist->c_rgb = ft_init_rgb(); clist->rlist = ft_init_s_ray(); |