diff options
| author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-23 16:48:23 +0100 | 
|---|---|---|
| committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-23 16:48:23 +0100 | 
| commit | 30c98bdd426e0421ea9b9b993e0eda4ddf16d07e (patch) | |
| tree | d693d5530f8332818dc520bfedf9ce59ec51574e | |
| parent | New file for life bars drawing (diff) | |
| download | 42-cub3d-30c98bdd426e0421ea9b9b993e0eda4ddf16d07e.tar.gz 42-cub3d-30c98bdd426e0421ea9b9b993e0eda4ddf16d07e.tar.bz2 42-cub3d-30c98bdd426e0421ea9b9b993e0eda4ddf16d07e.tar.xz 42-cub3d-30c98bdd426e0421ea9b9b993e0eda4ddf16d07e.tar.zst 42-cub3d-30c98bdd426e0421ea9b9b993e0eda4ddf16d07e.zip  | |
life bar is fucked up but okok
Diffstat (limited to '')
| -rw-r--r-- | inc/cub3d.h | 6 | ||||
| -rw-r--r-- | src/ft_draw_life_bar.c | 24 | 
2 files changed, 22 insertions, 8 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h index e8e3249..4c4e22b 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -85,7 +85,9 @@ void				ft_draw_texture(t_cub *cl, int x, int y, int tex_y);  int8_t				ft_check_not_found(const char *path);  void				ft_calc_tex(t_cub *clist);  void				ft_draw_hud(t_cub *clist); -void				ft_draw_life_bar(size_t map_w, uint16_t scale, -									int8_t life, t_cub *cl); +void				ft_draw_life_bar(size_t map_w, +									const uint16_t scale, +									const int8_t life, +									t_cub *cl);  #	endif diff --git a/src/ft_draw_life_bar.c b/src/ft_draw_life_bar.c index ae02edb..bfe642b 100644 --- a/src/ft_draw_life_bar.c +++ b/src/ft_draw_life_bar.c @@ -2,15 +2,27 @@  #include <stdint.h>  void -	ft_draw_life_bar(size_t map_w, uint16_t scale, int8_t life, t_cub *cl) +	ft_draw_life_bar(size_t map_w, +					const uint16_t scale, +					const int8_t life, +					t_cub *cl)  { -	(void)map_w; -	(void)scale; -	(void)life; -	(void)cl;  	uint32_t		x;  	uint32_t		y;  	int32_t			col; -	col = 0x00229037; +	(void)life; +	col = 0x0022fa38; +	x = (map_w * scale) + (scale * 15); +	y = cl->wlist->y_size - (scale * 4); +	while (x < cl->wlist->x_size - (map_w * scale) - (scale  * 15)) +	{ +		while (y < cl->wlist->y_size - (scale * 2)) +		{ +			*(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = col; +			y++; +		} +		y = cl->wlist->y_size - (scale * 4); +		x++; +	}  }  | 
