MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
pong.cpp File Reference
#include <SDL3/SDL.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <format>
#include <iomanip>
#include <iostream>
#include <memory>
#include <random>
#include <sstream>
#include <string>
#include <vector>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/quaternion.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 "mxvk/mxvk_png.hpp"
#include "mxvk/mxvk_sound.hpp"

Go to the source code of this file.

Classes

class  anonymous_namespace{pong.cpp}::Ball
class  anonymous_namespace{pong.cpp}::Paddle
struct  anonymous_namespace{pong.cpp}::Particle
struct  anonymous_namespace{pong.cpp}::ParticleVertex
struct  anonymous_namespace{pong.cpp}::PongUniformBufferObject
class  anonymous_namespace{pong.cpp}::PongWindow
struct  anonymous_namespace{pong.cpp}::Star
struct  anonymous_namespace{pong.cpp}::StarVertex

Namespaces

namespace  anonymous_namespace{pong.cpp}

Macros

#define pong_ASSET_DIR   "."

Functions

int main (int argc, char **argv)

Macro Definition Documentation

◆ pong_ASSET_DIR

#define pong_ASSET_DIR   "."

Definition at line 34 of file pong.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 2093 of file pong.cpp.

2093 {
2094 try {
2095 Arguments args = proc_args(argc, argv);
2096 PongWindow window(args.path, args.width, args.height, args.fullscreen, args.enable_vsync);
2097 window.loop();
2098 } catch (mxvk::Exception &e) {
2099 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
2100 return EXIT_FAILURE;
2101 } catch (ArgException<std::string> &e) {
2102 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
2103 return EXIT_FAILURE;
2104 } catch (const std::exception &e) {
2105 std::cerr << std::format("std::exception: {}\n", e.what());
2106 return EXIT_FAILURE;
2107 }
2108
2109 return EXIT_SUCCESS;
2110}
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
PongWindow(const std::string &path, int width, int height, bool fullscreen, bool enable_vsync)
Definition pong.cpp:263
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