DirectDraw

JonasE
04-05-2005, 07:09 AM
I just switched the rendering mode from BitBlt to DirectDraw for my tile engine, but now it flickers quite badly when the map is scrolled. Can anybody help me please? I'm really new at all this DirectX programming. Also, I tried using a backbuffer... it didn't work... Still flickers... This is the code to create graphics to a picturebox ==>


Private Sub DrawSurface()
Dim Dest As Rectangle
Try
BackSurface.ColorFill(Color.Blue)
BackSurface.DrawFast(0, 0, MapSurface, Map.Rect, DrawFastFlags.Wait)
Catch ex As SurfaceLostException
InitializeSurface()
End Try

Dest = New Rectangle(PointToScreen(Me.picMain.Location), Me.picMain.Size)
FrontSurface.Draw(Dest, BackSurface, DrawFlags.DoNotWait)
End Sub

Iceplug
04-05-2005, 08:20 AM
Is FrontSurface the surface that draws to the screen? How often are you drawing it?

JonasE
04-06-2005, 08:14 AM
Yes, FrontSurface is the surface that draws to the screen (Picturebox, not in fullscreen). Every time i hit arrowkeys.

Iceplug
04-06-2005, 11:54 AM
Oh... have you ever done a game loop before?
Have a look here:
http://iceplug.vwebservices.com/cnddfrsh.htm
But that is usually what governs how the display is drawn.
:)

JonasE
04-07-2005, 07:26 AM
I attach a very short and simple version off my program, but the graphics draws in the same way. If you press and hold down “right key”, the rectangle will move to the middle of the picture box, then the background start to scroll. In the same time the background starts to flicker. Test, and see for you self.

JonasE
04-12-2005, 06:58 AM
Any solution?

Iceplug?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum