home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / UPDATED_DI543912102002.psc / Objects.bas < prev    next >
Encoding:
BASIC Source File  |  2002-02-09  |  1.5 KB  |  69 lines

  1. Attribute VB_Name = "mObjects"
  2. Option Explicit
  3.  
  4. 'Before creating these objects below you will need:
  5. '   1. The DirectX8 runtime files (www.microsoft.com/directx)
  6. '   2. The DirectX8 Type Libraries for VB
  7. '   3. To have loaded the Type Libraries
  8. '   Project > References > DirectX 8 for VB type libraries
  9.  
  10.  
  11. 'Main Control Object for DirectX 8
  12. 'Required for setting up all other main DirectX objects
  13. Public DX8 As DirectX8
  14.  
  15. 'D3D Object
  16. 'Contains all that is necessary to make 3d thingys
  17. Public D3D As Direct3D8
  18.  
  19. Public D3DX As New D3DX8
  20.  
  21. 'D3D Device
  22. 'Represents the hardware that renders the scene
  23. Public D3DDevice As Direct3DDevice8
  24.  
  25. 'Vertex Buffer
  26. 'An area of memory set aside for storing a list of verticies
  27. Public vertexBuffer As Direct3DVertexBuffer8
  28.  
  29. Public Light As D3DLIGHT8
  30.  
  31. Public Texture As Direct3DTexture8
  32.  
  33. Enum runningMode
  34.     notRunning
  35.     Normal
  36.     lighting
  37.     Texturing
  38. End Enum
  39.  
  40. Public Const PI = 3.14159265358979
  41.  
  42. Global currentApp As runningMode
  43.  
  44. Sub addReport(text As String)
  45.  
  46.     frmMain.lstReport.AddItem text
  47.  
  48. End Sub
  49.  
  50. Sub unloadObjects()
  51.     'Stop the render loop if its running
  52.     'then unload all the objects in reverse order for some reason.
  53.     'I think it's to do with how windows handles memory.
  54.         
  55.     currentApp = notRunning
  56.     
  57.     Set D3DDevice = Nothing
  58.     Set D3D = Nothing
  59.     Set DX8 = Nothing
  60.     Set D3DX = Nothing
  61.     
  62.     Unload frmMain
  63.     Unload frmFullDisp
  64.     
  65.     End
  66.  
  67. End Sub
  68.  
  69.