| 294 | } |
| 295 | |
| 296 | void Platform::terminate(ExitCode code) |
| 297 | { |
| 298 | if (code == ExitCode::Help) |
| 299 | { |
| 300 | LOGI(""); |
| 301 | LOGI("\tVulkan Samples"); |
| 302 | LOGI(""); |
| 303 | LOGI("\t\tA collection of samples to demonstrate the Vulkan best practice."); |
| 304 | LOGI(""); |
| 305 | LOGI("\tUsage: vulkan_samples [OPTIONS]"); |
| 306 | LOGI(""); |
| 307 | LOGI("\t\tOptions:"); |
| 308 | LOGI("\t\t\t-h,--help Print this help message and exit"); |
| 309 | |
| 310 | // determine the width for the commands/options |
| 311 | size_t width = 4; // minimal width for "help" |
| 312 | for (auto plugin : plugins) |
| 313 | { |
| 314 | for (auto const &command : plugin->get_commands()) |
| 315 | { |
| 316 | width = std::max(width, command.first.length()); |
| 317 | } |
| 318 | for (auto const &option : plugin->get_options()) |
| 319 | { |
| 320 | width = std::max(width, option.first.length()); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | for (auto plugin : plugins) |
| 325 | { |
| 326 | plugin->log_help(width + 2); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | if (code == ExitCode::NoSample) |
| 331 | { |
| 332 | LOGI(""); |
| 333 | LOGI("No sample was requested or the selected sample does not exist"); |
| 334 | LOGI(""); |
| 335 | LOGI("To run a specific sample use the \"sample\" argument, e.g."); |
| 336 | LOGI(""); |
| 337 | LOGI("\tvulkan_samples sample hello_triangle"); |
| 338 | LOGI(""); |
| 339 | LOGI("To get a list of available samples, use the \"samples\" argument") |
| 340 | LOGI("To get a list of available command line options, use the \"-h\" or \"--help\" argument"); |
| 341 | LOGI(""); |
| 342 | } |
| 343 | |
| 344 | if (active_app) |
| 345 | { |
| 346 | std::string id = active_app->get_name(); |
| 347 | on_app_close(id); |
| 348 | active_app->finish(); |
| 349 | } |
| 350 | |
| 351 | active_app.reset(); |
| 352 | window.reset(); |
| 353 | |