-
Notifications
You must be signed in to change notification settings - Fork 0
/
shapes.c
44 lines (39 loc) · 1.38 KB
/
shapes.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
37
38
39
40
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* shapes.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hgrissen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/04 13:45:40 by hgrissen #+# #+# */
/* Updated: 2021/11/05 18:10:07 by hgrissen ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void my_mlx_pixel_put(t_mlx *data, int x, int y, int color)
{
char *dst;
if (x < g_width && x >= 0 && y < g_height && y >= 0)
{
dst = data->addr + (y * data->ll + x * (data->bpp / 8));
*(unsigned int *) dst = color;
}
}
void rect(t_mlx *mlx, int x, int y, t_img tex)
{
int i;
int j;
int pos;
i = y;
while (i < y + TILESIZE)
{
j = x;
while (j < x + TILESIZE)
{
pos = ((i - y) * TILESIZE + (j - x));
my_mlx_pixel_put(mlx, j, i, tex.addr[pos]);
j++;
}
i++;
}
}