kys michel

This commit is contained in:
Etienne Rey-bethbeder 2023-05-10 12:31:36 +02:00
parent 8533722131
commit 63eca2ab8e

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/02 15:49:00 by erey-bet #+# #+# */ /* Created: 2023/05/02 15:49:00 by erey-bet #+# #+# */
/* Updated: 2023/05/09 14:40:18 by erey-bet ### ########.fr */ /* Updated: 2023/05/09 15:05:37 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -153,9 +153,10 @@ void draw_texture(t_game *game, t_dda *dda, double x)
tex.step = 1.0 * tex.texture->height / dda->line_height; tex.step = 1.0 * tex.texture->height / dda->line_height;
tex.pos = (dda->draw_start - tex.texture->height / 2 + dda->line_height / 2) * tex.step; tex.pos = (dda->draw_start - tex.texture->height / 2 + dda->line_height / 2) * tex.step;
y = dda->draw_start - 1; y = dda->draw_start - 1;
printf("tex.x: %d\n", tex.x); //printf("tex.x: %d\n", tex.x);
while (++y < dda->draw_end) while (++y < dda->draw_end)
{ {
//printf("tex.y: %d\n", tex.y);
tex.y = (int)tex.pos & (tex.texture->height - 1); tex.y = (int)tex.pos & (tex.texture->height - 1);
tex.pos += tex.step; tex.pos += tex.step;
mlx_put_pixel(game->window, x, y, get_pixel_color(tex.texture, tex.x, tex.y)); mlx_put_pixel(game->window, x, y, get_pixel_color(tex.texture, tex.x, tex.y));