/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_draw_hud.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: joelecle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/22 20:02:47 by joelecle #+# #+# */ /* Updated: 2020/02/22 20:02:48 by joelecle ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #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) { pthread_t tid[7]; pthread_create(&tid[0], 0x0, ft_ammo_back_thread, (void*)clist); pthread_create(&tid[1], 0x0, ft_minimap_back_thread, (void*)clist); pthread_join(tid[0], 0x0); pthread_join(tid[1], 0x0); pthread_create(&tid[2], 0x0, ft_map_thread, (void*)clist); pthread_create(&tid[3], 0x0, ft_life_bar_thread, (void*)clist); pthread_create(&tid[4], 0x0, ft_ammo_bar_thread, (void*)clist); pthread_create(&tid[5], 0x0, ft_health_cap_thread, (void*)clist); pthread_create(&tid[6], 0x0, ft_ammo_cap_thread, (void*)clist); pthread_join(tid[2], 0x0); pthread_join(tid[3], 0x0); pthread_join(tid[4], 0x0); pthread_join(tid[5], 0x0); pthread_join(tid[6], 0x0); if (clist->mlist.isnlvl) { ft_draw_stage_back(clist); } return (0); }