From e597be4f58e7252333192cb1e4211d74522b6102 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Sat, 11 May 2024 16:27:45 +0200 Subject: [PATCH] Add wall rendering --- include/so_long.h | 3 ++- src/draw.c | 30 +++++++++++++++++++++++++++++- src/main.c | 3 ++- textures/wall.png | Bin 0 -> 99 bytes 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 textures/wall.png 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 SyAF!uEH wq)0Mus=m^2(LlnNormWNH}j@VN+H4wtN&+S{PMNzCQuiHr>mdKI;Vst09W@LzW@LL literal 0 HcmV?d00001 -- 2.47.2