Ejemplo n.º 1
0
static void	change_fractal(int keycode, t_env *env)
{
    if (keycode == KEYCODE_1)
        init_fractal(env, "Mandelbrot");
    else if (keycode == KEYCODE_2)
        init_fractal(env, "Julia");
    else if (keycode == KEYCODE_3)
        init_fractal(env, "Burning ship");
    else if (keycode == KEYCODE_4)
        init_fractal(env, "Julia Burning ship");
    else if (keycode == KEYCODE_5)
        init_fractal(env, "Biomorph");
    else if (keycode == KEYCODE_6)
        init_fractal(env, "Bird of prey");
    else if (keycode == KEYCODE_7)
        init_fractal(env, "Julia Bird of prey");
    else if (keycode == KEYCODE_8)
        init_fractal(env, "Tribrot");
}
Ejemplo n.º 2
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;
}