Correction leaks sur un probleme de texture
This commit is contained in:
parent
415b6e42e3
commit
42d1359904
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ SRCS := ${SRCS_MAP} \
|
||||
OBJS := ${SRCS:.c=.o}
|
||||
CC := clang
|
||||
LIBS := libftx/libftx.a MLX42/build/libmlx42.a -ldl -lglfw -lm
|
||||
CFLAGS := -g -Wall -Wextra -Werror -Wno-conversion
|
||||
CFLAGS := -g -Wall -Wextra -Werror -Wno-conversion #-Ofast
|
||||
NAME := cub3D
|
||||
|
||||
all: ${NAME}
|
||||
|
24
game/game.c
24
game/game.c
@ -6,37 +6,51 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/26 12:59:53 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/05/11 16:16:00 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/05/19 17:49:02 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "game.h"
|
||||
|
||||
void destroy(t_game *game)
|
||||
int destroy(t_game *game)
|
||||
{
|
||||
if (game->textures[0])
|
||||
{
|
||||
mlx_delete_texture(game->textures[0]);
|
||||
if (game->textures[1])
|
||||
{
|
||||
mlx_delete_texture(game->textures[1]);
|
||||
if (game->textures[2])
|
||||
{
|
||||
mlx_delete_texture(game->textures[2]);
|
||||
if (game->textures[3])
|
||||
{
|
||||
mlx_delete_texture(game->textures[3]);
|
||||
if (game->mlx)
|
||||
mlx_terminate(game->mlx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
int start_game(t_map map)
|
||||
{
|
||||
t_game game;
|
||||
|
||||
if (init(map, &game))
|
||||
return (1);
|
||||
return (destroy(&game));
|
||||
game.window = mlx_new_image(game.mlx, WIDTH, HEIGHT);
|
||||
if (!game.window)
|
||||
{
|
||||
mlx_terminate(game.mlx);
|
||||
return (1);
|
||||
return (destroy(&game));
|
||||
}
|
||||
if (mlx_image_to_window(game.mlx, game.window, 0, 0) == -1)
|
||||
{
|
||||
mlx_terminate(game.mlx);
|
||||
return (1);
|
||||
return (destroy(&game));
|
||||
}
|
||||
raycasting(&game);
|
||||
mlx_key_hook(game.mlx, manage, &game);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/27 14:50:22 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/05/11 15:40:16 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/05/19 17:03:52 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -55,13 +55,13 @@ int init_textures(t_map map, mlx_texture_t *textures[4])
|
||||
|
||||
int init(t_map map, t_game *game)
|
||||
{
|
||||
if (init_textures(map, game->textures))
|
||||
return (2);
|
||||
game->mlx = mlx_init(WIDTH, HEIGHT, "jan lili", true);
|
||||
if (!game->mlx)
|
||||
return (1);
|
||||
game->map = map;
|
||||
init_ply(map, &game->ply);
|
||||
init_ray(&game->ray);
|
||||
if (init_textures(map, game->textures))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
BIN
libftx/extra/extra.a
Normal file
BIN
libftx/extra/extra.a
Normal file
Binary file not shown.
BIN
libftx/gnl/get_next_line.a
Normal file
BIN
libftx/gnl/get_next_line.a
Normal file
Binary file not shown.
BIN
libftx/libft/libft.a
Normal file
BIN
libftx/libft/libft.a
Normal file
Binary file not shown.
BIN
libftx/libftx.a
Normal file
BIN
libftx/libftx.a
Normal file
Binary file not shown.
BIN
libftx/printf/ft_printf.a
Normal file
BIN
libftx/printf/ft_printf.a
Normal file
Binary file not shown.
9
main.c
9
main.c
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/26 12:44:55 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/05/05 14:48:45 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/05/19 17:03:29 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -22,15 +22,12 @@ int main(int argc, char **argv)
|
||||
ft_eprintf("No argument");
|
||||
return (1);
|
||||
}
|
||||
if (map_parsing(argv[1], &map))
|
||||
if (map_parsing(argv[1], &map)
|
||||
|| start_game(map))
|
||||
{
|
||||
map_freer(&map);
|
||||
return (2);
|
||||
}
|
||||
if (start_game(map))
|
||||
{
|
||||
return (3);
|
||||
}
|
||||
map_freer(&map);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user