diff options
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -6,7 +6,7 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/09 17:58:23 by dkaiser #+# #+# */ -/* Updated: 2024/05/15 17:31:11 by dkaiser ### ########.fr */ +/* Updated: 2024/05/20 20:10:15 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -40,10 +40,14 @@ int draw_walls(t_game *game) int y; mlx_texture_t *wall_texture; mlx_image_t *wall_image; + mlx_texture_t *collectible_texture; wall_texture = mlx_load_png("textures/wall.png"); wall_image = mlx_texture_to_image(game->mlx, wall_texture); + collectible_texture = mlx_load_png("textures/collectible.png"); + game->map.collectible_img = mlx_texture_to_image(game->mlx, collectible_texture); mlx_resize_image(wall_image, 48, 48); + mlx_resize_image(game->map.collectible_img, 48, 48); game->map.tile_size.x = 48; game->map.tile_size.y = 48; x = 0; @@ -55,6 +59,9 @@ int draw_walls(t_game *game) 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); + if (game->map.tiles[y * game->map.grid_size.x + x] == COLLECTIBLE) + mlx_image_to_window(game->mlx, game->map.collectible_img, x + * game->map.tile_size.x, y * game->map.tile_size.y); y++; } x++; |
