-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
68 lines (57 loc) · 1.87 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/// \author { Louis-Félix Galeota, Romain Brisse }
/// \date 24 Avril 2017
#include "othello/inc/ui/main/mainallegroui.hpp"
#include "othello/inc/ui/main/maincliui.hpp"
#include "othello/inc/ui/audio/FMOD.hpp"
#ifdef ALLEGRO_WINDOWS
#include "win32_SetProcessDpiAware/win32_SetProcessDpiAware.h"
#endif
using namespace std;
using namespace Othello;
using namespace Othello::Board;
using namespace Othello::Players;
int main( int argc, char* argv[] ) {
Othello::UI::Audio::FMOD fmod;
#ifdef ALLEGRO_WINDOWS
win32_SetProcessDpiAware();
#endif
fmod.loadMusic( "menu", "musics/menu.it" );
fmod.loadMusic( "main1", "musics/main1.it" );
fmod.loadMusic( "victory", "musics/victorybg.it" );
fmod.loadSound( "victory", "musics/victory.it" );
fmod.loadSound( "back", "sounds/back.wav" );
fmod.loadSound( "clickNextCard", "sounds/clickNextCard.wav" );
fmod.loadSound( "hoverButton", "sounds/hoverButton.wav" );
fmod.loadSound( "hoverCard", "sounds/hoverCard.wav" );
fmod.setMasterVolume( 1.0f );
if( argc > 1 ) {
std::string arg1 = argv[ 1 ];
if( arg1 == "--cli" ) {
Othello::UI::Main::CLI cliui( fmod );
return 0;
}
}
try {
Othello::UI::Main::Allegro allegroui( fmod );
} catch( runtime_error& e ) {
stringstream error;
error << "Une erreur est survenu durant l'exécution du programme." << endl << endl
<< "Runtime error: "
<< typeid( e ).name() << endl
<< e.what();
allegro_message( error.str().c_str() );
} catch( exception& e ) {
stringstream error;
error << "Une erreur est survenu durant l'exécution du programme." << endl << endl
<< "Exception: "
<< typeid( e ).name() << endl
<< e.what();
allegro_message( error.str().c_str() );
} catch( ... ) {
stringstream error;
error << "Une erreur est survenu durant l'exécution du programme.";
allegro_message( error.str().c_str() );
}
return 0;
}
END_OF_MAIN();