diff options
author | Rudy Bousset <rbousset@z2r4p1.le-101.fr> | 2020-03-11 20:15:00 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r4p1.le-101.fr> | 2020-03-11 20:15:00 +0100 |
commit | 36fd2e8918b4c30e30077e86028e0dec622a9599 (patch) | |
tree | ef7311b795027dfcf8c7dec89d08ba98bbd04f8f /src/ft_draw_hud.c | |
parent | ca tue (diff) | |
download | 42-cub3d-36fd2e8918b4c30e30077e86028e0dec622a9599.tar.gz 42-cub3d-36fd2e8918b4c30e30077e86028e0dec622a9599.tar.bz2 42-cub3d-36fd2e8918b4c30e30077e86028e0dec622a9599.tar.xz 42-cub3d-36fd2e8918b4c30e30077e86028e0dec622a9599.tar.zst 42-cub3d-36fd2e8918b4c30e30077e86028e0dec622a9599.zip |
life is bav
Diffstat (limited to 'src/ft_draw_hud.c')
-rw-r--r-- | src/ft_draw_hud.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/ft_draw_hud.c b/src/ft_draw_hud.c index 486112d..eb329c6 100644 --- a/src/ft_draw_hud.c +++ b/src/ft_draw_hud.c @@ -11,10 +11,38 @@ /* ************************************************************************** */ #include <cub3d.h> -#include <mlx.h> #include <stdint.h> static void + ft_draw_life_back(t_win *wl, t_cub *cl) +{ + const uint16_t scl = cl->mlist.scale; + uint32_t x; + uint32_t y; + int32_t col; + + col = 0x00353535; + x = (cl->mlist.map_w * scl) + 20; + y = wl->y_size - (cl->mlist.map_h * scl) - 20; + while (x < ((cl->mlist.map_w * scl) + 20) + (3 * scl)) + { + while (y < wl->y_size) + { + *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = col; + if (!(y % 3)) + { + if (col < 0x00aaaaaa) + col += 0x00010101; + } + y++; + } + col = 0x00353535; + y = wl->y_size - (cl->mlist.map_h * scl) - 20; + x++; + } +} + +static void ft_draw_minimap_back(size_t map_h, size_t map_w, t_win *wl, t_cub *cl) { const uint16_t scl = cl->mlist.scale; @@ -79,6 +107,8 @@ int8_t ft_draw_minimap_back(clist->mlist.map_h, clist->mlist.map_w, &clist->wlist, clist); ft_draw_map(clist->mlist.map, clist); + ft_draw_life_back(&clist->wlist, clist); + ft_draw_life_bar(&clist->wlist, clist); if (clist->mlist.isnlvl) { ft_draw_stage_back(clist); |