Esempio n. 1
0
static void		ft_create_struct(int fd, char *map)
{
	t_windata		*t_fdf;

	if (!(t_fdf = (t_windata*)ft_memalloc(sizeof(t_windata))))
		ft_exit();
	ft_parsefdf(t_fdf, fd);
	ft_init_image(t_fdf);
	mlx_loop_hook(t_fdf->mlx, ft_display, t_fdf);
	mlx_hook(t_fdf->win, KeyPress, KeyPressMask, ft_hookevent, t_fdf);
	mlx_loop(t_fdf->mlx);
}
Esempio n. 2
0
void		ft_mlx(int fd)
{
	t_struct	**matr = NULL;

	matr = ft_creatematr(matr, fd);
	matr[0]->mlx = mlx_init();
	matr[0]->win = mlx_new_window(matr[0]->mlx, 1280, 800, "Wolf3d");
	matr[0]->i = 0;
	matr[0]->image = ft_init_image(matr[0]->image, matr[0]->mlx);
	matr[0]->pproj = ft_init_pproj(matr[0]->pproj);
	matr[0]->player = ft_init_player(matr[0]->player, matr[0]->pproj);
	clear(matr[0]->image, matr);
	ft_go(matr);
	mlx_do_key_autorepeatoff(matr[0]->mlx);
	mlx_expose_hook(matr[0]->win, ft_expose, matr);
	mlx_hook(matr[0]->win, KeyPress, KeyPressMask, ft_mask, matr);
	mlx_hook(matr[0]->win, KeyRelease, KeyReleaseMask, ft_relaise, matr);
	mlx_loop_hook(matr[0]->mlx, ft_key, matr);
	mlx_loop(matr[0]->mlx);
	ft_freeall(matr);
}