You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.4 KiB
36 lines
1.4 KiB
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* utils.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/08/23 08:45:14 by narnaud #+# #+# */
|
|
/* Updated: 2022/08/23 16:05:12 by narnaud ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "../../includes/cub3d.h"
|
|
|
|
void draw_rectangle(t_env *env, t_rect rect, int borders)
|
|
{
|
|
t_vec step;
|
|
|
|
step.y = 0;
|
|
while (step.y < rect.size.y)
|
|
{
|
|
step.x = 0;
|
|
while (step.x < rect.size.x)
|
|
{
|
|
if (borders && \
|
|
(step.x == rect.size.x - 1 || step.y == rect.size.y - 1))
|
|
env->buffer[(env->line_bytes * (int)(rect.start.y + step.y)) \
|
|
+ (int)(rect.start.x + step.x)] = 0;
|
|
else
|
|
env->buffer[(env->line_bytes * (int)(rect.start.y + step.y)) \
|
|
+ (int)(rect.start.x + step.x)] = rect.color;
|
|
step.x++;
|
|
}
|
|
step.y++;
|
|
}
|
|
}
|
|
|