summaryrefslogtreecommitdiff
path: root/src/mansdl-init.cc
blob: 12b60101dc1431f9b094071f6da46260a773a722 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Include libraries */
#include <SDL2/SDL.h>

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

bool mansdl::init(void) {
	if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
		return false;

	if((window = SDL_CreateWindow("MandelbrotSDL", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, 0)) == NULL)
		return false;

	if((renderer = SDL_CreateRenderer(window, -1, 0)) == NULL)
		return false;

	SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE);
	SDL_RenderClear(renderer);
	SDL_RenderPresent(renderer);

	return true; /* Initialized successfully */
}