예제 #1
0
int	main(int argc, char **argv)
{
	t_mlxenv	*e;
	t_mlxp		*list;
	t_data		*data;
	char		*data_mlx;

	if (argc != 2)
		ft_error(ARG_ERROR);
	if ((e = malloc(sizeof(t_mlxenv))) == NULL)
		ft_error(ALLOC_ERROR);
	if ((data = malloc(sizeof(t_data))) == NULL)
		ft_error(ALLOC_ERROR);
	list = NULL;
	ft_parsing(&list, argv, data);
	ft_proj_iso_list(&list, data);
	if ((e->mlx = mlx_init()) == NULL)
		ft_error(END_PROG);
	e->img = mlx_new_image(e->mlx, 1650, 1000);
	data_mlx = mlx_get_data_addr(e->img, &(data->bpp),
								&(data->sizelin), &(data->endian));
	ft_display_map(&list, data, data_mlx);
	e->win = mlx_new_window(e->mlx, 1650, 1000, "FdF");
	mlx_put_image_to_window(e->mlx, e->win, e->img, 0, 0);
	ft_hook(e, &list);
	return (0);
}
예제 #2
0
파일: main.c 프로젝트: eleonorev/lem-in
int				main(void)
{
	char		*line;
	int			res;
	int			i;
	t_struct	t;
	int			x;

	i = 0;
	x = 0;
	t.liaison = 0;
	t.salle = 0;
	t.lines = malloc(sizeof(char *) * 300);
	while ((res = get_next_line(0, &line) > 0))
	{
		if (i == 0)
		{
			t.nb = ft_atoi(line);
			if (!t.nb)
				return (ft_error());
		}
		t.lines[x] = line;
		ft_putendl(t.lines[x]);
		x++;
		i = ft_parsing(line, &t, i);
	}
	ft_putchar('\n');
	ft_verif(&t);
	//ft_putendl(t.liaison);
	reverseliaison(&t);
	//parlafin(&t);
	makechemin(&t);
	return (0);
}
예제 #3
0
파일: main.c 프로젝트: matt2905/raytracer
int				main(int argc, char **argv)
{
	t_data	d;
	t_file	*file;
	t_file	*tmp;

	file = NULL;
	if (argc != 2)
		ft_putendl_fd("Usage: ./rt scene", 2);
	else
	{
		tmp = ft_init(&file, &d, argv[1]);
		ft_parsing(file, &d);
		ft_get_light(file, &d);
		if ((d.mlx = mlx_init()) == NULL)
			return (-1);
		d.win = mlx_new_window(d.mlx, d.width, d.height, "RT");
		d.img = mlx_new_image(d.mlx, d.width, d.height);
		ft_get_data(&d);
		ft_free_file(tmp);
		ft_raytracing(&d);
		mlx_key_hook(d.win, &ft_key_hook, &d);
		mlx_expose_hook(d.win, &ft_expose_hook, &d);
		mlx_loop(d.mlx);
	}
	return (0);
}
예제 #4
0
int main(int argc, char **argv)
{
	t_id s;
	int fd;
	char *line;
	(void)argc;

	fd = open(argv[1], O_RDONLY);
	s.nl = 0;

	while ((get_next_line(fd, &line)) > 0) 
				++s.nl;
	s.map = (int **)malloc(sizeof(int *) * s.nl);
	s.nl = 0;
	close(fd);
	fd = open(argv[1], O_RDONLY);
	while ((get_next_line(fd, &line)) > 0)
	{	
		s.map[s.nl] = ft_parsing(line);
		s.nc = (int)ft_get_number_of_words(line, ' ');
		s.nl++;
	}
	s.mlx = mlx_init();
	s.win = mlx_new_window(s.img, W_X, W_Y, WIN_NAME);
	

	mlx_key_hook(s.win, key_reaction, &s);
	mlx_loop(s.mlx);
	return (0);
}
예제 #5
0
파일: main.c 프로젝트: yunikki/lem-in
int		main(void)
{
	t_env	e;
	int		i;

	i = 0;
	e.salle = 0;
	if (ft_parsing(&e) == -1)
		return (-1);
	if (ft_check_patch(&e) == -1)
		return (-1);
	ft_resolv(&e);
	return (0);
}
예제 #6
0
파일: main.c 프로젝트: Hadouweb/42_filler
int			main(void)
{
	char	*line;
	t_app	app;

	ft_bzero(&app, sizeof(t_app));
	app.play = 1;
	ft_init_way(&app);
	while (get_next_line(0, &line))
	{
		ft_parsing(&app, line);
		if (!app.play)
			ft_putstr("0 0\n");
		ft_strdel(&line);
	}
	return (0);
}