aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_hud.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_draw_hud.c')
-rw-r--r--src/ft_draw_hud.c91
1 files changed, 89 insertions, 2 deletions
diff --git a/src/ft_draw_hud.c b/src/ft_draw_hud.c
index a10b2f3..6e4f86f 100644
--- a/src/ft_draw_hud.c
+++ b/src/ft_draw_hud.c
@@ -12,6 +12,7 @@
#include <cub3d.h>
#include <stdint.h>
+#include <pthread.h>
static void
ft_draw_stage_back(t_cub *clist)
@@ -41,16 +42,102 @@ static void
}
}
-int8_t
- ft_draw_hud(t_cub *clist)
+void
+*ft_ammo_back_thread(void *vargp)
{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_ammo_back(clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+*ft_minimap_back_thread(void *vargp)
+{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_minimap_back(clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+*ft_map_thread(void *vargp)
+{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_map(clist->mlist.map, clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+*ft_life_bar_thread(void *vargp)
+{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_life_bar(clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+*ft_ammo_bar_thread(void *vargp)
+{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_ammo_bar(clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+*ft_health_cap_thread(void *vargp)
+{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_health_caption(clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+*ft_ammo_cap_thread(void *vargp)
+{
+ t_cub *clist;
+
+ clist = (t_cub *)vargp;
ft_draw_ammo_caption(clist);
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+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);