Beispiel #1
0
void	paint_mlx(t_vec3f *a, t_gui gui)
{
	int				x;
	int				y;
	int				pos;
	static t_bool	rendered = FALSE;

	x = 0;
	y = 0;
	if (rendered)
		return (void)mlx_put_image_to_window(gui.mlx, gui.win, gui.image, 0, 0);
	while (y < HEIGHT && !(x = 0))
	{
		while (x < WIDTH)
		{
			pos = (x * gui.bpp / 8) + (y * gui.sl);
			gui.pixel[pos] = (unsigned char)(ft_min(1.0, (*a).z) * 255);
			gui.pixel[pos + 1] = (unsigned char)(ft_min(1.0, (*a).y) * 255);
			gui.pixel[pos + 2] = (unsigned char)(ft_min(1.0, (*a).x) * 255);
			a++;
			x++;
		}
		y++;
	}
	rendered = TRUE;
	dispose_garbage();
	mlx_put_image_to_window(gui.mlx, gui.win, gui.image, 0, 0);
}
Beispiel #2
0
void		run_application(t_interface *env)
{
	mlx_key_hook(env->gui.win, onkey_handler, env);
	mlx_expose_hook(env->gui.win, expose_handler, env);
	mlx_loop(env->gui.mlx);
	mlx_destroy_image(env->gui.mlx, env->gui.image);
	kill_stack(&env->objects);
	dispose_garbage();
}