summaryrefslogblamecommitdiff
path: root/src/main.cc
blob: c786e221b981e7eec422122f5a7a63869b0a8524 (plain) (tree)
1
2
3
4
5
6
7
8
9
                       


                     

                          


                                                     
                     
 



                                               

                          


                                                                                                                                              

                                                             
                                                        
 


                                                                                         

                 
                             

         



                                      
 


                                                     


                                             


                                       
 
/* Include libraries */
#include <iostream>
#include <SDL2/SDL.h>

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

int mansdl::main(const int argc, const char** argv) {
	fractData fd;

	if(!mansdl::applyArgs(&fd, argc, argv))
		return 0;

	if(!mansdl::init())
		return -1;

	if(fd.fract == mandelbrot4)
		std::cout << "\033[035m" << "WARNING!" << "\033[000m" << " The current fractal generator is REALLY unoptimized." << std::endl;

	while(!quit) {
		for(SDL_Event event; SDL_PollEvent(&event); )
			mansdl::checkEvent(&fd, &event);

		if(doGenerate) {
			mansdl::genF(&fd); /* If fractal is not generated, generate it */
			SDL_RenderPresent(renderer);
		}

		SDL_Delay(5);
	}

	SDL_DestroyRenderer(renderer);
	SDL_DestroyWindow(window);

	SDL_Quit();

	std::cout << "\n" << "Goodbye!" << std::endl;

	return 0;
}

int main(const int argc, const char** argv) {
	mansdl mansdl;

	return mansdl.main(argc, argv);
}