engine/test/src/main.cpp

43 lines
878 B
C++
Raw Normal View History

2022-11-07 20:15:26 +00:00
#include "config.h"
#include "game.hpp"
// engine
2022-11-07 20:15:26 +00:00
#include "logger.hpp"
#include "window.hpp"
// standard library
2022-11-07 20:15:26 +00:00
#include <exception>
#include <unordered_set>
#include <string.h>
2022-11-07 20:15:26 +00:00
int main(int argc, char* argv[])
2022-11-07 20:15:26 +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++) {
args.insert(std::string(argv[i]));
}
if (args.contains("nofpslimit")) settings.enableFrameLimiter = false;
if (args.contains("gpuvalidation")) settings.enableValidation = true;
}
2023-04-29 14:22:25 +00:00
engine::SetupLog(PROJECT_NAME);
2022-11-07 20:15:26 +00:00
LOG_INFO("{} v{}", PROJECT_NAME, PROJECT_VERSION);
2022-11-07 20:15:26 +00:00
try {
playGame(settings);
2022-11-07 20:15:26 +00:00
}
catch (const std::exception& e) {
LOG_CRITICAL("{}", e.what());
2022-11-07 20:15:26 +00:00
engine::Window::errorBox(e.what());
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}