2014-09-16 20:22:43 +02:00
|
|
|
#include "RWGame.hpp"
|
2016-08-24 23:13:07 +02:00
|
|
|
#include "SDL.h"
|
|
|
|
#include <iostream>
|
2013-07-01 02:22:29 +02:00
|
|
|
|
2016-08-24 23:13:07 +02:00
|
|
|
int main(int argc, char* argv[])
|
2013-07-01 02:22:29 +02:00
|
|
|
{
|
2016-08-24 23:13:07 +02:00
|
|
|
try {
|
|
|
|
RWGame game(argc, argv);
|
2013-07-01 02:22:29 +02:00
|
|
|
|
2016-08-24 23:13:07 +02:00
|
|
|
return game.run();
|
|
|
|
} catch (std::runtime_error& ex) {
|
|
|
|
// Catch runtime_error as these are fatal issues the user may want to
|
|
|
|
// know about like corrupted files or GL initialisation failure.
|
|
|
|
// Catching other types (out_of_range, bad_alloc) would just make
|
|
|
|
// debugging them more difficult.
|
2014-08-01 22:04:58 +02:00
|
|
|
|
2016-08-24 23:13:07 +02:00
|
|
|
const char* kErrorTitle = "Fatal Error";
|
|
|
|
|
|
|
|
std::cerr << kErrorTitle << "\n" << ex.what() << std::endl;
|
|
|
|
|
|
|
|
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, kErrorTitle,
|
|
|
|
ex.what(), NULL) < 0) {
|
|
|
|
SDL_Log("Failed to show message box\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2013-07-01 02:22:29 +02:00
|
|
|
}
|