[SDL] Flickering and division by zero in Windows

Andre de Leiradella leiradella at bigfoot.com
Sun Mar 4 15:40:18 PST 2007


> -- set the video mode
> local screen = image_lib.set_video(800, 600)
> -- load and resize the background
> local background = image_lib.load('background.png')
> background = background.resize(screen.width, screen.height)
> -- evaluates a half-transparent black color
> local transparent = image_lib.color(0, 0, 0, 128)
> -- loop until the user presses the left mouse button
> while true do
>     -- query the mouse
>     x, y, left = input_lib.mouse()
>     -- blit the background to the screen, covering all pixels
>     background.blit(screen, 0, 0)
>     -- fill a square with the half-transparent black
>     screen.filled_rect(10, 10, screen.width - 10, screen.width - 10, 
> transparent)
>     -- update the screen
>     screen.update()
>     -- if left mouse button was pressed, break the loop
>     if left then
>        break
>     end
> end
>   

I have found the problem. Blame me, I was setting up a one-second, 
repeating timer that was calling SDL_UpdateRect. When I removed the 
SDL_UpdateRect from the timer the flickering went away.

Sorry for the noise...

Andre


More information about the SDL mailing list