示例#1
0
t_lst			*manage_av_file(char *path, t_lst *lst, DIR *dir)
{
	char			*formated;
	struct dirent	*ret;

	formated = format_path(path);
	if (!formated)
		return (NULL);
	if (!(dir = opendir(formated)))
	{
		ft_error(path);
		return (NULL);
	}
	else
	{
		while ((ret = readdir(dir)))
			if ((ft_strcmp(ret->d_name, get_file_name(path)) == 0))
			{
				lst = ft_get_data(lst, ret->d_name, path);
				break ;
			}
		if (!lst)
			return (NULL);
		closedir(dir);
		return (lst);
	}
	return (NULL);
}
示例#2
0
文件: main.c 项目: gmpetrov/Wolf3D
int		main(int argc, char **argv)
{
	int		***tab;
	t_conf	conf;
	t_data	d;

	if (argc != 2)
	{
		ft_putstr("usage: ./fdf [data_file]");
		return (0);
	}
	tab = ft_get_data(argv, &conf);
	d.map = tab;
	d.wall = conf.wall;
	d.col = conf.x;
	d.li = conf.y;
	d.empty = conf.empty;
	d.p = (t_point *)malloc(sizeof(t_point));
	d.p->x = 1040;
	d.p->y = 1104;
	d.alpha = 0;
	ft_init_attr(&d);
	ft_print_map(d.map);
	ft_mlx(&d);
	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
文件: ft_data.c 项目: chinspp/42
void	ft_search_data(t_sizetree *root)
{
	char	*key;
	char	*value;

	while (get_next_line(0, &key) && ft_strlen(key))
	{
		value = ft_get_data(key, root);
		if (value)
			ft_putstr(value);
		else
		{
			ft_putstr(key);
			ft_putstr(": ");
			ft_putstr("Not Found");
		}
		ft_putstr("\n");
	}
}
示例#5
0
文件: main.c 项目: jbplop/fractol
int				main(int ac, char **av)
{
	t_env	env;

	(void)av;
	if (ac < 2)
	{
		ft_menu_shell();
		return (0);
	}
	env.f = ft_init(av[1]);
	env.f.height = (env.f.x2 - env.f.x1) * env.f.zoom;
	env.f.width = (env.f.y2 - env.f.y1) * env.f.zoom;
	env.mlx = mlx_init();
	env.win = mlx_new_window(env.mlx, env.f.height, env.f.width, "Fractol");
	env.img = mlx_new_image(env.mlx, env.f.height, env.f.width);
	env = ft_get_data(&env);
	ft_draw(&env);
	mlx_key_hook(env.win, ft_key_hook, &env);
	mlx_mouse_hook(env.win, ft_mouse_hook, &env);
	mlx_hook(env.win, 6, (1L << 6), motion_hook, &env);
	mlx_loop(env.mlx);
}