/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_draw_hud.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/22 20:02:47 by rbousset #+# #+# */ /* Updated: 2020/02/22 20:02:48 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include static void ft_draw_stage_back(t_cub *clist) { float x; uint32_t y; int32_t col; uint16_t x_dest; const uint16_t scl = clist->mlist.scale; col = 0x00353535; x = 0; y = clist->wlist.y_size - (clist->mlist.map_h * scl) - 45; x_dest = 1.5 * clist->mlist.scale + 70; while (x_dest > (clist->mlist.map_w * scl) + 20) x_dest--; while (x < x_dest) { while (y < clist->wlist.y_size - (clist->mlist.map_h * scl) - 20) { *(int*)(clist->img.ptr + ((uint16_t)x * 4 + (y * clist->img.sizeline))) = col; y++; } y = clist->wlist.y_size - (clist->mlist.map_h * scl) - 45; x += 1.0; } } int8_t ft_draw_hud(t_cub *clist) { ft_draw_ammo_back(clist); ft_draw_minimap_back(clist); ft_draw_map(clist->mlist.map, clist); ft_draw_life_bar(clist); ft_draw_ammo_bar(clist); ft_draw_health_caption(clist); ft_draw_ammo_caption(clist); if (clist->mlist.isnlvl) { ft_draw_stage_back(clist); } return (0); }