2022-04-14 20:03:32 +00:00
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
|
|
|
|
#include "app_consts.hpp"
|
|
|
|
#include "sprites.hpp"
|
2022-04-15 02:40:00 +00:00
|
|
|
#include "game.hpp"
|
2022-04-14 20:03:32 +00:00
|
|
|
|
|
|
|
int main(int argc, char** 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
|
|
|
|
{
|
2022-04-15 02:40:00 +00:00
|
|
|
window = SDL_CreateWindow("Schrodinger's Chess", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
|
2022-04-14 20:03:32 +00:00
|
|
|
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));
|
|
|
|
|
2022-04-15 02:40:00 +00:00
|
|
|
Game game(window, screenSurface);
|
|
|
|
|
|
|
|
game.run();
|
2022-04-14 20:03:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Sprite::close();
|
|
|
|
|
|
|
|
SDL_DestroyWindow(window);
|
|
|
|
|
|
|
|
SDL_Quit();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|