35 lines
1.3 KiB
C
35 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* render_circle.c :+: :+: */
|
|
/* +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
|
/* +#+ */
|
|
/* Created: 2025/04/17 20:06:19 by qmennen #+# #+# */
|
|
/* Updated: 2025/05/07 11:37:29 by whaffman ######## odam.nl */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "render.h"
|
|
|
|
void render_circle(t_screen *screen,
|
|
t_vec2 point, int radius, unsigned int color)
|
|
{
|
|
int i;
|
|
int size;
|
|
int x;
|
|
int y;
|
|
|
|
i = 0;
|
|
size = 2 * radius + 1;
|
|
while (i <= size * size)
|
|
{
|
|
x = i % size - radius;
|
|
y = i / size - radius;
|
|
if (x * x + y * y <= radius * radius)
|
|
mlx_put_pixel(screen->minimap,
|
|
(int) point.x + x, (int) point.y + y, color);
|
|
i++;
|
|
}
|
|
}
|