예제 #1
0
int	main(int ac, char **av)
{
	t_mlx	*e;
	t_obj	*obj;

	if (ac != 2)
	{
		printf("Usage: %s [file.obj]\n", av[0]);
		return (0);
	}
	obj = parse_obj(av[1]);
	e = ft_memalloc(sizeof(t_mlx));
	e->mlx = mlx_init();
	e->win = mlx_new_opengl_window(e->mlx, WIDTH, HEIGHT, "Scop");
	mlx_opengl_window_set_context(e->win);
	init();
	render_window(e, obj);
	mlx_loop(e->mlx);
	return (0);
}
예제 #2
0
파일: mlx_launch.c 프로젝트: gmange/scop
int					mlx_launch(t_env *env)
{
	debug_stdout("INIT", FILE_LINE_FUN);
	if (!(MLX = mlx_init()))
		return (ft_error(env, __FUNCTION__, "mlx_init error"));
	if (!(WIN = mlx_new_opengl_window(MLX, WDT, HGT, TITLE)))
		return (ft_error(env, __FUNCTION__, "mlx_new_window error"));
	mlx_opengl_window_set_context(WIN);
	if (ogl_init(env) != EXIT_SUCCESS)
		return (ft_error(env, __FUNCTION__, "ogl_init error"));
	mlx_expose_hook(WIN, expose_hook, env);
	mlx_key_hook(WIN, key_hook, env);
	mlx_hook(WIN, KeyRelease, KeyReleaseMask, key_hook, env);
	if (print_tutorial(env) != EXIT_SUCCESS)
		return (ft_error(env, __FUNCTION__, "print_tutorial error"));
	mlx_hook(WIN, LASTEvent, NoEventMask, idle_hook, env);
	mlx_loop_hook(MLX, expose_hook, env);
	test_opengl_error("ERROR", __FILE__, __LINE__, "Launching MLX_LOOP");
	mlx_loop(MLX);
	return (EXIT_SUCCESS);
}