mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
fix: fixed textures leaks
This commit is contained in:
parent
80150ce24d
commit
f407f5b7ce
3 changed files with 41 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/08/18 13:05:31 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/18 13:05:31 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/09/08 17:02:43 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,6 +14,15 @@
|
|||
#include "../../mlx/mlx.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void destroy_texture(t_cub3d_data *data, t_img_data *data_img)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
mlx_destroy_image(data->mlx, data_img->img);
|
||||
}
|
||||
free(data_img);
|
||||
}
|
||||
|
||||
void destroy_textures(t_cub3d_data *data)
|
||||
{
|
||||
if (data->no_texture)
|
||||
|
|
@ -45,3 +54,30 @@ void destroy_sprites(t_cub3d_data *data)
|
|||
sprite++;
|
||||
}
|
||||
}
|
||||
|
||||
void destroy_hud_textures(t_cub3d_data *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (i < 10)
|
||||
{
|
||||
destroy_texture(data, data->point_figures[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 10)
|
||||
{
|
||||
destroy_texture(data, data->round_figures[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
{
|
||||
destroy_texture(data, data->tally_marks[i++]);
|
||||
}
|
||||
i = 0;
|
||||
while (i < 3)
|
||||
{
|
||||
destroy_texture(data, data->perk_logos[i++]);
|
||||
}
|
||||
destroy_texture(data, data->gun);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue