void ft_draw_img() { int x; int y; double wall_height; double wall_dist; x = WIN_WID - 1; while (x >= 0) { //printf("x = %d\n", x); wall_dist = ft_wall_distance(x); printf("Pour x = %d wall_dist->%f\n", x, wall_dist); //ft_putstr("\n"); wall_height = STEP / wall_dist * POV; printf("hauteur a l ecran = %f\n", wall_height); /*if (wall_height > WIN_HEI) wall_height = WIN_HEI - 1;*/ y = (WIN_HEI / 2) - 1 - (wall_height / 2); /* on dessine le plafond */ ft_draw_ceiling(x, y); /* on dessine le mur */ ft_draw_wall(wall_height, x, y); /* on dessine le floor */ ft_draw_floor(x, WIN_HEI / 2 + wall_height / 2 - 1); /*if (x == WIN_WID - 64) break ; */ x--; } }
static void setting_cf_text(t_env *e) { t_resume tmp; tmp.distWall = e->perpwalldist; tmp.distPlayer = 0.0; e->y = e->drawend + 1; the_dessin(e); while (e->y < LON) { tmp.currentDist = LON / (2.0 * e->y - LON); tmp.weight = (tmp.currentDist - tmp.distPlayer)\ / (tmp.distWall - tmp.distPlayer); tmp.currentFloorX = tmp.weight * e->floorXWall\ + (1.0 - tmp.weight) * e->posx; tmp.currentFloorY = tmp.weight * e->floorYWall\ + (1.0 - tmp.weight) * e->posy; e->floorTexX = (int)(tmp.currentFloorX * e->text[e->tid]->width)\ % e->text[e->tid]->width; e->floorTexY = (int)(tmp.currentFloorY * e->text[e->tid]->height)\ % e->text[e->tid]->height; ft_draw_floor(e); ft_draw_ceil(e); e->y++; } }
void ft_draw(t_mlx *mx, int x) { int y; int pixel; if (mx->v.drawend < 0) return ; y = -1; while (++y < HEIGHT) { pixel = (y * mx->width * 4) + x * 4; if (y < mx->v.drawstart) ft_draw_sky(mx, x, y, pixel); else if (y < mx->v.drawend) ft_draw_wall(mx, y, pixel); else ft_draw_floor(mx, x, y, pixel); } }
void ft_corps(t_id *s) { int x; x = -1; while (++x < W_X) { ft_start_initialisation(x, s); ft_ray_direction(s); ft_dda(s); ft_calc_pixl_place(s); ft_calc_floor_place(s); ft_draw_ceiling(x, s); if (x == W_X - 1) mlx_put_image_to_window(s->mlx, s->win, s->wall[13], MU, II); ft_draw_floor(x, s); ft_draw_walls(x, s); } mlx_put_image_to_window(s->mlx, s->win, s->img, 0, 0); ft_static_xpm(s); }