/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.c                                             :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:29:00 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:29:08 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <mlx.h>
#include <cub3d.h>
#include <stddef.h>
#include <unistd.h>

int
	main(int argc, const char *argv[])
{
	t_cub	*clist;

	if (argc < 2)
	{
		ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mNo map selected\n\033[0m");
		return (1);
	}
	if (ft_init_cub3d(&clist) < 0)
		return (2);
	ft_parse_map(argv[1], clist);
	if (ft_init_winlx(clist) < 0)
		return (ft_exit(3, clist));
	ft_wall_tex_init(clist);
	ft_draw_scene(clist);
	ft_hooks_and_loops(clist->wlist, clist);
	return (0);
}