revert misguided batchsize adaption
just set how many steps to do each frame
This commit is contained in:
parent
f5704b6d84
commit
baf1a05e0a
1 changed files with 4 additions and 7 deletions
11
main.cpp
11
main.cpp
|
@ -101,6 +101,7 @@ int main() {
|
|||
// aarrggbb??
|
||||
constexpr Uint32 bg_color = 0xffdbd7c0;
|
||||
constexpr Uint32 walk_color = 0xff0d0f14;
|
||||
constexpr auto batchsize = 1000;
|
||||
|
||||
SDL_LockSurface(window_surface);
|
||||
for (int i = 0; i < window_surface->w * window_surface->h; ++i) {
|
||||
|
@ -108,13 +109,11 @@ int main() {
|
|||
}
|
||||
SDL_UnlockSurface(window_surface);
|
||||
|
||||
auto batchsize = 100.0;
|
||||
constexpr auto frametime_target = std::chrono::milliseconds{10};
|
||||
|
||||
const auto start_time = clock::now();
|
||||
auto next_poll_events_time = start_time;
|
||||
auto frame_start = start_time - frametime_target;
|
||||
clock::duration frame_time = frametime_target;
|
||||
auto frame_start = start_time;
|
||||
clock::duration frame_time;
|
||||
for (bool continu = true; continu;) {
|
||||
{
|
||||
// measure frame_time
|
||||
|
@ -123,10 +122,8 @@ int main() {
|
|||
frame_start = now;
|
||||
}
|
||||
|
||||
batchsize = batchsize * (0.9 + 0.1 * frametime_target / frame_time);
|
||||
|
||||
SDL_LockSurface(window_surface);
|
||||
for (auto step = 0z; step < int(batchsize); ++step) {
|
||||
for (auto step = 0z; step < batchsize; ++step) {
|
||||
SDL_Point newpoint;
|
||||
do {
|
||||
newpoint = pos + directions[dist(rne)];
|
||||
|
|
Loading…
Reference in a new issue