Всегда делаю так
- Код: Выделить всё
Public MainFont As D3DXFont
Public fnt As New StdFont
Public TextRect As RECT 'Пишу в модуле ошибки - нет.
Public MainFontDesc As IFont
Public Sub SetFont(FontName as String,FontSize As Currency, FontBold As Boolean)
'Задаю все параметры для fnt
Set MainFontDesc = fnt
Set MainFont = D3DX.CreateFont(D3DDevice,MainFontDesc.hFont)
End If
Public Sub DrawText(Text As String,X As Single,Y As Sinlge,Optional Color As Long = vbWhite)
TextRect.Top = Y
TextRect.Left = X
If D3DDevice.GetRenderState(D3DRS_FOGENABLE) Then
D3DDevice.SetRenderState D3DRS_FOGENABLE,0
D3DX.Drawtext MainFont, Color, Text, TextRect, DT_TOP Or DT_LEFT
D3DDevice.SetRenderState D3DRS_FOGENABLE, 1
Else
D3DX.Drawtext MainFont, Color, Text, TextRect, DT_TOP Or DT_LEFT
End If
End Sub