42_solong/draw.c
Camille Chauvet c179afd6ec kekw
2022-12-22 17:41:31 +01:00

45 lines
1.5 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* draw.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/13 15:49:23 by cchauvet #+# #+# */
/* Updated: 2022/12/14 18:14:38 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "solong.h"
void ft_draw_pixel(void *window_manager, void *window, t_pixel pixel)
{
void *img;
int bozo;
img = mlx_xpm_file_to_image(window_manager, PIXEL_PATH, &bozo, &bozo);
mlx_put_image_to_window(window_manager, window, img, pixel.x, pixel.y);
}
void ft_draw_square(void *window_manager, void *window, t_square square)
{
int y;
int x;
t_pixel pixel;
pixel.color = square.color;
y = square.y;
while (y < square.size + square.y)
{
pixel.y = y;
x = square.x;
while (x < square.size + square.x)
{
pixel.x = x;
ft_draw_pixel(window_manager, window, pixel);
x++;
}
y++;
}
}