aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_suffer_animation.c
blob: 4e77ca79776384529143f83982097eaa213d9946 (plain)
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   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>

void
	ft_suffer_animation(t_cub *cl)
{
	uint16_t	x;
	uint16_t	y;
	uint8_t		i;

	i = 0;
	while (i < 8)
	{
		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);
		x = 0;
		y = 0;
		while (y < cl->wlist.y_size)
		{
			while (x < cl->wlist.x_size)
			{
				*(int*)(cl->img.ptr +
					(x * 4 + (y * cl->img.sizeline))) = 0x00ce1212;
				x++;
			}
			x = 0;
			y++;
		}
		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);
		i++;
	}
}