-
Notifications
You must be signed in to change notification settings - Fork 0
/
cub3d_draw_rainbow.c
executable file
·36 lines (33 loc) · 1.22 KB
/
cub3d_draw_rainbow.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cub3d_draw_rainbow.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mg <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/07 11:49:06 by mg #+# #+# */
/* Updated: 2020/10/07 15:01:08 by mg ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void c3d_draw_rainbow(t_param *cub3d)
{
int x;
int y;
int color;
int w;
int h;
x = cub3d->window.width;
w = x;
while (x--)
{
y = cub3d->window.height;
h = y;
while (y--)
{
color = (x * 255) / w +
((((w - x) * 255) / w) << 16) + (((y * 255) / h) << 8);
mlx_pixel_put(cub3d->mlx, cub3d->win, x, y, color);
}
}
}