Results 1 to 32 of 32

Thread: VB: Drawing in a game

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    33

    VB: Drawing in a game

    Hi, Im trying to display a text message inside a game, it works but it flickers real bad. Programs like FRAPS or XFIRE also draw inside a game but then without the flickering. Whats the best way to make this kind function without the text flickering all the time? The one that Im using now (which flickers) is this one:

    Code:
    Public Function DrawText(hwnd As Long, strText As String, x As Long, y As Long)
        Dim hDC As Long
        
        hDC = GetDC(hwnd)
        If hDC = 0 Then Exit Function
    
        SetBkMode hDC, vbTransparent 'Transparent background
        SetTextColor hDC, 0 'Textcolor to black
        TextOut hDC, x + 1, y + 1, strText, Len(strText) 'Make shadow
        TextOut hDC, x + 2, y + 2, strText, Len(strText) 'Make shadow
        SetTextColor hDC, RGB(0, 255, 0) 'Set text color to green
        TextOut hDC, x, y, strText, Len(strText) 'Write the text
    
        UpdateWindow hwnd
        ReleaseDC hwnd, hDC
    End Function
    Thanks.
    Last edited by Tr_; Dec 9th, 2004 at 08:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width