MXVK Vulkan Framework
0.33.1
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
defender.cpp
Go to the documentation of this file.
1
#include "
defender_window.hpp
"
2
3
#include "
mxvk/argz.hpp
"
4
#include "
mxvk/mxvk_exception.hpp
"
5
6
#include <cstdlib>
7
#include <format>
8
#include <iostream>
9
#include <string>
10
11
int
main
(
int
argc,
char
**argv) {
12
try
{
13
const
Arguments
args =
proc_args
(argc, argv);
14
defender::DefenderWindow
window(args.
path
, args.
width
, args.
height
, args.
fullscreen
, args.
enable_vsync
);
15
window.
loop
();
16
17
}
catch
(
const
mxvk::Exception
&e) {
18
std::cerr << std::format(
"mxvk: Exception: {}\n"
, e.
text
());
19
return
EXIT_FAILURE;
20
}
catch
(
const
ArgException<std::string>
&e) {
21
std::cerr << std::format(
"Argument Exception: {}\n"
, e.
text
());
22
return
EXIT_FAILURE;
23
}
24
25
return
EXIT_SUCCESS;
26
}
argz.hpp
Lightweight, header-only, template command-line argument parser.
proc_args
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition
argz.hpp:872
ArgException
Exception thrown by Argz::proc() on unrecognised or malformed options.
Definition
argz.hpp:178
defender::DefenderWindow
Definition
defender_window.hpp:35
mxvk::Exception
Definition
mxvk_exception.hpp:7
mxvk::Exception::text
std::string text() const
Definition
mxvk_exception.hpp:10
mxvk::VK_Window::loop
void loop()
Run the main event/render loop.
Definition
mxvk.cpp:627
defender_window.hpp
main
int main(int argc, char **argv)
Definition
main.cpp:173
mxvk_exception.hpp
Arguments
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition
argz.hpp:730
Arguments::fullscreen
bool fullscreen
Whether fullscreen mode was requested.
Definition
argz.hpp:736
Arguments::enable_vsync
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
Definition
argz.hpp:750
Arguments::height
int height
Viewport height in pixels (default: 720).
Definition
argz.hpp:733
Arguments::path
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition
argz.hpp:735
Arguments::width
int width
Viewport width in pixels (default: 1280).
Definition
argz.hpp:732
examples
defender
defender.cpp
Generated by
1.18.0