2022-11-07 20:15:26 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "game.hpp"
|
|
|
|
|
2023-03-12 16:14:55 +00:00
|
|
|
// engine
|
2022-11-07 20:15:26 +00:00
|
|
|
#include "logger.hpp"
|
|
|
|
#include "window.hpp"
|
|
|
|
|
2023-03-12 16:14:55 +00:00
|
|
|
// standard library
|
2022-11-07 20:15:26 +00:00
|
|
|
#include <exception>
|
2023-03-12 16:14:55 +00:00
|
|
|
#include <string.h>
|
2022-11-07 20:15:26 +00:00
|
|
|
|
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) {
|
2023-03-12 20:39:11 +00:00
|
|
|
if (strcmp(argv[1], "nofpslimit") == 0) enableFrameLimiter = false;
|
2023-02-09 15:21:37 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 20:15:26 +00:00
|
|
|
engine::setupLog(PROJECT_NAME);
|
|
|
|
|
2023-03-12 16:14:55 +00:00
|
|
|
LOG_INFO("{} v{}", PROJECT_NAME, PROJECT_VERSION);
|
2022-11-07 20:15:26 +00:00
|
|
|
|
|
|
|
try {
|
2023-02-09 15:21:37 +00:00
|
|
|
playGame(enableFrameLimiter);
|
2022-11-07 20:15:26 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e) {
|
2023-03-12 16:14:55 +00:00
|
|
|
LOG_CRITICAL("{}", e.what());
|
2022-11-07 20:15:26 +00:00
|
|
|
engine::Window::errorBox(e.what());
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|