MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
example.cpp File Reference
#include "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_exception.hpp"
#include "mxvk/mxvk_png.hpp"
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <format>
#include <iostream>
#include <memory>
#include <random>
#include <string>
#include <vector>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/glm.hpp>

Go to the source code of this file.

Classes

class  example::ExampleWindow
struct  example::anonymous_namespace{example.cpp}::SaucerFlight
struct  example::anonymous_namespace{example.cpp}::StarParticle

Namespaces

namespace  example
namespace  example::anonymous_namespace{example.cpp}

Functions

SDL_Surface * example::anonymous_namespace{example.cpp}::create_star_surface ()
SDL_Surface * example::anonymous_namespace{example.cpp}::load_transparent_saucer (const std::string &png_path)
int main (int argc, char **argv)
float example::anonymous_namespace{example.cpp}::random_float (float min_value, float max_value)

Variables

constexpr float example::anonymous_namespace{example.cpp}::k_pi = 3.14159265358979323846f

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 435 of file example.cpp.

435 {
436 try {
437 const Arguments args = proc_args(argc, argv);
438 example::ExampleWindow window(args.path, "VK_Sprite3D Example", args.width, args.height, args.fullscreen, args.enable_vsync);
439 window.loop();
440 } catch (mxvk::Exception &e) {
441 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
442 return EXIT_FAILURE;
443 } catch (ArgException<std::string> &e) {
444 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
445 return EXIT_FAILURE;
446 }
447
448 return EXIT_SUCCESS;
449}
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
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
int height
Viewport height in pixels (default: 720).
Definition argz.hpp:733
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition argz.hpp:735
int width
Viewport width in pixels (default: 1280).
Definition argz.hpp:732