Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub RenderTextCentered(ByVal lngXPos As Integer, ByVal lngYPos As Integer, ByRef strText As String, ByVal lngColor As Long, ByRef font As StdFont)
- Dim hdc As Long
- Dim ret As size
- If strText <> "" Then
- Call BackBufferSurface.SetFont(font)
- 'Get width of text once rendered
- hdc = BackBufferSurface.GetDC()
- Call GetTextExtentPoint32(hdc, strText, Len(strText), ret)
- Call BackBufferSurface.ReleaseDC(hdc)
- lngXPos = lngXPos - ret.cx \ 2
- Call BackBufferSurface.SetForeColor(vbBlack)
- Call BackBufferSurface.DrawText(lngXPos - 2, lngYPos - 1, strText, False)
- Call BackBufferSurface.SetForeColor(lngColor)
- Call BackBufferSurface.DrawText(lngXPos, lngYPos, strText, False)
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement