MXVK Vulkan Framework 0.24.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 525 of file binary_matrix.cpp.

525 {
526 try {
527 Arguments args = proc_args(argc, argv);
529 args.path, "-[ MXVK Binary Matrix ]-", args.width, args.height, args.fullscreen, args.enable_vsync, args.font_size, args.color);
530 window.loop();
531 } catch (mxvk::Exception &e) {
532 std::cerr << std::format("mxvk: Exception: {}\n", e.text());
533 return EXIT_FAILURE;
534 } catch (ArgException<std::string> &e) {
535 std::cerr << std::format("mxvk: Argument Exception: {}\n", e.text());
536 return EXIT_FAILURE;
537 }
538
539 return EXIT_SUCCESS;
540}
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 color
Optional rain RGB tint (--color).
Definition argz.hpp:763
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
int font_size
Matrix rain font size in pixels (--font-size).
Definition argz.hpp:761