26 const std::string &title,
29 const bool fullscreen,
30 const bool enable_vsync,
34 const std::string &color)
36 rain(std::make_unique<
matrix::Rain>(
54 void event(SDL_Event &e)
override {
55 if (e.type == SDL_EVENT_KEY_DOWN) {
56 if (e.key.key == SDLK_ESCAPE) {
69 rain->update_and_render(*
this,
static_cast<int>(extent.width),
static_cast<int>(extent.height));
76 rain->on_swapchain_recreated(*
this);
81 std::unique_ptr<matrix::Rain> rain;
85int main(
int argc,
char **argv) {
93 std::cerr << std::format(
"mxvk: Exception: {}\n", e.
text());
96 std::cerr << std::format(
"mxvk: Argument Exception: {}\n", e.
text());
Lightweight, header-only, template command-line argument parser.
Arguments proc_args(int &argc, char **argv)
Parse standard libmx2 command-line options from main()'s argv.
Exception thrown by Argz::proc() on unrecognised or malformed options.
void proc() override
Execute one processing/update step.
MatrixWindow(const std::string &path, const std::string &title, const int width, const int height, const bool fullscreen, const bool enable_vsync, const bool binary, const int font_size, const std::string &font_path, const std::string &color)
void onSwapchainRecreated() override
Called after swapchain and render resources are recreated.
void event(SDL_Event &e) override
Handle one SDL event.
Main Vulkan window wrapper for MXVK.
VkExtent2D getSwapchainExtent() const noexcept
Get the current swapchain extent.
void loop()
Run the main event/render loop.
void setClearColor(float r, float g, float b, float a=1.0f)
Set the per-frame color attachment clear color.
void exit()
Request loop termination.
VK_Window()=default
Construct an empty window object.
constexpr int MATRIX_SURFACE_HEIGHT
constexpr int MATRIX_SURFACE_WIDTH
RainConfig make_matrix_rain_config(const std::string &asset_root, bool binary_glyph_mode)
Utilities for loading and saving PNG images.
Plain data structure returned by proc_args() with all common libmx2 CLI options.
std::string font_path
Optional font file path (--font-path).
bool fullscreen
Whether fullscreen mode was requested.
bool enable_vsync
Enable FIFO present mode / v-sync (--enable-vsync).
int height
Viewport height in pixels (default: 720).
std::string color
Optional rain RGB tint (--color).
std::string path
Asset root; proc_args() defaults it to the executable directory.
int width
Viewport width in pixels (default: 1280).
int font_size
Matrix rain font size in pixels (--font-size).
bool binary
Use binary glyphs only (--binary).