fight
This commit is contained in:
parent
d7c7d773ab
commit
78471c21f0
2 changed files with 16 additions and 4 deletions
20
main.cpp
20
main.cpp
|
@ -113,6 +113,7 @@ int main() try {
|
|||
sdl_check(SDL_RenderClear(renderer));
|
||||
|
||||
SDL_Point pos{.x = width / 2, .y = height / 2};
|
||||
SDL_Point pos1{.x = width / 2, .y = height / 2};
|
||||
constexpr SDL_Point directions[] = {
|
||||
{.x = -1, .y = 0}, {.x = 1, .y = 0}, {.x = 0, .y = -1}, {.x = 0, .y = 1}
|
||||
};
|
||||
|
@ -160,14 +161,25 @@ int main() try {
|
|||
SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD
|
||||
)
|
||||
));
|
||||
sdl_check(
|
||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE)
|
||||
);
|
||||
sdl_check(SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 32));
|
||||
sdl_check(SDL_RenderDrawPoints(
|
||||
renderer, point_batch.data(), point_batch.size()
|
||||
));
|
||||
for (auto step = 0z; step < batchsize; ++step) {
|
||||
SDL_Point newpoint;
|
||||
do {
|
||||
newpoint = pos1 + directions[dist(rne)];
|
||||
} while (newpoint.x < 0 or newpoint.x >= width or newpoint.y < 0 or
|
||||
newpoint.y >= height);
|
||||
pos1 = newpoint;
|
||||
point_batch[step] = newpoint;
|
||||
}
|
||||
sdl_check(SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 32));
|
||||
sdl_check(SDL_RenderFillRect(renderer, nullptr));
|
||||
sdl_check(SDL_RenderDrawPoints(
|
||||
renderer, point_batch.data(), point_batch.size()
|
||||
));
|
||||
// sdl_check(SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 32));
|
||||
// sdl_check(SDL_RenderFillRect(renderer, nullptr));
|
||||
// SDL_RenderCopy(renderer, fade_texture, nullptr, nullptr);
|
||||
|
||||
///// Render screen
|
||||
|
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 1.9 MiB |
Loading…
Reference in a new issue