Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing text with DirectDraw7 help
#1
Since ES is down at the moment...I'll post my question here.

I'm trying to convert the way ES draws text to DirectDraw...here's what I have:

Note: Old code commented out
Code:
Public GameFont As New StdFont

Public Sub SetFont(ByVal Font As String, ByVal Size As Byte, ByVal Bold As Long, ByVal Italic As Long, ByVal UnderLine As Long, ByVal Strike As Long)
'Dim GameFont As New StdFont
    'GameFont = CreateFont(Size, 0, 0, 0, Bold, Italic, UnderLine, Strike, 0, 0, 0, 0, 0, Font)
    
    If Bold = YES Then
        GameFont.Bold = True
    Else
        GameFont.Bold = False
    End If
    If Italic = YES Then
        GameFont.Italic = True
    Else
        GameFont.Italic = False
    End If
    If UnderLine = YES Then
        GameFont.UnderLine = True
    Else
        GameFont.UnderLine = False
    End If
    If Strike = YES Then
        GameFont.Strikethrough = True
    Else
        GameFont.Strikethrough = False
    End If
    GameFont.Size = Size
    GameFont.Name = Font
    DD_PrimarySurf.SetFont GameFont
    
End Sub

Public Sub DrawText(ByVal hDC As Long, ByVal x, ByVal y, ByVal Text As String, Color As Long)
    'Call SelectObject(hDC, GameFont)
    'Call SetBkMode(hDC, vbTransparent)
    'Call SetTextColor(hDC, RGB(0, 0, 0))
    'Call TextOut(hDC, x + 1, y + 1, Text, Len(Text))
    'Call SetTextColor(hDC, Color)
    'Call TextOut(hDC, x, y, Text, Len(Text))

    DD_PrimarySurf.SetForeColor Color
    DD_PrimarySurf.DrawText x, y, Text, False
    
End Sub
Public Sub DrawPlayerNameText(ByVal hDC As Long, ByVal x, ByVal y, ByVal Text As String, Color As Long)
    'Call SelectObject(hDC, GameFont)
    'Call SetBkMode(hDC, vbTransparent)
    'Call SetTextColor(hDC, RGB(0, 0, 0))
    'Call TextOut(hDC, x + 1, y + 1, Text, Len(Text))
    'Call SetTextColor(hDC, Color)
    'Call TextOut(hDC, x, y, Text, Len(Text))

    DD_PrimarySurf.SetForeColor Color
    DD_PrimarySurf.DrawText x, y, Text, False
    
End Sub

It's not Blting to picScreen...it Blt's above the game window...I can see why, but I thought the PrimarySurf would blt to picScreen...anyways I tried creating my own surface, but to no luck...I also just tried using the BackBuffer, but I got an automation error for using more than one DC or something on it.

Any help?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)