From f5b3242033ca49ccd00cf1f316239952bbd0c30d Mon Sep 17 00:00:00 2001 From: nicolas-arnaud Date: Mon, 21 Nov 2022 13:49:19 +0100 Subject: [PATCH] cleaner exit and forgiden bzero changed --- maps/tester.cub | 6 +++--- src/main.c | 1 - src/mlx/mlx_2.c | 7 ++++++- src/render/render.c | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/maps/tester.cub b/maps/tester.cub index d84e4ee..831aba4 100644 --- a/maps/tester.cub +++ b/maps/tester.cub @@ -12,14 +12,14 @@ C 27, 210,200 111111111111111111111111111111111111111111111111 100000000000000000010000000000000000000000000001 101000001000010000101000010000100000000000000001 -101100000100001000010000100001110000000000000001 +101100C00100001000010000100001110000000000000001 101110000010000100000001000010101000000000000001 101011000001000010000010000100100100000000000001 101001100000100001000100001000100010000000000001 -101000110000010000101000010000100101000000000001 +1010001100J0010000101000010000100101000000000001 101000011000001000010000100000101000100000000001 101000001100000100000001000000110000010000000001 -101000000110000010000010000000100000001000000001 +101040000110000010000010000000100000001000000001 101000000011000001000100000001010000000100000001 1010000000011000001N1000000010001000000010000001 101111111111110000010000000100100100000001000001 diff --git a/src/main.c b/src/main.c index 43d152f..fd93c49 100644 --- a/src/main.c +++ b/src/main.c @@ -29,6 +29,5 @@ int main(int argc, char **argv) render(env); mlx_loop_hook(env->mlx, update_hook, env); mlx_loop(env->mlx); - mlx_destroy_image(env->mlx, env->img); return (EXIT_SUCCESS); } diff --git a/src/mlx/mlx_2.c b/src/mlx/mlx_2.c index fcb988c..b54c2bf 100644 --- a/src/mlx/mlx_2.c +++ b/src/mlx/mlx_2.c @@ -14,7 +14,12 @@ int exit_game(t_env *env) { - (void)env; + int i; + + i = 0; + while (i < 5) + mlx_destroy_image(env->mlx, env->tex[i++].img); + mlx_destroy_image(env->mlx, env->img); exit(EXIT_SUCCESS); } diff --git a/src/render/render.c b/src/render/render.c index 5b412f8..2574e76 100644 --- a/src/render/render.c +++ b/src/render/render.c @@ -88,7 +88,7 @@ void render_view(t_env *env) void render(t_env *env) { - bzero(env->buffer, WIN_Y_SZ * WIN_X_SZ * sizeof(int)); + ft_bzero(env->buffer, WIN_Y_SZ * WIN_X_SZ * sizeof(int)); render_view(env); if (env->minimap) render_minimap(env, (t_vec){WIN_X_SZ / 3, WIN_Y_SZ / 3});