summaryrefslogtreecommitdiff
path: root/src/main.cc
blob: c786e221b981e7eec422122f5a7a63869b0a8524 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* 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);
}