2022-11-07 20:15:26 +00:00
|
|
|
#include "config.h"
|
2022-11-28 16:33:50 +00:00
|
|
|
|
2022-11-07 20:15:26 +00:00
|
|
|
#include "game.hpp"
|
|
|
|
|
|
|
|
#include "logger.hpp"
|
|
|
|
#include "window.hpp"
|
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
|
2023-02-09 15:21:37 +00:00
|
|
|
int main(int argc, char* argv[])
|
2022-11-07 20:15:26 +00:00
|
|
|
{
|
|
|
|
|
2023-02-09 15:21:37 +00:00
|
|
|
bool enableFrameLimiter = true;
|
|
|
|
|
|
|
|
if (argc == 2) {
|
|
|
|
const std::string arg { argv[1] };
|
|
|
|
if (arg == "nofpslimit") enableFrameLimiter = false;
|
|
|
|
}
|
|
|
|
|
2022-11-07 20:15:26 +00:00
|
|
|
engine::setupLog(PROJECT_NAME);
|
|
|
|
|
|
|
|
INFO("{} v{}", PROJECT_NAME, PROJECT_VERSION);
|
|
|
|
|
|
|
|
try {
|
2023-02-09 15:21:37 +00:00
|
|
|
playGame(enableFrameLimiter);
|
2022-11-07 20:15:26 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e) {
|
|
|
|
|
|
|
|
CRITICAL("{}", e.what());
|
|
|
|
|
|
|
|
engine::Window::errorBox(e.what());
|
2022-11-08 15:34:59 +00:00
|
|
|
#ifndef NDEBUG
|
2022-11-07 20:15:26 +00:00
|
|
|
fputs(e.what(), stderr);
|
|
|
|
fputc('\n', stderr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|