changed functions draw line and pixel to receive an img ptr instead of the whole structure

This commit is contained in:
hugogogo
2022-04-24 19:41:44 +02:00
parent bb3a9db930
commit a11ea35ac1
6 changed files with 46 additions and 32 deletions

View File

@@ -32,9 +32,25 @@
void draw_column(t_game *game, t_rcast *rcast, t_vec *ray)
{
t_vec wall;
(void)game;
(void)rcast;
(void)ray;
(void)wall;
wall.start.x = rcast->ray_nb;
wall.end.x = rcast->ray_nb;
if (rcast->is_x == 1 && rcast->slope_y != 0)
{
rcast->wall_height = rcast->next_x - rcast->ray_step_x;
rcast->wall_height /= ft_abs(rcast->slope_y);
rcast->wall_height /= 2;
//printf("rcast->wall: %i\n", rcast->wall_height);
wall.start.y = rcast->screen_center / 2 + rcast->wall_height;
wall.end.y = rcast->screen_center / 2 - rcast->wall_height;
}
// draw_line(&game->img, wall, 0x00FF0000);
}
void raycast(t_game *game, t_rcast *rcast)
@@ -48,7 +64,7 @@ void raycast(t_game *game, t_rcast *rcast)
// tmp, to draw the map
calcul_ray_end(rcast, &ray);
draw_line(game, ray, 0x00FF00FF);
draw_line(&game->map_img, ray, 0x00FF00FF);
// tmp end
draw_column(game, rcast, &ray);