summaryrefslogblamecommitdiff
path: root/src/mansdl-init.cc
blob: 12b60101dc1431f9b094071f6da46260a773a722 (plain) (tree)





















                                                                                                                                                
/* 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 */
}