Results 1 to 2 of 2

Thread: Erase a Sprite

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    9

    Question

    What's the best way to erase a sprite? I can't use CLS as there are other objects that I can't erase.

  2. #2
    Guest
    You can use BitBlt:

    Code:
    Public Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    
    Public Sub erasesquare(fillx as long, filly as long, varwidth as long, varheight as long, SrcDC as long, endobj as form, optional color as long = endobj.backcolor)
    
    BitBlt endobj.hdc, fillx, filly, varWidth, varHeight, SrcDC, 0, 0, color As Long
    
    End Sub
    
    Function BitRGB(Red as byte, Green as byte, Blue as byte) as variant
        dim xc as long
        xc = (red * 10000) + (green * 100) + blue
        bitRGB = hex(xc)
    End Function
    The use:
    Code:
    erasesquare([x-pos], [y-pos], [width], [height], 0, [Your Form or Object], BitRGB(R,G,B))

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