-
DirectDraw
Code:
Dim DX As New DirectX7
Dim DD As DirectDraw7
Dim P As DirectDrawSurface7
Dim B As DirectDrawSurface7
Dim S As DirectDrawSurface7
Dim dP As DDSURFACEDESC2
Dim dB As DDSURFACEDESC2
Dim dS As DDSURFACEDESC2
Dim pos As Integer
Private Sub cmdOpen_Click()
dS.lFlags = DDSD_CAPS
dS.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
Set S = Nothing
Set S = DD.CreateSurfaceFromFile(Text1.Text, dS)
Dim Dest As RECT, Src As RECT
Dest.Bottom = 241
Dest.Left = 289 * pos - 289
Dest.Right = 289 * pos
Src.Right = dS.lWidth
Src.Bottom = dS.lHeight
B.Blt Dest, S, Src, DDBLT_WAIT
P.Flip B, DDFLIP_WAIT
pos = pos + 289
End Sub
Private Sub Form_Load()
Set DD = DX.DirectDrawCreate("")
dP.lFlags = DDSD_BACKBUFFERCOUNT Or DDSD_CAPS
dP.ddsCaps.lCaps = DDSCAPS_FLIP Or DDSCAPS_COMPLEX Or DDSCAPS_PRIMARYSURFACE
dP.lBackBufferCount = 1
Set P = DD.CreateSurface(dP)
Dim cap As DDSCAPS2
cap.lCaps = DDSCAPS_BACKBUFFER
Set B = P.GetAttachedSurface(cap)
B.GetSurfaceDesc dP
pos = 0
End Sub
Whats wrong with this code?
It says that Set P = DD.CreateSurface(dP) is wrong somehow during run-time
Im trying to make a frame editor for some animation for my other program.
-
There are a few things wrong, although I dont know if these are related to the problem:
Pos = Pos + 289
289 * Pos(289) = BIG BIG NUMBER
Should be
Pos = Pos + 1
289 * 1 = 289
289 * 2 = 578
...etc.
And where do you attach the backbuffer?