cub3d/src/texture/texutre_load.c
2025-05-23 17:30:04 +02:00

48 lines
1.5 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* texutre_load.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/05/06 15:45:58 by qmennen #+# #+# */
/* Updated: 2025/05/23 17:29:13 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "texture.h"
void texture_delete(t_game *game)
{
int i;
i = 0;
while (i < 4)
{
if (game->map->textures[i])
mlx_delete_texture(game->map->textures[i]);
i++;
}
if (game->map->texture_floor)
{
mlx_delete_texture(game->map->texture_floor);
game->map->texture_floor = NULL;
}
if (game->map->texture_ceiling)
{
mlx_delete_texture(game->map->texture_ceiling);
game->map->texture_ceiling = NULL;
}
}
int texture_load(t_game *game)
{
if (!game->map->textures[SIDE_NORTH] || !game->map->textures[SIDE_EAST]
|| !game->map->textures[SIDE_SOUTH] || !game->map->textures[SIDE_WEST])
{
texture_delete(game);
return (FAILURE);
}
return (SUCCESS);
}