more color

This commit is contained in:
Jakob Hördt 2024-08-08 00:53:08 +02:00
parent 3212f868ec
commit 7ac814bc48
2 changed files with 24 additions and 9 deletions

View file

@ -64,7 +64,7 @@ using clock = std::chrono::steady_clock;
constexpr int width = 2000;
constexpr int height = 1000;
constexpr auto steps_per_second = 100'000;
constexpr auto steps_per_second = 1'000'000;
template <auto EF>
struct [[nodiscard("give this a name so SDL_Quit is called at the end"
@ -88,6 +88,15 @@ struct Walker {
SDL_Point pos;
SDL_Color col;
};
constexpr auto html2sdl_color(Uint32 rgb) {
return SDL_Color{
.r = static_cast<Uint8>(rgb >> 16U),
.g = static_cast<Uint8>((rgb >> 8U) & 0xffU),
.b = static_cast<Uint8>(rgb & 0xffU),
.a = SDL_ALPHA_OPAQUE
};
}
} // namespace
template <typename Loopdata>
@ -184,15 +193,21 @@ int main() try {
);
sdl_check(SDL_RenderClear(renderer));
const auto middle = SDL_Point{.x = width / 2, .y = height / 2};
auto walkers = std::to_array<Walker>(
{{.pos = {.x = width / 2, .y = height / 2},
.col = {.r = 0xff, .g = 0x00, .b = 0x00, .a = 0xff}},
{.pos = {.x = width / 2, .y = height / 2},
.col = {.r = 0x00, .g = 0xff, .b = 0x00, .a = 0xff}},
{.pos = {.x = width / 2, .y = height / 2},
.col = {.r = 0x00, .g = 0x00, .b = 0xff, .a = 0xff}},
{.pos = {.x = width / 2, .y = height / 2},
.col = {.r = 0x00, .g = 0x00, .b = 0x00, .a = 0xff}}}
{/* {.pos = middle, .col = html2sdl_color(0x522258)},
{.pos = middle, .col = html2sdl_color(0x8C3061)},
{.pos = middle, .col = html2sdl_color(0xC63C51)},
{.pos = middle, .col = html2sdl_color(0xD95F59)} */
/* {.pos = middle, .col = html2sdl_color(0x402E7A)},
{.pos = middle, .col = html2sdl_color(0x4C3BCF)},
{.pos = middle, .col = html2sdl_color(0x4B70F5)},
{.pos = middle, .col = html2sdl_color(0x3DC2EC)} */
{.pos = middle, .col = html2sdl_color(0x006769)},
{.pos = middle, .col = html2sdl_color(0x40A578)},
{.pos = middle, .col = html2sdl_color(0x9DDE8B)},
{.pos = middle, .col = html2sdl_color(0xE6FF94)}
}
);
std::mt19937_64 rne(std::random_device{}());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 432 KiB