diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2020-03-11 18:59:58 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2020-03-11 18:59:58 +0100 |
commit | b6388b5101d8187f746f91c89842e932a1d01cb6 (patch) | |
tree | 70bd9ba7012f5906db01b485ec8f58f5a4697240 /src/ft_suffer_animation.c | |
parent | close but no cigar (diff) | |
parent | ca tue (diff) | |
download | 42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.gz 42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.bz2 42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.xz 42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.zst 42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.zip |
get merged
Diffstat (limited to '')
-rw-r--r-- | src/ft_suffer_animation.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ft_suffer_animation.c b/src/ft_suffer_animation.c new file mode 100644 index 0000000..b800a39 --- /dev/null +++ b/src/ft_suffer_animation.c @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_key_loop.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/17 20:06:26 by rbousset #+# #+# */ +/* Updated: 2020/02/17 20:06:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <mlx.h> +#include <stdint.h> +#include <unistd.h> + +void + ft_suffer_animation(t_cub *cl) +{ + int32_t x; + int32_t y; + t_rgb rgb; + + y = -1; + while (++y < (int32_t)cl->wlist.y_size) + { + x = -1; + while (++x < (int32_t)cl->wlist.x_size) + { + rgb = ft_hex_to_og_rgb(*(int*)(cl->img.ptr + + (x * 4 + (y * cl->img.sizeline)))); + rgb.r += 150; + rgb.g += 20; + rgb.b += 20; + *(int*)(cl->img.ptr + + (x * 4 + (y * cl->img.sizeline))) = ft_rgb_to_hex(rgb); + } + } + cl->plist.life -= 20; + if (cl->plist.life <= 0) + ft_exit(0, cl); + /* TODO death screen here */ + cl->doicast = 0; +} |