aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: 62d4bf61c17b912478b15a64236fe991c4ab3f85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.c                                             :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: joelecle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:29:00 by joelecle          #+#    #+#             */
/*   Updated: 2020/02/14 17:29:08 by joelecle         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <mlx.h>
#include <cub3d.h>
#include <stdlib.h>

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

	if (ft_check_map_arg(argc, argv) == FT_RET_BAD_ARGV)
		return (FT_RET_BAD_ARGV);
	if (!(clist = (t_cub*)malloc(sizeof(t_cub))))
		return (FT_RET_ALLOC_ERR);
	if (ft_init_cub3d(clist) < 0)
		return (FT_RET_FAILED_STRUCTS);
	ft_parse_map(argv[1], clist);
	if (ft_init_sfx(clist) < 0)
		return (FT_RET_ALLOC_ERR);
	if (ft_init_winlx(clist) < 0)
		return (ft_exit(FT_RET_FAILED_MLX, clist));
	ft_use_args(argc, argv, clist);
	return (FT_RET_FINE);
}