home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD72326282000.psc / ModSurfaces.bas < prev    next >
Encoding:
BASIC Source File  |  2000-06-28  |  1.6 KB  |  59 lines

  1. Attribute VB_Name = "ModSurfaces"
  2. Public BackBuffer As DirectDrawSurface7
  3. Public View As DirectDrawSurface7
  4. Public Sprites As DirectDrawSurface7
  5. Public Background As DirectDrawSurface7
  6. Public Intro As DirectDrawSurface7
  7.  
  8. Public ViewDesc As DDSURFACEDESC2
  9. Public BackBufferDesc As DDSURFACEDESC2
  10. Public SpritesDesc As DDSURFACEDESC2
  11. Public BackgroundDesc As DDSURFACEDESC2
  12. Public IntroDesc As DDSURFACEDESC2
  13.  
  14. Public BackBufferCaps As DDSCAPS2
  15.  
  16. Public ColorKey As DDCOLORKEY
  17.  
  18. Sub CreatePrimaryAndBackBuffer()
  19. Set View = Nothing
  20. Set BackBuffer = Nothing
  21.  
  22. ViewDesc.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
  23. ViewDesc.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX
  24. ViewDesc.lBackBufferCount = 1
  25. Set View = DX_Draw.CreateSurface(ViewDesc)
  26.  
  27. BackBufferCaps.lCaps = DDSCAPS_BACKBUFFER
  28. Set BackBuffer = View.GetAttachedSurface(BackBufferCaps)
  29. BackBuffer.GetSurfaceDesc ViewDesc
  30.  
  31. BackBuffer.SetFontTransparency True
  32. End Sub
  33.  
  34. Sub LoadAllPics()
  35. Dim Path As String
  36.  
  37. CreatePrimaryAndBackBuffer
  38.  
  39. Set Sprites = Nothing
  40. Set Intro = Nothing
  41. Set Background = Nothing
  42.  
  43. ModDX7.CreateSurfaceFromFile Sprites, SpritesDesc, App.Path & "\resources\sprites.bmp", 400, 50
  44. ModDX7.CreateSurfaceFromFile Background, BackgroundDesc, App.Path & "\resources\background.bmp", 640, 480
  45. ModDX7.CreateSurfaceFromFile Intro, IntroDesc, App.Path & "\resources\intro.bmp", 640, 480
  46.  
  47. ModDX7.AddColorKey Sprites, ColorKey, vbBlack, vbBlack
  48.  
  49. End Sub
  50.  
  51. Sub UnloadAllPics()
  52. Set Sprites = Nothing
  53. Set BackBuffer = Nothing
  54. Set View = Nothing
  55. Set Intro = Nothing
  56. Set Background = Nothing
  57. End Sub
  58.  
  59.