12#include <SDL3_ttf/SDL_ttf.h>
63 Rain(
const std::string &asset_root,
bool binary_glyph_mode);
71 void event(SDL_Event &e);
90 [[nodiscard]] SDL_Surface *
surface()
const;
91 [[nodiscard]]
const void *
pixels()
const;
92 [[nodiscard]]
int width()
const;
93 [[nodiscard]]
int height()
const;
94 [[nodiscard]]
int pitch()
const;
97 enum class SurfaceMode {
102 struct SurfaceDeleter {
103 void operator()(SDL_Surface *
surface)
const;
107 void operator()(TTF_Font *font)
const;
110 using SurfacePtr = std::unique_ptr<SDL_Surface, SurfaceDeleter>;
111 using FontPtr = std::unique_ptr<TTF_Font, TtfDeleter>;
114 Uint32 codepoint = 0;
115 std::vector<SurfacePtr> levels{};
127 void rebuild_for_extent(mxvk::VK_Window &window);
128 void randomize_streams();
129 void update_rain(
float dt);
130 void reset_stream(Stream &stream);
131 void fade_canvas(
float dt);
132 void draw_stream(
int column,
const Stream &stream);
135 Rain(RainConfig config, SurfaceMode mode);
140 SurfacePtr background;
141 mxvk::VK_Sprite *rain_sprite =
nullptr;
142 std::vector<Glyph> glyphs;
143 std::vector<Stream> streams;
145 std::chrono::steady_clock::time_point last_frame{};
150 int frame_counter = 0;
151 float opacity = 1.0f;
152 bool ttf_acquired =
false;
static SDL_Color matrix_color(int level)
static std::vector< Uint32 > full_symbol_set()
Rain & operator=(Rain &&)=delete
void resize(mxvk::VK_Window &window)
static SDL_Color head_color()
Rain(mxvk::VK_Window &window, RainConfig config)
void on_swapchain_recreated(mxvk::VK_Window &window)
const void * pixels() const
Rain & operator=(const Rain &)=delete
static std::vector< Uint32 > binary_symbol_set()
void set_opacity(float opacity)
SDL_Surface * surface() const
void update_and_render(mxvk::VK_Window &window)
Rain(const Rain &)=delete
mxvk::VK_Sprite * sprite() const
Main Vulkan window wrapper for MXVK.
RainConfig make_matrix_rain_config(const std::string &asset_root, bool binary_glyph_mode)
float initial_head_margin
int near_head_tail_threshold
std::function< SDL_Color()> head_color
int initial_min_tail_rows
std::vector< Uint32 > symbols
std::function< SDL_Color(int)> level_color