only render 1 sample per event loop

This commit is contained in:
Fabien Freling 2021-04-27 09:05:46 +02:00
parent 80fed125b4
commit a3df9a7707

View file

@ -128,9 +128,9 @@ pub fn main() anyerror!void {
} }
} }
if (k < samplesPerPixel) {
// Render // Render
{
while (k < samplesPerPixel) {
_ = sdl.c.SDL_LockSurface(surface); _ = sdl.c.SDL_LockSurface(surface);
var j: usize = 0; var j: usize = 0;
@ -160,11 +160,11 @@ pub fn main() anyerror!void {
sdl.c.SDL_UnlockSurface(surface); sdl.c.SDL_UnlockSurface(surface);
_ = sdl.c.SDL_UpdateWindowSurface(window); _ = sdl.c.SDL_UpdateWindowSurface(window);
k += 1; k += 1;
}
}
if (k >= samplesPerPixel) { } else {
sdl.c.SDL_Delay(1000 / fps); sdl.c.SDL_Delay(1000 / fps);
} }
} }
} }