davecooper
Sep 19th, 2000, 12:04 AM
What's the best way to erase a sprite? I can't use CLS as there are other objects that I can't erase.
You can use BitBlt:
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:
erasesquare([x-pos], [y-pos], [width], [height], 0, [Your Form or Object], BitRGB(R,G,B))