why is it that when i redraw the entire background it does not flicker. but if i draw the entire background first, then just redraw the section of the background that was drawn over, it flickers.
the following code flickers...
Code:
//draws initial background
DrawIMG(back, 0, 0); // if i move this to wher Update_Background() is, it will not flicker
/* Game loop *************/
bool done = false;
while(!done)
{
while ( SDL_PollEvent(&gameloop) )
{
if ( gameloop.type == SDL_QUIT ) { done = true; }
if ( gameloop.type == SDL_KEYDOWN )
{
if ( gameloop.key.keysym.sym == SDLK_ESCAPE )
{
done = true;
}
}
}
keys = SDL_GetKeyState(NULL);
Update_Background(); //updates background
Move_Block(); //moves block
Draw_Block(); //draws block
SDL_Flip(screen); // flips buffer
}
btw: i have SDL_DOUBLEBUF turned on