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
|
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "./Game/Game.h"
#include "./Exceptions/GameOverException.h"
time_t aStart, aEnd; ///@@@ time performance
using namespace std;
int main(int argc, char *argv[])
{
srand (time(NULL));
Game * aGame = new Game(); //setting of game by default
try
{
time (&aStart); ///@@@ time performance
aGame->run();
}
catch (GameOverException & aGameOverException)
{
std::cout<<aGameOverException.getErrorMessage()<<endl;
delete aGame;
time(&aEnd);///@@@ time performance
//std::cout<<difftime(aEnd, aStart)<<" sg"<<std::endl;///@@@ time performance
printf ("The process takes %.4lf seconds \n",difftime(aEnd, aStart));
}
return EXIT_SUCCESS;
} |
Partager