We are developing a 2D strategy game with DDraw. The DDraw is a window and not full screen. While scrolling we have a bad tearing effect near the top of the screen.
With vsync off, we have tearing all over the place.
Any ideas would be appreciated how to avoid this.

I am posting the scroll part of the code here. The code is located in the DXTimer procedure. We tried setting different timers, but that did not help.

And another question: when scrolling is there a better solution to move the sprites than the one below? Now all sprites are in an array and are moved one by one.

BlackVoid


if (isUp in DXInput.States) or scrollup then begin
if Background.Y+ScrollSpeed <= 0 then begin
Background.Y := Background.Y + ScrollSpeed;
AlapY:=AlapY-ScrollSpeed;
for i:=1 to AktSpriteSzam do SpriteTomb[i].Y:=SpriteTomb[i].Y+ScrollSpeed;
// szel beallas
if 0 - Background.Y < ScrollSpeed then begin
for i:=1 to AktSpriteSzam do SpriteTomb[i].Y:=SpriteTomb[i].Y+(0 - Background.Y);
Background.Y:=0;
AlapY:=0;
end;
end;
end;
///*** scroll up end ***///
DXSpriteEngine.Move(1);
DXSpriteEngine.Draw;
DXDraw.Flip;