#include #include #include #include #include #include "./packer.hpp" namespace { inline constexpr int APP_ERROR = 1; inline constexpr int USER_ERROR = 2; } int main(int argc, char* argv[]) { std::string outputFile; std::vector inputFiles; argparse::ArgumentParser parser("texture_packer"); parser.add_argument("output_file") .store_into(outputFile); parser.add_argument("input_file") .store_into(inputFiles) .nargs(argparse::nargs_pattern::at_least_one); // now parse try { parser.parse_args(argc, argv); } catch (std::runtime_error& error) { spdlog::error("{}", error.what()); return USER_ERROR; } try { sdl_gpu_test::Packer packer; for (const std::string& inputFile : inputFiles) { packer.addImage(inputFile); } packer.pack(outputFile); } catch(const std::runtime_error& error) { spdlog::error("{}", error.what()); return USER_ERROR; } return 0; }