Files
rogue/source/main.cxx
2026-04-23 19:33:39 -03:00

37 lines
842 B
C++

#include <cli/args.hpp>
#include <print>
#include <rogue.hpp>
#include <util/logger.hpp>
auto main(int argc, char **argv) -> int {
auto log = rog::logger(rog::log_level::debug, [](std::string_view message) {
std::println("{}", message);
});
try {
const auto args = rog::cli::parse(argc, argv);
if (args.help) {
std::println("{}", rog::cli::help_message());
return 0;
}
if (args.scene_path.empty()) {
std::println("scene path required");
return 1;
}
if (!std::filesystem::exists(args.scene_path)) {
std::println("{} does not exist", args.scene_path.generic_string());
return 2;
}
glfwInit();
auto rogue = rog::rogue(&log, args.scene_path);
rogue.run();
glfwTerminate();
} catch (const std::exception &ex) {
log.error("{}", ex.what());
}
}