-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMain.cpp
More file actions
50 lines (46 loc) · 1.07 KB
/
Main.cpp
File metadata and controls
50 lines (46 loc) · 1.07 KB
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
40
41
42
43
44
45
46
47
48
49
50
/*
* @file: Main.cpp
* @author: Stig M. Halvorsen <halsti@nith.no>
* @version: 1.0.0 <11.02.2013>
*
* @description: A SDL2.0 project to test if SDL2 is
* instantiated properly, and is stable.
* Includes a well working SDL2 input manager.
* This project may be used as a start-off
* point for SDL2 projects.
*
* NB: requires SDL 2.0.0-6799 (32 bit)
*/
#include <iostream>
#include "managers/GameManager.h"
int main(int argc, char* argv[])
{
// Try to fire off the "game", catch potential failures.
srand((unsigned int) time(nullptr));
try
{
GameManager::Instance().play();
return EXIT_SUCCESS;
}
catch(const SDLError& err)
{
std::cerr << "An SDL error occured: "
<< err.what() << std::endl;
}
catch(const std::bad_alloc& err)
{
std::cerr << "Memory allocation failure: "
<< err.what() << std::endl;
return false;
}
catch(const std::exception& err)
{
std::cerr << "An error occured: "
<< err.what() << std::endl;
}
catch(...)
{
std::cerr << "An unknown error occured ..." << std::endl;
}
return EXIT_FAILURE;
}