42_solong/main.c
2023-01-08 18:03:40 +01:00

58 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/12 17:20:17 by cchauvet #+# #+# */
/* Updated: 2023/01/08 18:00:03 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "solong.h"
int ft_initialised(char *path)
{
t_data data;
t_map *map;
map = ft_getmap(path);
if (map == NULL)
{
ft_printf("Map error\n");
return (1);
}
if (ft_color_changer(&data))
{
ft_printf("Memory error");
ft_freer_tab_ultimate(1, map);
return (1);
}
data.mlx = mlx_init();
data.window = mlx_new_window(data.mlx, WINDOW_SIZE, WINDOW_SIZE, "");
ft_draw_map(&data, map);
mlx_loop(data.mlx);
mlx_destroy_window(data.mlx, data.window);
mlx_destroy_display(data.mlx);
free(data.mlx);
return (0);
}
int main(int ac, char **av)
{
if (ac != 2)
{
ft_printf("Map error\n");
return (1);
}
ft_printf("Generating assets ...\n");
ft_gen_assets();
ft_printf("Generating assets [FINISHED]\n");
ft_initialised(av[1]);
// mlx_destroy_window(data.mlx, data.window);
// mlx_destroy_display(data.mlx);
// free(data.mlx);
return (1);
}