-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
51 lines (46 loc) · 1.08 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
40
41
42
43
44
45
46
47
48
49
50
51
/**
Main function of 'Game of Life'. It creates instances of Model, View,Controller and runs
the simulation. It also intercepts the exceptions that may be thrown during execution.
@author Damian Mazurkiewicz
*/
#include "Model/Model.h"
#include "Controller/Controller.h"
#include "View/View.h"
#include "View/Graphics.h"
#include "Exception/GameOfLifeException.h"
#include <iostream>
int main(int argc, char** argv) {
try
{
Model model;
View view;
Controller controller(&model,&view);
view.run(&controller);
}
catch (InitializingSdlSystemsException& e)
{
Graphics::unloadLibraries();
std::cerr << e.what() << std::endl;
}
catch (LoadingMediaException& e)
{
Graphics::unloadLibraries();
std::cerr << e.what() << std::endl;
}
catch (LoadingSettingsExcepion& e)
{
std::cerr << e.what()<< std::endl;
}
catch (InitalizingControllerException& e)
{
std::cerr << e.what() << std::endl;
}
catch (InitalizingViewException& e)
{
std::cerr << e.what() << std::endl;
}
#ifdef _WIN32
system("PAUSE");
#endif
return 0;
}