1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_draw_hud.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/22 20:02:47 by rbousset #+# #+# */
/* Updated: 2020/02/22 20:02:48 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <cub3d.h>
#include <stdint.h>
#include <pthread.h>
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);
}
|