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 "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_exception.hpp"
#include "mxvk/mxvk_math.h"
#include <SDL3/SDL.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <format>
#include <iostream>
#include <limits>
#include <memory>
#include <random>
#include <vector>

Go to the source code of this file.

Classes

class  example::Math3DPongWindow
struct  anonymous_namespace{main.cpp}::Mesh
struct  anonymous_namespace{main.cpp}::MeshInstance
class  anonymous_namespace{main.cpp}::PongGame
class  anonymous_namespace{main.cpp}::SoftwareRenderer
class  anonymous_namespace{main.cpp}::SurfaceDeleter
struct  anonymous_namespace{main.cpp}::Triangle

Namespaces

namespace  anonymous_namespace{main.cpp}
namespace  example

Functions

int main (int argc, char **argv)

Variables

constexpr float anonymous_namespace{main.cpp}::BALL_RADIUS = 0.14f
constexpr float anonymous_namespace{main.cpp}::CAMERA_DISTANCE = 7.0f
constexpr float anonymous_namespace{main.cpp}::COURT_HALF_HEIGHT = 1.45f
constexpr float anonymous_namespace{main.cpp}::COURT_HALF_WIDTH = 2.65f
constexpr int anonymous_namespace{main.cpp}::DEFAULT_FRAME_HEIGHT = 240
constexpr int anonymous_namespace{main.cpp}::DEFAULT_FRAME_WIDTH = 320
constexpr float anonymous_namespace{main.cpp}::PADDLE_HALF_HEIGHT = 0.42f
constexpr float anonymous_namespace{main.cpp}::PADDLE_HALF_WIDTH = 0.12f
constexpr float anonymous_namespace{main.cpp}::PADDLE_X = 2.25f
constexpr int anonymous_namespace{main.cpp}::WINDOW_HEIGHT = 1080
constexpr int anonymous_namespace{main.cpp}::WINDOW_WIDTH = 1440

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 618 of file main.cpp.

618 {
619 try {
620 const Arguments args = proc_args(argc, argv);
621 const FramebufferDimensions framebuffer = args.framebufferSpecified
622 ? args.framebuffer
624 example::Math3DPongWindow window(args.fullscreen, args.enable_vsync, framebuffer);
625 window.loop();
626 } catch (mxvk::Exception &exception) {
627 std::cerr << std::format("mxvk: Exception: {}\n", exception.text());
628 return EXIT_FAILURE;
629 } catch (ArgException<std::string> &exception) {
630 std::cerr << std::format("mxvk: Argument Exception: {}\n", exception.text());
631 return EXIT_FAILURE;
632 }
633 return EXIT_SUCCESS;
634}
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
constexpr int DEFAULT_FRAME_WIDTH
Definition main.cpp:26
constexpr int DEFAULT_FRAME_HEIGHT
Definition main.cpp:27
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:730
FramebufferDimensions framebuffer
Software framebuffer size requested by --framebuffer.
Definition argz.hpp:758
bool framebufferSpecified
Whether --framebuffer was provided.
Definition argz.hpp:759
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
Parsed software framebuffer dimensions.
Definition argz.hpp:721