MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
binary_matrix.cpp File Reference
#include "mxvk/argz.hpp"
#include "mxvk/mxvk.hpp"
#include "mxvk/mxvk_exception.hpp"
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <algorithm>
#include <charconv>
#include <chrono>
#include <cmath>
#include <cstdlib>
#include <format>
#include <iostream>
#include <memory>
#include <optional>
#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::BinaryMatrixWindow
struct  anonymous_namespace{binary_matrix.cpp}::Stream
struct  anonymous_namespace{binary_matrix.cpp}::SurfaceDeleter
struct  anonymous_namespace{binary_matrix.cpp}::TtfDeleter

Namespaces

namespace  anonymous_namespace{binary_matrix.cpp}
namespace  example

Typedefs

using anonymous_namespace{binary_matrix.cpp}::Clock = std::chrono::steady_clock
using anonymous_namespace{binary_matrix.cpp}::FontPtr = std::unique_ptr<TTF_Font, TtfDeleter>
using anonymous_namespace{binary_matrix.cpp}::SurfacePtr = std::unique_ptr<SDL_Surface, SurfaceDeleter>

Functions

int main (int argc, char **argv)
SDL_Color anonymous_namespace{binary_matrix.cpp}::matrixTrailColor (int level)
std::optional< SDL_Color > anonymous_namespace{binary_matrix.cpp}::parse_color_spec (const std::string &spec)
std::optional< Uint8 > anonymous_namespace{binary_matrix.cpp}::parse_u8_component (const std::string &value, int base)
SurfacePtr anonymous_namespace{binary_matrix.cpp}::renderGlyph (TTF_Font *font, const std::string &glyph, const SDL_Color &color)
std::string anonymous_namespace{binary_matrix.cpp}::trim_copy (const std::string &value)

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 506 of file binary_matrix.cpp.

506 {
507 try {
508 Arguments args = proc_args(argc, argv);
509 example::BinaryMatrixWindow window(args.path, "-[ MXVK Binary Matrix ]-", args.width, args.height, args.fullscreen, args.enable_vsync, args.font_size, args.color);
510 window.loop();
511 } catch (mxvk::Exception &e) {
512 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
513 return EXIT_FAILURE;
514 } catch (ArgException<std::string> &e) {
515 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
516 return EXIT_FAILURE;
517 }
518
519 return EXIT_SUCCESS;
520}
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Definition argz.hpp:854
Exception thrown by Argz::proc() on unrecognised or malformed options.
Definition argz.hpp:169
String text() const
Definition argz.hpp:173
std::string text() const
Plain data structure returned by proc_args() with all common libmx2 CLI options.
Definition argz.hpp:718
bool fullscreen
Whether fullscreen mode was requested.
Definition argz.hpp:724
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
Definition argz.hpp:738
int height
Viewport height in pixels (default: 720).
Definition argz.hpp:721
std::string color
Optional rain RGB tint (--color).
Definition argz.hpp:751
std::string path
Asset root; proc_args() defaults it to the executable directory.
Definition argz.hpp:723
int width
Viewport width in pixels (default: 1280).
Definition argz.hpp:720
int font_size
Matrix rain font size in pixels (--font-size).
Definition argz.hpp:749