From: Dominik Kaiser Date: Sat, 11 May 2024 14:27:45 +0000 (+0200) Subject: Add wall rendering X-Git-Url: https://git.dkaiser.de/?a=commitdiff_plain;h=e597be4f58e7252333192cb1e4211d74522b6102;p=42%2Fso_long.git Add wall rendering --- diff --git a/include/so_long.h b/include/so_long.h index 47443aa..e9097d1 100644 --- a/include/so_long.h +++ b/include/so_long.h @@ -6,7 +6,7 @@ /* By: dkaiser mlx, wall_texture); + mlx_resize_image(wall_image, 48, 48); + game->map.tile_size.x = 48; + game->map.tile_size.y = 48; + x = 0; + while (x < game->map.grid_size.x) + { + y = 0; + while (y < game->map.grid_size.y) + { + if (game->map.tiles[y * game->map.grid_size.x + x] == WALL) + mlx_image_to_window(game->mlx, wall_image, x * game->map.tile_size.x, y * game->map.tile_size.y); + y++; + } + x++; + } + return (0); +} + int draw(t_game *game) { game->player.img->instances[0].x = game->player.position.x; diff --git a/src/main.c b/src/main.c index 53fb23d..f7352f4 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: dkaiser