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 File Reference
#include <cstdlib>
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstring>
#include <format>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <SDL3/SDL.h>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/glm.hpp>
#include "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_abstract_model.hpp"
#include "mxvk/mxvk_exception.hpp"
#include "rain.hpp"

Go to the source code of this file.

Classes

class  example::ModelWindow

Namespaces

namespace  example

Functions

int main (int argc, char **argv)

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 365 of file main.cpp.

365 {
366 try {
367 const Arguments args = proc_args(argc, argv);
368 const bool usingDefaultModel = args.filename.empty();
369 std::string filename = args.filename;
370 if (args.filename.empty()) {
371 filename = args.path + "/data/pyramid.obj";
372 }
374 filename,
375 usingDefaultModel,
376 args.path,
377 args.resource,
378 args.resource_path,
379 args.fragmentPath,
380 args.texture,
381 "MXVK Model Example",
382 args.width,
383 args.height,
384 args.fullscreen,
385 args.enable_vsync,
386 args.binary,
387 args.font_size,
388 args.font_path,
389 args.color);
390 window.loop();
391 } catch (mxvk::Exception &e) {
392 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
393 return EXIT_FAILURE;
394 } catch (ArgException<std::string> &e) {
395 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
396 return EXIT_FAILURE;
397 }
398
399 return EXIT_SUCCESS;
400}
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
String text() const
Definition argz.hpp:182
std::string text() const
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:730
std::string font_path
Optional font file path (--font-path).
Definition argz.hpp:762
bool fullscreen
Whether fullscreen mode was requested.
Definition argz.hpp:736
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
Definition argz.hpp:750
std::string texture
Optional texture file path (--texture).
Definition argz.hpp:764
int height
Viewport height in pixels (default: 720).
Definition argz.hpp:733
std::string color
Optional rain RGB tint (--color).
Definition argz.hpp:763
std::string resource_path
Resource path.
Definition argz.hpp:771
std::string filename
Optional input filename (--filename).
Definition argz.hpp:738
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition argz.hpp:735
std::string fragmentPath
Optional fragment shader SPV path (--fragment).
Definition argz.hpp:766
int width
Viewport width in pixels (default: 1280).
Definition argz.hpp:732
std::string resource
Resource file.
Definition argz.hpp:770
int font_size
Matrix rain font size in pixels (--font-size).
Definition argz.hpp:761
bool binary
Use binary glyphs only (--binary).
Definition argz.hpp:748