MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
2
3#include "mxvk/argz.hpp"
5
6#include <SDL3/SDL.h>
7
8#include <cstdlib>
9#include <format>
10#include <iostream>
11#include <string>
12
13int main(int argc, char **argv) {
14 try {
15 if (!SDL_SetAppMetadata("Asteroids 3D", nullptr, "asteroids3d")) {
16 std::cerr << std::format("asteroids3d: could not set SDL application metadata: {}\n", SDL_GetError());
17 }
18
19 const Arguments args = proc_args(argc, argv);
21 } catch (const mxvk::Exception &e) {
22 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
23 return EXIT_FAILURE;
24 } catch (const ArgException<std::string> &e) {
25 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
26 return EXIT_FAILURE;
27 }
28
29 return EXIT_SUCCESS;
30}
Lightweight, header-only, template command-line argument parser.
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition argz.hpp:872
Exception thrown by Argz::proc() on unrecognised or malformed options.
Definition argz.hpp:178
std::string text() const
int main(void)
Definition main.cpp:7
void run_asteroids3d(const Arguments &args)
Runs the Asteroids application.
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:730