Example #1
0
void test_gfx(int argc, char **argv) {
	int delay = 1000;
	
	Screen* screen = switch_to_vga();

	fill_screen(screen, color_make(2, 0, 0));

	draw_button(screen);
	sleep(delay);

	test_lines(screen);
	sleep(delay);

	test_circles(screen);
	sleep(delay);

	test_rects(screen);
	sleep(delay);

	test_triangles(screen);
	sleep(delay);

	test_text(screen);
	sleep(delay);

	draw_julia(screen);
	sleep(delay);
	
	draw_mandelbrot(screen);
	sleep(delay);

	gfx_teardown(screen);
	switch_to_text();
}
Example #2
0
void				check_arg(char **av, t_img *img, t_frac *frac)
{
	if (av[2])
		frac->max_iter = ft_atoi(av[2]);
	init_color(frac, av);
	if (ft_strequ(av[1], "mandel") == 1)
	{
		set_mandel(frac);
		draw_mandelbrot(img, frac);
	}
	else if (ft_strequ(av[1], "julia") == 1)
	{
		set_julia(frac);
		draw_julia(img, frac);
	}
	else if (ft_strequ(av[1], "ship") == 1)
	{
		set_ship(frac);
		draw_ship(img, frac);
	}
	else if (ft_strequ(av[1], "triangle") == 1)
	{
		set_triangle(frac);
		draw_sierpinski(img, frac);
	}
	else
		exit(0);
}
Example #3
0
int main()
{
	alt_lcd_init();
	alt_ring_proc_init();
	unsigned int before = alt_nticks();
	draw_mandelbrot();
	unsigned int after = alt_nticks();
	printf("Finished in %i ms\n", ((after - before) * 1000) / alt_ticks_per_second());
	return 0;
}
Example #4
0
void			print_mandelbrot(t_env *e)
{
	t_fractal	*f;

	f = e->frac;
	if (e->init == 0)
	{
		e->deep = 25;
		f->min_x = -2.1;
		f->max_x = 0.6;
		f->min_y = -1.2;
		f->max_y = 1.2;
		e->init = 1;
		e->nbzoom = 10;
	}
	f->x = 0;
	f->y = 0;
	f->a = 0;
	draw_mandelbrot(e, f);
}
Example #5
0
// Any other main prototype will bug MinGW's SDL2
// Doesn't matter on *nix
int main(int argc, char **argv) {
  // Init the structures
  Sdl *sdl = init_sdl();
  Fractal *fractal = init_fractal();

  // Init console
  print_verbose(fractal);

  // User can exit program using escape
  while (is_user_pressing_escape(sdl) == 0) {
    draw_mandelbrot(sdl, fractal);
    is_user_moving(sdl, fractal);

    SDL_RenderPresent(sdl->renderer);

    SDL_Delay(10);
  }

  free_everything(sdl, fractal);
  return 0;
}