-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·39 lines (36 loc) · 1.09 KB
/
main.cpp
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
#include "Menu.h"
#include "BoardTextures.h"
#include <iostream>
int main(int argc, char *args[])
{
try
{
//Create game singleton
Game* game = Game::createInstance();
if(game == NULL) throw GameException("Cannot create game instance.");
Board board;
BoardTextures boardTex(game->getRenderer(), board.getBoardSize());
bool quit = false;
SDL_Event event;
while(!quit)
{
while(SDL_PollEvent(&event) > 0)
{
if(event.type == SDL_QUIT) quit = true;
board.handleEvents(event, boardTex.getStoneTexSize() );
boardTex.render(board);
}
}
}
catch(const std::exception& exc)
{
std::cout << exc.what() << std::endl;
std::cout << "SDL error message: " << SDL_GetError() << std::endl;
std::cout << "IMG error message: " << IMG_GetError() << std::endl;
std::cout << "TTF error message: " << TTF_GetError() << std::endl;
}
catch(...)
{
std::cout << "Unknown exception." << std::endl;
}
}