summaryrefslogblamecommitdiff
path: root/src/mansdl-genf.cc
blob: 1596286036122ceaf58036b531043feae4e02a65 (plain) (tree)
























































                                                                                                                                                                       
/* Include libraries */
#include <chrono>
#include <iomanip>
#include <iostream>

/* Include header files */
#include "mansdl.hh"

/* To-do list: */
/* Banish Windows from this world */
/* Optimize the Mandelbrot^4 renderer */

void mansdl::genF(fractData* fd) {
	doGenerate = false;

	auto timer_start = std::chrono::high_resolution_clock::now();

	genf genf;

	switch(fd->fract) {
		case burningShip:
			genf.burningShip(renderer, fd);
			break;

		case julia:
			genf.julia(renderer, fd);
			break;

		case mandelbrot3:
			genf.mandelbrot3(renderer, fd);
			break;

		case mandelbrot4:
			genf.mandelbrot4(renderer, fd);
			break;

		case mandelbrot5:
			genf.mandelbrot5(renderer, fd);
			break;

		case tricorn:
			genf.tricorn(renderer, fd);
			break;

		default:
			genf.mandelbrot(renderer, fd);
			break;
	}

	auto timer_stop = std::chrono::high_resolution_clock::now();
	std::chrono::duration<double> duration = timer_stop - timer_start;

	if(duration > std::chrono::seconds(5))
		std::cout << "\a";

	std::cout << "\r" << "\033[033m" << "Done!" << "\033[000m" << " (Took " << std::setprecision(3) << std::fixed << duration.count() << " seconds)" << std::flush;
}