12template<std::
unsigned_
integral Pixel>
14 :
Layer(COVER_FULL, Z_BACKGROUND)
23template<std::
unsigned_
integral Pixel>
27 std::uniform_int_distribution<int> distribution(0, 255);
29 auto& output = checked_cast<SDLOutputSurface&>(output_);
31 auto pixelAccess = output.getDirectPixelAccess();
32 auto [width, height] = output.getLogicalSize();
33 for (
int y = 0; y < height; y += 2) {
34 auto p0 = pixelAccess.getLine<
Pixel>(y + 0).
subspan(0, width);
35 for (
int x = 0; x < width; x += 2) {
36 p0[x + 0] = p0[x + 1] = gray[distribution(generator)];
38 auto p1 = pixelAccess.getLine<
Pixel>(y + 1).
subspan(0, width);
42 output.flushFrameBuffer();
44 display.repaintDelayed(100 * 1000);
Represents the output window/screen of openMSX.
Interface for display layers.
A frame buffer where pixels can be written to.
uint32_t mapRGB255(gl::ivec3 rgb) const
Same as mapRGB, but RGB components are in range [0..255].
Snow effect for background layer.
void paint(OutputSurface &output) override
Paint this layer.
SDLSnow(OutputSurface &output, Display &display)
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....
This file implemented 3 utility functions:
auto copy(InputRange &&range, OutputIter out)
auto & global_urng()
Return reference to a (shared) global random number generator.
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)