/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_key_loop.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/17 20:06:26 by rbousset #+# #+# */ /* Updated: 2020/02/17 20:06:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include #include void ft_linux_suffer_animation(t_cub *cl) { int32_t x; int32_t y; y = -1; cl->img.img = mlx_new_image(cl->wlist.wlx, cl->wlist.x_size, cl->wlist.y_size); cl->img.ptr = mlx_get_data_addr(cl->img.img, &cl->img.bpp, &cl->img.sizeline, &cl->img.endian); while (++y < (int32_t)cl->wlist.y_size) { x = -1; while (++x < (int32_t)cl->wlist.x_size) { *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = 0x00880404; } } mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr, cl->img.img, 0, 0); mlx_destroy_image(cl->wlist.wlx, cl->img.img); cl->plist.life -= 20; if (cl->plist.life <= 0) { cl->plist.isdead = 1; ft_warp_level(cl->mlist.filename, cl); } /* TODO death screen here */ } void ft_macos_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_warp_level(cl->mlist.filename, cl); /* TODO death screen here */ cl->doicast = 0; }