Results 1 to 2 of 2

Thread: DirectDraw

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    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.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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?
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width