render.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* render.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: omougel <omougel@student.42.fr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2024/07/26 12:23:12 by omougel #+# #+# */ 9 /* Updated: 2024/10/15 13:00:18 by ll-hotel ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include "cub3D.h" 14 #include "img_put_pixel.h" 15 16 void cube_render(t_cube *cube) 17 { 18 t_ray ray; 19 int x; 20 21 img_put_rect(&cube->mlx.img, point(0, 0), \ 22 point(SCREEN_WIDTH, SCREEN_HEIGHT / 2), \ 23 cube->c_colour); 24 img_put_rect(&cube->mlx.img, point(0, SCREEN_HEIGHT / 2), \ 25 point(SCREEN_WIDTH, SCREEN_HEIGHT), \ 26 cube->f_colour); 27 x = 0; 28 while (x < SCREEN_WIDTH) 29 { 30 ray_init_dda(&ray, &cube->player, x); 31 ray_perform_dda(&ray, cube); 32 ray_find_drawing_limits(&ray); 33 render_texture(&ray, cube, x); 34 x += RAY_WIDTH; 35 } 36 render_minimap(cube); 37 cube_put_image(cube); 38 }