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-15 01:49:03 +00:00
|
|
|
#include <unordered_set>
|
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-03-15 01:49:03 +00:00
|
|
|
GameSettings settings{};
|
|
|
|
settings.enableFrameLimiter = true;
|
|
|
|
settings.enableValidation = false;
|
|
|
|
if (argc >= 2) {
|
|
|
|
std::unordered_set<std::string> args{};
|
2023-03-15 13:31:03 +00:00
|
|
|
for (int i = 1; i < argc; i++) {
|
2023-03-15 01:49:03 +00:00
|
|
|
args.insert(std::string(argv[i]));
|
|
|
|
}
|
|
|
|
if (args.contains("nofpslimit")) settings.enableFrameLimiter = false;
|
|
|
|
if (args.contains("gpuvalidation")) settings.enableValidation = true;
|
2023-02-09 15:21:37 +00:00
|
|
|
}
|
|
|
|
|
2023-04-29 14:22:25 +00:00
|
|
|
engine::SetupLog(PROJECT_NAME);
|
2022-11-07 20:15:26 +00:00
|
|
|
|
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-03-15 01:49:03 +00:00
|
|
|
playGame(settings);
|
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;
|
|
|
|
}
|