[SDL] Strange flickering

Ville Koskinen viller.koskinen at iobox.com
Mon Jan 14 23:24:01 PST 2002


Hi,

I've experienced some very strange flickering effect. I have these functions (pseudo-code...)

Draw(Object &ob)
{
      if (redraw)
      {
             redraw = false;
             ClearScreen();
      }
      SDL_BlitSurface(screen, ob.GetFrame(), ob.GetLocation());
}

Sync()
{
        Delay();
        Flip();
        redraw = true;
}

If I call then

Draw(&dog);
Sync();

It draws the dog okay (no flicker), but if I have more than one sprites at once, like this

Draw(&dog);
Draw(&cat);
Sync();

all of them flicker badly. I've tried both SDL_SWSURFACE and SDL_HWSURFACE | SDL_DOUBLEBUF, I've tried to use SDL_UpdateRects, I've tried to erase the screen in different places but none of them works properly. It'd be nice to have at least two sprites at once... ;-) So, what's the catch?

-- 
-- Ville Koskinen
viller.koskinen at iobox.com
Finland






More information about the SDL mailing list