SchrodingersChess/main.cpp

46 lines
1021 B
C++
Executable File

#include "SDL2/SDL.h"
#include "app_consts.hpp"
#include "sprites.hpp"
#include "game.hpp"
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
//Sourced from lazyfoo's SDL2 tutorials, not really any special code here, just standard init process for the window
SDL_Window* window = NULL;
SDL_Surface* screenSurface = NULL;
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
}
else
{
window = SDL_CreateWindow("Schrodinger's Chess", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if(window == NULL)
{
printf("Window could not be created! SDL_Error: %s\n", SDL_GetError());
}
else
{
screenSurface = SDL_GetWindowSurface(window);
SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0x00, 0x00, 0x00));
Game game(window, screenSurface);
game.run();
}
}
Sprite::close();
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}