-
Notifications
You must be signed in to change notification settings - Fork 0
/
put_pixel.c
26 lines (23 loc) · 1.18 KB
/
put_pixel.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* put_pixel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mehtel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/23 19:27:14 by mehtel #+# #+# */
/* Updated: 2021/03/23 19:27:16 by mehtel ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void pixel_put(t_vars *vars, int x, int y, int color)
{
char *dst;
dst = vars->data->addr + (y * vars->data->line_length + x
* (vars->data->bits_per_pixel / 8));
if (x >= 0
&& y >= 0
&& x < vars->map->resolution_width
&& y < vars->map->resolution_hight)
*(unsigned int*)dst = color;
}