My error: Something about variable block set.
My error line: the line that has " 'error " on it.
My Code:
vb Code:
  1. Dim Dx As DirectX8
  2. Dim D3d As Direct3D8
  3. Dim D As D3DX8
  4. Dim D3DDevice As Direct3DDevice8
  5. Dim MainFont As D3DXFont
  6. Dim MainFontDesc As IFont
  7. Dim TextRect As RECT
  8. Dim fnt As New StdFont
  9. Dim TextToDraw As String
  10.  
  11. Public Sub DrawText(Text As String, X As Long, Y As Long)
  12.     fnt.Name = "Verdana"
  13.     fnt.Size = 18
  14.     fnt.Bold = True
  15.     Set MainFontDesc = fnt
  16.     'Error Set MainFont = D.CreateFont(D3DDevice, MainFontDesc.hFont)
  17.     TextRect.Top = 1
  18.     TextRect.Left = 1
  19.     TextRect.Bottom = Y
  20.     TextRect.Right = X
  21.     D3DDevice.BeginScene
  22.     D.DrawText MainFont, &HFFCCCCFF, Text, TextRect, DT_TOP Or DT_CENTER
  23.     D3DDevice.EndScene
  24.     D3DDevice.Present ByVal 0, ByVal 0, 0, ByVal 0
  25. End Sub
  26.  
  27. Public Sub Init()
  28.     Dim DispMode As D3DDISPLAYMODE
  29.     Dim D3DWindow As D3DPRESENT_PARAMETERS
  30.     Set Dx = New DirectX8
  31.     Set D3d = Dx.Direct3DCreate()
  32.     D3d.GetAdapterDisplayMode D3DADAPTER_DEFAULT, DispMode
  33.     D3DWindow.Windowed = 1
  34.     D3DWindow.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC
  35.     D3DWindow.BackBufferFormat = DispMode.Format
  36.     Set D3DDevice = D3d.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Client.hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow)
  37. End Sub