fixed leak
This commit is contained in:
parent
33b3b06c07
commit
d193b99c56
4 changed files with 22 additions and 8 deletions
4
algo.c
4
algo.c
|
@ -6,7 +6,7 @@
|
|||
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/01 16:24:58 by grobledo #+# #+# */
|
||||
/* Updated: 2024/10/29 14:33:28 by grobledo ### ########.fr */
|
||||
/* Updated: 2024/10/29 15:28:25 by grobledo ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -18,7 +18,6 @@ void *g_mlx = NULL;
|
|||
void *g_win = NULL;
|
||||
t_map g_map;
|
||||
t_player g_player;
|
||||
// t_tex g_tex;
|
||||
|
||||
// TODO manage image format error better
|
||||
|
||||
|
@ -57,6 +56,7 @@ void draw_screen(void)
|
|||
render(img_data, &tex);
|
||||
mlx_put_image_to_window(g_mlx, g_win, img_ptr, 0, 0);
|
||||
mlx_destroy_image(g_mlx, img_ptr);
|
||||
clean_img(&tex);
|
||||
}
|
||||
|
||||
static void loop(void)
|
||||
|
|
5
algo.h
5
algo.h
|
@ -6,7 +6,7 @@
|
|||
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/30 15:45:59 by grobledo #+# #+# */
|
||||
/* Updated: 2024/10/24 14:27:27 by grobledo ### ########.fr */
|
||||
/* Updated: 2024/10/29 15:29:30 by grobledo ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -67,7 +67,6 @@ extern void *g_mlx;
|
|||
extern void *g_win;
|
||||
extern t_player g_player;
|
||||
extern t_map g_map;
|
||||
// extern t_tex g_tex;
|
||||
|
||||
/// @brief Write an error message on stderr.
|
||||
///
|
||||
|
@ -86,4 +85,6 @@ void ft_init_texture(const double perpwalldist, t_ray *ray, t_tex *tex);
|
|||
|
||||
void draw_wall(t_tex *tex, t_ray *ray, const int line_height, int x,
|
||||
int y, u_int32_t *img_data);
|
||||
|
||||
void clean_img(t_tex *tex);
|
||||
#endif
|
||||
|
|
17
utils.c
17
utils.c
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
|
||||
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 12:38:40 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/10/17 16:36:14 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/10/29 15:28:56 by grobledo ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -69,3 +69,16 @@ void timedloop(void (*f)(void))
|
|||
f();
|
||||
ticks++;
|
||||
}
|
||||
|
||||
void clean_img(t_tex *tex)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (i <= 3)
|
||||
{
|
||||
if (tex->textures[i])
|
||||
mlx_destroy_image(g_mlx, tex->textures[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
4
utils.h
4
utils.h
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* utils.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
|
||||
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/15 16:56:47 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/10/17 14:41:09 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/10/29 15:27:17 by grobledo ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue