FORM1
Private Sub Form_Load()
IntHoritzontal = 800 'This is the screen width
IntVertical = 600 'This is the screen height
InicializarVideo IntHoritzontal, IntVertical
End Sub
MODULE
Option Explicit
Public IntHoritzontal As Integer
Public IntVertical As Integer
' main system definitions
Public Direct As New DirectX7 'type directx7
Public Ddraw As DirectDraw4 'type directdraw
Public Ddrm As Direct3DRM3 'to running D3DRM
'secondari definitions
Public DDclipper As DirectDrawClipper 'to link
the clipper
Public DDsurface As DirectDrawSurface4 'primary
buffer
Public DDsurfacesec As DirectDrawSurface4 'secondary
buffer
Public DDSDsurface As DDSURFACEDESC2 'to define
primary buffer characteristic
Public DDSCAP As DDSCAPS2 'to define viewport
characteristic
Public RMDevice As Direct3DRMDevice3 'link direct3d
with DD4
Public RMViewport As Direct3DRMViewport2 'link
the word with the camera
'scene definitions
Public Function InicializarVideo(Horitzontal As Integer, Vertical As
Integer)
Set Ddraw = Direct.DirectDraw4Create("") 'link
directx7 with DD4
Form1.Show
Ddraw.SetCooperativeLevel Form1.hWnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE
'prepares de exis device ,select form1
Ddraw.SetDisplayMode Horitzontal, Vertical, 16, 0, DDSDM_DEFAULT
'how big is the screen
DDSDsurface.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
DDSDsurface.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_3DDEVICE
Or DDSCAPS_COMPLEX Or DDSCAPS_FLIP
DDSDsurface.lBackBufferCount = 1
Set DDsurface = Ddraw.CreateSurface(DDSDsurface)
DDSCAP.lCaps = DDSCAPS_BACKBUFFER
Set DDsurfacesec = DDsurface.GetAttachedSurface(DDSCAP)
'create a retained module
Set Ddrm = Direct.Direct3DRMCreate()
'IF YOUR DON`T HAVE A 3D ACCELERATOR CARD NEED
CHANGE "IID_IDirect3DHALDevice"
TO "IID_IDirect3DRGBDevice"
Set RMDevice = Ddrm.CreateDeviceFromSurface("IID_IDirect3DHALDevice",
Ddraw, DDsurfacesec, D3DRMDEVICE_DEFAULT)
RMDevice.SetBufferCount 2
'some device abilities
RMDevice.SetQuality D3DRMLIGHT_ON Or D3DRMFILL_SOLID Or D3DRMSHADE_PHONG
Or D3DRMSHADE_MAX
RMDevice.SetTextureQuality D3DRMTEXTURE_MIPNEAREST
RMDevice.SetRenderMode D3DRMRENDERMODE_DEFAULT
End Function
You can download a source code.
|